Extract linter in `docker:test` Rake task into `docker:lint`.

This commit is contained in:
Guo Xiang Tan 2017-08-18 12:15:46 +09:00
parent 6ed65b1ca3
commit 8ecf383c55
2 changed files with 11 additions and 10 deletions

View File

@ -7,7 +7,6 @@
# => 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)
@ -32,6 +31,15 @@ def run_or_fail(command)
$?.exitstatus == 0
end
desc 'Run JS and Ruby linters'
task 'docker:lint' do
success = run_or_fail("bundle exec rubocop --parallel")
success = run_or_fail("eslint app/assets/javascripts test/javascripts")
success = run_or_fail("eslint --ext .es6 app/assets/javascripts test/javascripts plugins")
exit 1 if !success
end
desc 'Run all tests (JS and code in a standalone environment)'
task 'docker:test' do
begin
@ -64,8 +72,6 @@ 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"
@ -78,10 +84,8 @@ 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
@ -90,18 +94,14 @@ task 'docker:test' do
unless ENV["RUBY_ONLY"]
unless ENV["SKIP_CORE"]
@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

View File

@ -12,4 +12,5 @@ unless ENV['NO_UPDATE']
run_or_fail("bundle")
end
run_or_fail("bundle exec rake docker:test")
run_or_fail("bundle exec rake docker:lint") unless ENV["SKIP_LINT"]
run_or_fail("bundle exec rake docker:test") unless ENV["LINT_ONLY"]