From e74ff4008cc82891d973d9ee83bf8982d6df334e Mon Sep 17 00:00:00 2001 From: Tejas Bubane Date: Thu, 20 May 2021 02:30:35 +0530 Subject: [PATCH] Add rubocop-rake --- .rubocop.yml | 1 + .rubocop_todo.yml | 3 +++ Gemfile | 1 + Rakefile | 1 + tasks/changelog.rake | 1 + tasks/cops_documentation.rake | 1 + tasks/prof.rake | 1 + 7 files changed, 9 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index dbbfd6e2e1ad..e4af88e2dbcb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,7 @@ require: - rubocop/cop/internal_affairs - rubocop-performance - rubocop-rspec + - rubocop-rake AllCops: NewCops: enable diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ffc1ceb75936..ca611c6366b3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -68,3 +68,6 @@ RSpec/SubjectStub: - 'spec/rubocop/config_spec.rb' - 'spec/rubocop/formatter/json_formatter_spec.rb' - 'spec/rubocop/formatter/progress_formatter_spec.rb' + +Rake/MethodDefinitionInTask: + Enabled: false diff --git a/Gemfile b/Gemfile index 844856b8c558..08b41937fdfd 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,7 @@ gem 'rspec', '~> 3.7' # RuboCop Performance upgrade to 1.11 is postponed until # https://github.com/rubocop/rubocop/pull/9721 will be resolved. gem 'rubocop-performance', '~> 1.10.0' +gem 'rubocop-rake', '~> 0.6.0' gem 'rubocop-rspec', '~> 2.3.0' # Workaround for cc-test-reporter with SimpleCov 0.18. # Stop upgrading SimpleCov until the following issue will be resolved. diff --git a/Rakefile b/Rakefile index f99c841e94cc..88a41dc9ccc5 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,7 @@ # and started before any application code is loaded. require 'simplecov' if ENV['COVERAGE'] +desc 'Check for no pending changelog entries before release' task release: 'changelog:check_clean' # Before task is required require 'bundler' diff --git a/tasks/changelog.rake b/tasks/changelog.rake index 0004e389bd05..89af18e581d0 100644 --- a/tasks/changelog.rake +++ b/tasks/changelog.rake @@ -24,6 +24,7 @@ namespace :changelog do system cmd end + desc 'Check for no pending changelog entries' task :check_clean do next unless Changelog.pending? diff --git a/tasks/cops_documentation.rake b/tasks/cops_documentation.rake index 80f1e1acfa87..f6065a30e2b6 100644 --- a/tasks/cops_documentation.rake +++ b/tasks/cops_documentation.rake @@ -9,6 +9,7 @@ YARD::Rake::YardocTask.new(:yard_for_generate_documentation) do |task| task.options = ['--no-output'] end +desc 'Update documentation of all cops' task update_cops_documentation: :yard_for_generate_documentation do deps = %w[Bundler Gemspec Layout Lint Metrics Migration Naming Security Style] CopsDocumentationGenerator.new(departments: deps).call diff --git a/tasks/prof.rake b/tasks/prof.rake index 91a287557843..0ecb5fb6b580 100644 --- a/tasks/prof.rake +++ b/tasks/prof.rake @@ -10,6 +10,7 @@ namespace :prof do system cmd end + desc 'Run RuboCop on itself only if dump does not exist' task :run_if_needed, [:path] do Rake::Task[:run].run unless File.exist?(dump_path) end