From 80728287283906f0ed66f5ccd5b4c6380a2db786 Mon Sep 17 00:00:00 2001 From: osc-bot <78549874+osc-bot@users.noreply.github.com> Date: Tue, 25 Jun 2024 09:15:34 -0400 Subject: [PATCH] lint a random file (#3635) --- lib/tasks/lint.rb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/tasks/lint.rb b/lib/tasks/lint.rb index 6e9f0db673..d8d92e11e2 100644 --- a/lib/tasks/lint.rb +++ b/lib/tasks/lint.rb @@ -1,6 +1,8 @@ +# frozen_string_literal: true + require 'fileutils' -desc "Lint OnDemand" +desc 'Lint OnDemand' task :lint => 'lint:all' namespace :lint do @@ -8,17 +10,17 @@ include RakeHelper DEFAULT_PATTERNS = [ - "apps/**/*.rb", - "lib/**/*.rb", - "nginx_stage/**/*.rb", - "ood-portal-generator/**/*.rb", - "spec/**/*.rb", - ] + 'apps/**/*.rb', + 'lib/**/*.rb', + 'nginx_stage/**/*.rb', + 'ood-portal-generator/**/*.rb', + 'spec/**/*.rb' + ].freeze begin require 'rubocop/rake_task' RuboCop::RakeTask.new(:rubocop, [:path]) do |t, args| - t.options = ["--config=#{PROJ_DIR.join(".rubocop.yml")}"] + t.options = ["--config=#{PROJ_DIR.join('.rubocop.yml')}"] t.patterns = args[:path].nil? ? DEFAULT_PATTERNS : [args[:path]] end rescue LoadError @@ -26,7 +28,7 @@ begin require 'rubocop/rake_task' - RuboCop::RakeTask.new(:random) do |t, args| + RuboCop::RakeTask.new(:random) do |t, _args| all_files = Dir.glob(DEFAULT_PATTERNS).reject { |f| f.include?('vendor/bundle') } one_file = all_files[Random.rand(all_files.size)] @@ -36,7 +38,7 @@ rescue LoadError end - desc "Setup .rubocop.yml files" + desc 'Setup .rubocop.yml files' task :setup do source = PROJ_DIR.join('.rubocop.yml') (ruby_apps + infrastructure).each do |app|