mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
Improve source code linting for continuous integration (#5017)
* Add rubocop linting to docker:test rake task * Add eslint JS listing to plugin files, and add SKIP_LINT variable * Fix failing ‘polls’ plugin eslint Using eslint-disable-line, as is done in core qunit tests such as `acceptance/group-logs-test.js.es6` * Add plugin test eslint to travis config * Merge some eslint lines
This commit is contained in:

committed by
Guo Xiang Tan

parent
3538b63305
commit
ea032d8372
@ -7,6 +7,7 @@
|
||||
# => INSTALL_OFFICIAL_PLUGINS set to 1 to install all core plugins before running tests
|
||||
# => RUBY_ONLY set to 1 to skip all qunit tests
|
||||
# => JS_ONLY set to 1 to skip all rspec tests
|
||||
# => SKIP_LINT set to 1 to skip rubocop and eslint checks
|
||||
# => SINGLE_PLUGIN set to plugin name to only run plugin-specific rspec tests (you'll probably want to SKIP_CORE as well)
|
||||
# => BISECT set to 1 to run rspec --bisect (applies to core rspec tests only)
|
||||
# => RSPEC_SEED set to seed to use for rspec tests (applies to core rspec tests only)
|
||||
@ -63,6 +64,8 @@ task 'docker:test' do
|
||||
unless ENV["JS_ONLY"]
|
||||
|
||||
unless ENV["SKIP_CORE"]
|
||||
@good &&= run_or_fail("bundle exec rubocop --parallel") unless ENV["SKIP_LINT"]
|
||||
|
||||
params = []
|
||||
if ENV["BISECT"]
|
||||
params << "--bisect"
|
||||
@ -75,8 +78,10 @@ task 'docker:test' do
|
||||
|
||||
unless ENV["SKIP_PLUGINS"]
|
||||
if ENV["SINGLE_PLUGIN"]
|
||||
@good &&= run_or_fail("bundle exec rubocop --parallel plugins/#{ENV["SINGLE_PLUGIN"]}") unless ENV["SKIP_LINT"]
|
||||
@good &&= run_or_fail("bundle exec rake plugin:spec['#{ENV["SINGLE_PLUGIN"]}']")
|
||||
else
|
||||
@good &&= run_or_fail("bundle exec rubocop --parallel plugins") unless ENV["SKIP_LINT"]
|
||||
@good &&= run_or_fail("bundle exec rake plugin:spec")
|
||||
end
|
||||
end
|
||||
@ -85,18 +90,18 @@ task 'docker:test' do
|
||||
|
||||
unless ENV["RUBY_ONLY"]
|
||||
unless ENV["SKIP_CORE"]
|
||||
@good &&= run_or_fail("eslint app/assets/javascripts")
|
||||
@good &&= run_or_fail("eslint --ext .es6 app/assets/javascripts")
|
||||
@good &&= run_or_fail("eslint --ext .es6 test/javascripts")
|
||||
@good &&= run_or_fail("eslint test/javascripts")
|
||||
@good &&= run_or_fail("eslint app/assets/javascripts test/javascripts") unless ENV["SKIP_LINT"]
|
||||
@good &&= run_or_fail("eslint --ext .es6 app/assets/javascripts test/javascripts") unless ENV["SKIP_LINT"]
|
||||
@good &&= run_or_fail("bundle exec rake qunit:test['600000']")
|
||||
@good &&= run_or_fail("bundle exec rake qunit:test['600000','/wizard/qunit']")
|
||||
end
|
||||
|
||||
unless ENV["SKIP_PLUGINS"]
|
||||
if ENV["SINGLE_PLUGIN"]
|
||||
@good &&= run_or_fail("eslint --ext .es6 plugins/#{ENV['SINGLE_PLUGIN']}") unless ENV["SKIP_LINT"]
|
||||
@good &&= run_or_fail("bundle exec rake plugin:qunit['#{ENV['SINGLE_PLUGIN']}','600000']")
|
||||
else
|
||||
@good &&= run_or_fail("eslint --ext .es6 plugins") unless ENV["SKIP_LINT"]
|
||||
@good &&= run_or_fail("bundle exec rake plugin:qunit['*','600000']")
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user