diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 14d4e59c5f2..b2125eea167 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -68,6 +68,10 @@ jobs: if: ${{ !cancelled() }} run: bundle exec rubocop --parallel . + - name: syntax_tree + if: ${{ !cancelled() }} + run: bundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') + - name: ESLint (core) if: ${{ !cancelled() }} run: yarn eslint app/assets/javascripts diff --git a/.rubocop.yml b/.rubocop.yml index b7edfe48948..4d4ad6d8d80 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ inherit_gem: - rubocop-discourse: default.yml + rubocop-discourse: stree-compat.yml # Still work to do in ensuring we don't link old files Discourse/NoAddReferenceOrAliasesActiveRecordMigration: diff --git a/.streerc b/.streerc index 0bc4379d460..3669f107c57 100644 --- a/.streerc +++ b/.streerc @@ -1,2 +1,10 @@ --print-width=100 ---plugins=plugin/trailing_comma +--plugins=plugin/trailing_comma,disable_ternary +--ignore-files=Gemfile +--ignore-files=app/* +--ignore-files=config/* +--ignore-files=db/* +--ignore-files=lib/* +--ignore-files=plugins/* +--ignore-files=script/* +--ignore-files=spec/* diff --git a/Gemfile b/Gemfile index 8aef1556fa7..1069509ac60 100644 --- a/Gemfile +++ b/Gemfile @@ -169,6 +169,9 @@ group :test, :development do gem 'rswag-specs' gem 'annotate' + + gem "syntax_tree" + gem 'syntax_tree-disable_ternary' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 6bac0060e9c..9c4fbc7b11b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -301,6 +301,7 @@ GEM parser (3.2.0.0) ast (~> 2.4.1) pg (1.4.5) + prettier_print (1.2.0) progress (3.6.0) pry (0.14.1) coderay (~> 1.1) @@ -408,7 +409,7 @@ GEM unicode-display_width (>= 1.4.0, < 3.0) rubocop-ast (1.24.1) parser (>= 3.1.1.0) - rubocop-discourse (3.0.1) + rubocop-discourse (3.0.2) rubocop (>= 1.1.0) rubocop-rspec (>= 2.0.0) rubocop-rspec (2.16.0) @@ -460,6 +461,9 @@ GEM sprockets (>= 3.0.0) sshkey (2.0.0) stackprof (0.2.23) + syntax_tree (5.2.0) + prettier_print (>= 1.2.0) + syntax_tree-disable_ternary (1.0.0) test-prof (1.1.0) thor (1.2.1) tilt (2.0.11) @@ -627,6 +631,8 @@ DEPENDENCIES sprockets-rails sshkey stackprof + syntax_tree + syntax_tree-disable_ternary test-prof thor uglifier