diff --git a/.rubocop.yml b/.rubocop.yml index 3d0f38336..6c37f1b8a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,5 @@ +inherit_from: .rubocop_todo.yml + require: - rubocop-performance - rubocop-rake diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..9cb073ce1 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,11 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp` +# using RuboCop version 1.36.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +Rake/MethodDefinitionInTask: + Exclude: + - 'tasks/cut_release.rake' diff --git a/CHANGELOG.md b/CHANGELOG.md index 316aebf9e..4346961b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Master (Unreleased) +## 2.14.0 (2022-10-23) + - Add `require_implicit` style to `RSpec/ImplicitSubject`. ([@r7kamura]) - Fix a false positive for `RSpec/Capybara/SpecificMatcher` when `have_css("a")` without attribute. ([@ydah]) - Update `RSpec/ExampleWording` cop to raise error for insufficient descriptions. ([@akrox58]) diff --git a/Gemfile b/Gemfile index 82b6fd020..fa7613df2 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,7 @@ source 'https://rubygems.org' gemspec +gem 'bump' gem 'rack' gem 'rake' gem 'rspec', '~> 3.11' diff --git a/config/default.yml b/config/default.yml index 1c36c0e6b..aab6edef2 100644 --- a/config/default.yml +++ b/config/default.yml @@ -194,7 +194,7 @@ RSpec/ChangeByZero: Description: Prefer negated matchers over `to change.by(0)`. Enabled: pending VersionAdded: '2.11' - VersionChanged: "<>" + VersionChanged: '2.14' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ChangeByZero NegatedMatcher: ~ @@ -773,7 +773,7 @@ RSpec/SingleArgumentMessageChain: RSpec/SortMetadata: Description: Sort RSpec metadata alphabetically. Enabled: pending - VersionAdded: "<>" + VersionAdded: '2.14' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SortMetadata RSpec/StubbedMock: @@ -936,7 +936,7 @@ RSpec/FactoryBot/ConsistentParenthesesStyle: SupportedStyles: - require_parentheses - omit_parentheses - VersionAdded: "<>" + VersionAdded: '2.14' Reference: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/ConsistentParenthesesStyle RSpec/FactoryBot/CreateList: diff --git a/docs/antora.yml b/docs/antora.yml index bd35f744c..63a78f4c1 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -1,5 +1,5 @@ name: rubocop-rspec title: RuboCop RSpec -version: master +version: '2.14' nav: - modules/ROOT/nav.adoc diff --git a/docs/modules/ROOT/pages/cops_rspec.adoc b/docs/modules/ROOT/pages/cops_rspec.adoc index e4d799540..0b5b467b7 100644 --- a/docs/modules/ROOT/pages/cops_rspec.adoc +++ b/docs/modules/ROOT/pages/cops_rspec.adoc @@ -392,7 +392,7 @@ end | Yes | Yes | 2.11 -| <> +| 2.14 |=== Prefer negated matchers over `to change.by(0)`. @@ -4472,7 +4472,7 @@ allow(foo).to receive("bar.baz") | Pending | Yes | Yes -| <> +| 2.14 | - |=== diff --git a/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc b/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc index 106f52545..d8c11de74 100644 --- a/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc +++ b/docs/modules/ROOT/pages/cops_rspec_factorybot.adoc @@ -59,7 +59,7 @@ count { 1 } | Pending | Yes | Yes -| <> +| 2.14 | - |=== diff --git a/lib/rubocop/rspec/version.rb b/lib/rubocop/rspec/version.rb index 2b86a2edc..cabe7c476 100644 --- a/lib/rubocop/rspec/version.rb +++ b/lib/rubocop/rspec/version.rb @@ -4,7 +4,7 @@ module RuboCop module RSpec # Version information for the RSpec RuboCop plugin. module Version - STRING = '2.13.2' + STRING = '2.14.0' end end end diff --git a/tasks/cut_release.rake b/tasks/cut_release.rake new file mode 100644 index 000000000..c9e8a9cc1 --- /dev/null +++ b/tasks/cut_release.rake @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +require 'bump' + +namespace :cut_release do + def update_file(path) + content = File.read(path) + File.write(path, yield(content)) + end + + %w[major minor patch pre].each do |release_type| + desc "Cut a new #{release_type} release and update documents." + task release_type do + run(release_type) + end + end + + def version_sans_patch(version) + version.split('.').take(2).join('.') + end + + # Replace `<>` (and variations) with version being cut. + def update_cop_versions(version) + update_file('config/default.yml') do |default| + default.gsub(/['"]?<<\s*next\s*>>['"]?/i, + "'#{version_sans_patch(version)}'") + end + RuboCop::ConfigLoader.default_configuration = nil # invalidate loaded conf + end + + def update_docs(version) + update_file('docs/antora.yml') do |antora_metadata| + antora_metadata.sub('version: master', + "version: '#{version_sans_patch(version)}'") + end + end + + def add_header_to_changelog(version) + update_file('CHANGELOG.md') do |changelog| + changelog.sub("## Master (Unreleased)\n\n", + '\0' "## #{version} (#{Time.now.strftime('%F')})\n\n") + end + end + + def run(release_type) + old_version = Bump::Bump.current + Bump::Bump.run(release_type, commit: false, bundle: false, tag: false) + new_version = Bump::Bump.current + + update_cop_versions(new_version) + `bundle exec rake generate_cops_documentation` + update_docs(new_version) + add_header_to_changelog(new_version) + + puts "Changed version from #{old_version} to #{new_version}." + end +end