From 47721b206e72ce643b270468406fe37b3181f317 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:35:43 +0000 Subject: [PATCH 1/9] Bump rubocop-rspec from 2.23.2 to 2.24.1 Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.23.2 to 2.24.1. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.23.2...v2.24.1) --- updated-dependencies: - dependency-name: rubocop-rspec dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c4f5d27..fa03220 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,11 +90,11 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-capybara (2.18.0) + rubocop-capybara (2.19.0) rubocop (~> 1.41) - rubocop-factory_bot (2.23.1) + rubocop-factory_bot (2.24.0) rubocop (~> 1.33) - rubocop-rspec (2.23.2) + rubocop-rspec (2.24.1) rubocop (~> 1.33) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) From b2a8cbaa42f50e74eff4ca461651f007fe1c245a Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 13:43:02 +0200 Subject: [PATCH 2/9] Update obsolete RuboCop TODO file --- .rubocop_todo.yml | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 889623f..e63f5fc 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-08-11 09:16:56 UTC using RuboCop version 1.34.1. +# on 2023-10-16 11:42:28 UTC using RuboCop version 1.57.1. # 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 @@ -8,14 +8,14 @@ # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Include. +# Configuration parameters: Severity, Include. # Include: **/*.gemspec Gemspec/RequireMFA: Exclude: - 'simple_review_app.gemspec' # Offense count: 1 -# Configuration parameters: Include. +# Configuration parameters: Severity, Include. # Include: **/*.gemspec Gemspec/RequiredRubyVersion: Exclude: @@ -41,12 +41,12 @@ Lint/NonAtomicFileOperation: - 'lib/simple_review_app/pull_request.rb' # Offense count: 1 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes. +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 18 # Offense count: 1 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods. +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 11 @@ -85,13 +85,22 @@ RSpec/LeakyConstantDeclaration: Exclude: - 'spec/logger_spec.rb' -# Offense count: 5 +# Offense count: 3 # Configuration parameters: . # SupportedStyles: have_received, receive RSpec/MessageSpies: EnforcedStyle: receive # Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: hash, symbol +RSpec/MetadataStyle: + Exclude: + - 'spec/pull_request_collection_spec.rb' + - 'spec/pull_request_spec.rb' + +# Offense count: 1 RSpec/MultipleExpectations: Max: 2 @@ -100,8 +109,9 @@ RSpec/MultipleExpectations: RSpec/MultipleMemoizedHelpers: Max: 6 -# Offense count: 20 -# Configuration parameters: IgnoreSharedExamples. +# Offense count: 15 +# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. +# SupportedStyles: always, named_only RSpec/NamedSubject: Exclude: - 'spec/docker_compose_file_spec.rb' @@ -117,7 +127,18 @@ RSpec/PredicateMatcher: Exclude: - 'spec/pull_request_spec.rb' -# Offense count: 8 +# Offense count: 4 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata. +# Include: **/*_spec.rb +RSpec/SpecFilePathFormat: + Exclude: + - '**/spec/routing/**/*' + - 'spec/docker_compose_file_spec.rb' + - 'spec/logger_spec.rb' + - 'spec/pull_request_collection_spec.rb' + - 'spec/pull_request_spec.rb' + +# Offense count: 5 RSpec/SubjectStub: Exclude: - 'spec/pull_request_spec.rb' From 42d0dfabdc7b565a7978dc2aac9f7b937c57b9ee Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 13:51:43 +0200 Subject: [PATCH 3/9] Autocorrect RSpec/MetadataStyle RuboCop offenses --- .rubocop_todo.yml | 9 --------- spec/pull_request_collection_spec.rb | 2 +- spec/pull_request_spec.rb | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index e63f5fc..ef014dd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -91,15 +91,6 @@ RSpec/LeakyConstantDeclaration: RSpec/MessageSpies: EnforcedStyle: receive -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: hash, symbol -RSpec/MetadataStyle: - Exclude: - - 'spec/pull_request_collection_spec.rb' - - 'spec/pull_request_spec.rb' - # Offense count: 1 RSpec/MultipleExpectations: Max: 2 diff --git a/spec/pull_request_collection_spec.rb b/spec/pull_request_collection_spec.rb index 64f20a3..6fd6cba 100644 --- a/spec/pull_request_collection_spec.rb +++ b/spec/pull_request_collection_spec.rb @@ -4,7 +4,7 @@ require 'octokit' require 'simple_review_app/pull_request_collection' -describe SimpleReviewApp::PullRequestCollection, vcr: true do +describe SimpleReviewApp::PullRequestCollection, :vcr do let(:logger) { double } let(:label) { 'review-lab' } diff --git a/spec/pull_request_spec.rb b/spec/pull_request_spec.rb index 960b576..95a9b2c 100644 --- a/spec/pull_request_spec.rb +++ b/spec/pull_request_spec.rb @@ -4,7 +4,7 @@ require 'octokit' require 'simple_review_app/pull_request' -describe SimpleReviewApp::PullRequest, vcr: true do +describe SimpleReviewApp::PullRequest, :vcr do subject do SimpleReviewApp::PullRequest.new( content:, From 4d1b60c4b6261d1f298241ee2d80a31ca3a4213c Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 13:54:34 +0200 Subject: [PATCH 4/9] Autocorrect RuboCop Style/ExplicitBlockArgument offenses --- .rubocop_todo.yml | 6 ------ lib/simple_review_app/review_app.rb | 6 ++---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ef014dd..d3a2e17 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -134,12 +134,6 @@ RSpec/SubjectStub: Exclude: - 'spec/pull_request_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/ExplicitBlockArgument: - Exclude: - - 'lib/simple_review_app/review_app.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). Style/FileWrite: diff --git a/lib/simple_review_app/review_app.rb b/lib/simple_review_app/review_app.rb index b0e5c67..7f7772e 100644 --- a/lib/simple_review_app/review_app.rb +++ b/lib/simple_review_app/review_app.rb @@ -153,10 +153,8 @@ def project_directory File.join(directory, project_name) end - def do_in_project_directory - Dir.chdir(project_directory) do - yield - end + def do_in_project_directory(&) + Dir.chdir(project_directory, &) end end end From 8e1c9d86fb2369ce289da46e76240c604b85f5d4 Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 13:55:37 +0200 Subject: [PATCH 5/9] Autocorrect Style/FileWrite RuboCop offenses --- .rubocop_todo.yml | 6 ------ lib/simple_review_app/docker_compose_file.rb | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d3a2e17..3f6addb 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -134,12 +134,6 @@ RSpec/SubjectStub: Exclude: - 'spec/pull_request_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/FileWrite: - Exclude: - - 'lib/simple_review_app/docker_compose_file.rb' - # Offense count: 1 # Configuration parameters: AllowedMethods. # AllowedMethods: respond_to_missing? diff --git a/lib/simple_review_app/docker_compose_file.rb b/lib/simple_review_app/docker_compose_file.rb index 2ab8e3f..639b511 100644 --- a/lib/simple_review_app/docker_compose_file.rb +++ b/lib/simple_review_app/docker_compose_file.rb @@ -18,9 +18,7 @@ def content def update @content = template.render(attributes) - File.open(path, 'w') do |f| - f.write(@content) - end + File.write(path, @content) self end From 0138d5cfeaa47e175415909d55547088262666da Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 13:56:39 +0200 Subject: [PATCH 6/9] Autocorrect Style/RedundantFileExtensionInRequire ... RuboCop offenses --- .rubocop_todo.yml | 6 ------ lib/simple_review_app/pull_request_collection.rb | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3f6addb..f0c9da4 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -141,12 +141,6 @@ Style/OptionalBooleanParameter: Exclude: - 'lib/simple_review_app/review_app.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantFileExtensionInRequire: - Exclude: - - 'lib/simple_review_app/pull_request_collection.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. diff --git a/lib/simple_review_app/pull_request_collection.rb b/lib/simple_review_app/pull_request_collection.rb index ca3bdd1..992a05c 100644 --- a/lib/simple_review_app/pull_request_collection.rb +++ b/lib/simple_review_app/pull_request_collection.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'octokit.rb' +require 'octokit' require 'active_model' require_relative 'logger' require_relative 'pull_request' From 20229402b306c7f499153f660e87f625885e09d1 Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 13:57:54 +0200 Subject: [PATCH 7/9] Autocorrect Style/StringLiterals RuboCop offenses --- .rubocop_todo.yml | 8 -------- lib/simple_review_app.rb | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f0c9da4..811e28d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -140,11 +140,3 @@ RSpec/SubjectStub: Style/OptionalBooleanParameter: Exclude: - 'lib/simple_review_app/review_app.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: - Exclude: - - 'lib/simple_review_app.rb' diff --git a/lib/simple_review_app.rb b/lib/simple_review_app.rb index cbcbc5f..7f53bc7 100644 --- a/lib/simple_review_app.rb +++ b/lib/simple_review_app.rb @@ -139,7 +139,7 @@ def client logger.info "Authenticating to GitHub with username #{github_username}." @client = Octokit::Client.new(login: github_username, password: github_password) elsif github_access_token.present? - logger.info "Authenticating to GitHub with access token." + logger.info 'Authenticating to GitHub with access token.' @client = Octokit::Client.new(access_token: github_access_token) else logger.info 'Using github API as anonymous user.' From d83f4a1f53eca3a788ab714091b770bc78c0bdf9 Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 13:59:25 +0200 Subject: [PATCH 8/9] Autocorrect Gemspec/RequireMFA RuboCop offense --- .rubocop_todo.yml | 8 -------- simple_review_app.gemspec | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 811e28d..1623a63 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,14 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Severity, Include. -# Include: **/*.gemspec -Gemspec/RequireMFA: - Exclude: - - 'simple_review_app.gemspec' - # Offense count: 1 # Configuration parameters: Severity, Include. # Include: **/*.gemspec diff --git a/simple_review_app.gemspec b/simple_review_app.gemspec index 680c338..096008a 100644 --- a/simple_review_app.gemspec +++ b/simple_review_app.gemspec @@ -18,4 +18,5 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'octokit', '>= 4', '< 8' s.add_runtime_dependency 'rake', '>= 12.3', '< 14.0' s.add_runtime_dependency 'zaru', '>= 0.2', '< 2.0' + s.metadata['rubygems_mfa_required'] = 'true' end From aae8f18aa2146271cda35a37f12230f65b9d324c Mon Sep 17 00:00:00 2001 From: Eduardo Navarro Date: Mon, 16 Oct 2023 14:00:28 +0200 Subject: [PATCH 9/9] Autocorrect Layout/EmptyLineAfterGuardClause RuboCop ... offense --- .rubocop_todo.yml | 6 ------ lib/simple_review_app.rb | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1623a63..29a6a9c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,12 +13,6 @@ Gemspec/RequiredRubyVersion: Exclude: - 'simple_review_app.gemspec' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLineAfterGuardClause: - Exclude: - - 'lib/simple_review_app.rb' - # Offense count: 1 # Configuration parameters: AllowedMethods. # AllowedMethods: enums diff --git a/lib/simple_review_app.rb b/lib/simple_review_app.rb index 7f53bc7..f8645d9 100644 --- a/lib/simple_review_app.rb +++ b/lib/simple_review_app.rb @@ -102,6 +102,7 @@ def data_directory def create_data_directory return if File.exist?(data_directory) + msg = "Data directory #{data_directory} does not exist, creating it." logger.info(msg) FileUtils.mkdir_p(data_directory) @@ -135,6 +136,7 @@ def credentials? def client return @client if @client.present? + if credentials? logger.info "Authenticating to GitHub with username #{github_username}." @client = Octokit::Client.new(login: github_username, password: github_password)