Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Replace dangerfile with eslint plugins

Oliver Günther425b57b00769
diff --git a/.github/workflows/eslint-core.yml b/.github/workflows/eslint-core.yml
index 0d790aee937..b15946abb6b 100644
--- a/.github/workflows/eslint-core.yml
+++ b/.github/workflows/eslint-core.yml
@@ -1,4 +1,4 @@
-name: Core/eslint
+name: "Core/Frontend-Linting"
on:
pull_request:
branches:
@@ -10,7 +10,7 @@ on:
jobs:
eslint:
- name: runner / eslint
+ name: eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
diff --git a/.github/workflows/rubocop-core.yml b/.github/workflows/rubocop-core.yml
index 664ccf54757..8624431edf5 100644
--- a/.github/workflows/rubocop-core.yml
+++ b/.github/workflows/rubocop-core.yml
@@ -1,4 +1,5 @@
-name: Core/rubocop
+name: "Core/Backend-Linting"
+
on:
pull_request:
branches:
@@ -9,7 +10,7 @@ on:
jobs:
rubocop:
- name: runner / rubocop
+ name: rubocop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml
index 5ad7ecd99fe..95c887c6669 100644
--- a/.github/workflows/test-core.yml
+++ b/.github/workflows/test-core.yml
@@ -15,17 +15,6 @@ on:
- 'help/**'
jobs:
- danger:
- if: github.repository == 'opf/openproject'
- runs-on: [ubuntu-latest]
- timeout-minutes: 10
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 50
- - uses: danger/danger@master
- env:
- DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
units:
name: Units
if: github.repository == 'opf/openproject'
diff --git a/Dangerfile b/Dangerfile
deleted file mode 100644
index ad4ec258e80..00000000000
--- a/Dangerfile
+++ /dev/null
@@ -1,24 +0,0 @@
-# Fail if jasmine specs contain fdescribe or fit
-fail("jasmine fdescribe/fit left in tests") if `grep --include '*.spec.ts' -rP 'fdescribe\\(|fit\\(' frontend/src/`.length > 1
-
-# Search for modified components not being made OnPush
-git.modified_files
- .select { |path| path.include?('frontend') && path.end_with?('.ts') }
- .each do |path|
- next unless File.readable?(path)
-
- lines = File.readlines (path)
-
- # Ignore non component files
- component_line = lines.grep(/@Component/)[0]
- next unless component_line
-
- # Check for missing onPush
- unless lines.grep(/changeDetection:\s+ChangeDetectionStrategy.OnPush/).length > 0
- warn(
- "Please use `ChangeDetectionStrategy.OnPush` for this component",
- file: path,
- line: lines.index(component_line) || 0
- )
- end
-end
diff --git a/Gemfile b/Gemfile
index 633b7e65271..cd831fc4723 100644
--- a/Gemfile
+++ b/Gemfile
@@ -282,9 +282,6 @@ group :development, :test do
gem 'pry-rescue', '~> 1.5.2'
gem 'pry-stack_explorer', '~> 0.6.0'
- # Dangerfile scanner on CI and locally
- gem 'danger', '~> 8.3.1'
-
# Brakeman scanner
gem 'brakeman', '~> 5.0.0'
gem 'danger-brakeman'
diff --git a/Gemfile.lock b/Gemfile.lock
index c51fa170e89..05d48fd411d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -983,7 +983,6 @@ DEPENDENCIES
costs!
daemons
dalli (~> 2.7.10)
- danger (~> 8.3.1)
danger-brakeman
dashboards!
database_cleaner (~> 2.0)
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
index 5f0b9c0aa30..2594cf41ccf 100644
--- a/frontend/.eslintrc.js
+++ b/frontend/.eslintrc.js
@@ -14,6 +14,8 @@ module.exports = {
},
plugins: [
"@typescript-eslint",
+ "change-detection-strategy",
+ "jasmine",
],
overrides: [
{
@@ -47,6 +49,9 @@ module.exports = {
{ "type": "element", "prefix": "op", "style": "kebab-case" }
],
+ // Warn when new components are being created without OnPush
+ "change-detection-strategy/on-push": "error",
+
"no-console": [
"error",
{
@@ -122,6 +127,16 @@ module.exports = {
* recommended set provided by the @angular-eslint project would go here.
*/
}
+ },
+ {
+ files: ["*.spec.ts"],
+ extends: ["plugin:jasmine/recommended"],
+ rules: {
+ /**
+ * Any template/HTML related rules you wish to use/reconfigure over and above the
+ * recommended set provided by the @angular-eslint project would go here.
+ */
+ }
}
],
};
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 06bf706604d..1e4ae8bc4a4 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -6974,6 +6974,12 @@
}
}
},
+ "eslint-plugin-change-detection-strategy": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-change-detection-strategy/-/eslint-plugin-change-detection-strategy-0.1.1.tgz",
+ "integrity": "sha512-v+/wuP+dnSnofAxRP+2tIvHuu4SnGryiUtTtpPDa7KX5RthIx+EWS7X7VFKmbnNpkj5YM3DU3VajGNjOVHqZ0g==",
+ "dev": true
+ },
"eslint-plugin-import": {
"version": "2.22.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz",
@@ -7007,6 +7013,12 @@
}
}
},
+ "eslint-plugin-jasmine": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jasmine/-/eslint-plugin-jasmine-4.1.2.tgz",
+ "integrity": "sha512-Jr52EBi6Ql5WVDvRCKBID9kRD6/CaObvCWmgHpqobczX2Mzt8/QMu9vpgx6q/O5jyQ9CIGrKaEbPuEfHRf8guw==",
+ "dev": true
+ },
"eslint-plugin-jsx-a11y": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 4916469425f..f6a28770bfb 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -15,11 +15,11 @@
"@html-eslint/eslint-plugin": "^0.11.0",
"@html-eslint/parser": "^0.11.0",
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
- "@types/jasmine": "~3.6.0",
"@types/chart.js": "^2.9.20",
"@types/codemirror": "0.0.87",
"@types/dragula": "^3.7.0",
"@types/hammerjs": "^2.0.36",
+ "@types/jasmine": "~3.6.0",
"@types/jquery": "^3.3.33",
"@types/jqueryui": "^1.12.10",
"@types/lodash": "^4.14.149",
@@ -27,9 +27,9 @@
"@types/mousetrap": "^1.6.3",
"@types/pako": "^1.0.1",
"@types/resize-observer-browser": "^0.1.4",
+ "@types/swagger-ui": "^3.47.0",
"@types/urijs": "^1.19.6",
"@types/webpack-env": "^1.16.0",
- "@types/swagger-ui": "^3.47.0",
"@typescript-eslint/eslint-plugin": "4.23.0",
"@typescript-eslint/parser": "4.23.0",
"browserslist": "^4.9.1",
@@ -37,7 +37,9 @@
"eslint": "^7.26.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^12.3.1",
+ "eslint-plugin-change-detection-strategy": "^0.1.1",
"eslint-plugin-import": "^2.22.1",
+ "eslint-plugin-jasmine": "^4.1.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
diff --git a/script/ci/dangerfile.sh b/script/ci/dangerfile.sh
deleted file mode 100755
index ce44cceea22..00000000000
--- a/script/ci/dangerfile.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-#-- encoding: UTF-8
-#-- copyright
-# OpenProject is a project management system.
-# Copyright (C) 2012-2015 the OpenProject Foundation (OPF)
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See doc/COPYRIGHT.rdoc for more details.
-#++
-
-set -e
-
-run() {
- echo $1;
- eval $1;
-
- echo $2;
- eval $2;
-}
-
-if [ -z "$DANGER_GITHUB_API_TOKEN" ]; then
- echo "WARNING: Missing Dangerfile token. Dangerfile cannot be executed without it!"
-else
- run "./bin/danger --fail-on-errors=true"
-fi
-