Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run depencency cruiser in jenkins #281

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,23 @@ pipeline {
}
}
}
stage('Dependency Cruiser') {
when {
anyOf {
expression { return params.FRONTEND_TESTS }
changeset '**/*.js'
changeset '**/*.jsp'
changeset '**/*.css'
changeset '**/*.json'
}
}
steps {
dir('src/main/webapp/ui') {
echo 'Running dependency cruiser'
sh 'npm run depcruise'
}
}
}
stage('Jest Tests') {
when {
anyOf {
Expand Down
65 changes: 39 additions & 26 deletions src/main/webapp/ui/.dependency-cruiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
licenseNot: ["MIT", "BSD", "Apache", "Hippocratic", "ISC"],
},
},

{
name: "axios-only",
comment: "Only src/common/axios.js should import axios",
Expand All @@ -25,17 +26,35 @@ module.exports = {
},
},

// {
// name: 'no-circular',
// severity: 'warn',
// comment:
// 'This dependency is part of a circular relationship. You might want to revise ' +
// 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',
// from: {},
// to: {
// circular: true
// }
// },
{
name: "react-image-editor is deprecated",
severity: "error",
from: {
pathNot: [
// once the old gallery is removed, we can remove the dependency and stop using `--force` when calling `npm install`
"^src/Gallery",
],
},
to: {
path: "@toast-ui/react-image-editor",
},
},

// this rule is disabled because cycles are generally not an issue, but the rule can be useful when debugging some issues.
/*
{
name: 'no-circular',
severity: 'warn',
comment:
'This dependency is part of a circular relationship. You might want to revise ' +
'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',
from: {},
to: {
circular: true
}
},
*/

{
name: "no-orphans",
comment:
Expand All @@ -56,9 +75,10 @@ module.exports = {
},
to: {},
},

{
name: "no-unreachable-from-root",
severity: "error",
severity: "warn",
from: {
path: ["src"],
},
Expand Down Expand Up @@ -115,6 +135,7 @@ module.exports = {
reachable: false,
},
},

{
name: "no-deprecated-core",
comment:
Expand Down Expand Up @@ -148,6 +169,7 @@ module.exports = {
],
},
},

{
name: "not-to-deprecated",
comment:
Expand All @@ -159,6 +181,7 @@ module.exports = {
dependencyTypes: ["deprecated"],
},
},

{
name: "no-duplicate-dep-types",
comment:
Expand All @@ -175,6 +198,7 @@ module.exports = {
dependencyTypesNot: ["type-only"],
},
},

{
name: "not-to-spec",
comment:
Expand All @@ -187,6 +211,7 @@ module.exports = {
path: ".(spec|test).(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee.md)$",
},
},

{
name: "not-to-dev-dep",
severity: "error",
Expand All @@ -206,6 +231,7 @@ module.exports = {
pathNot: "@babel",
},
},

{
name: "optional-deps-used",
severity: "info",
Expand All @@ -219,6 +245,7 @@ module.exports = {
dependencyTypes: ["npm-optional"],
},
},

{
name: "peer-deps-used",
comment:
Expand Down Expand Up @@ -308,20 +335,6 @@ module.exports = {
reachable: true,
},
},

{
name: "react-image-editor is deprecated",
severity: "error",
from: {
pathNot: [
// once the old gallery is removed, we can remove the dependency and stop using `--force` when calling `npm install`
"^src/Gallery",
],
},
to: {
path: "@toast-ui/react-image-editor",
},
},
],
allowed: [],
required: [],
Expand Down