Skip to content

Commit

Permalink
lint a random file (#3635)
Browse files Browse the repository at this point in the history
  • Loading branch information
osc-bot authored Jun 25, 2024
1 parent bff3c28 commit 8072828
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions lib/tasks/lint.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
# frozen_string_literal: true

require 'fileutils'

desc "Lint OnDemand"
desc 'Lint OnDemand'
task :lint => 'lint:all'

namespace :lint do
require_relative 'rake_helper'
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
end

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)]

Expand All @@ -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|
Expand Down

0 comments on commit 8072828

Please sign in to comment.