Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump rubocop-rspec from 2.23.2 to 2.24.1 #123

Merged
merged 9 commits into from
Oct 16, 2023
68 changes: 20 additions & 48 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
# 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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: 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:
- '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
Expand All @@ -41,12 +27,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

Expand Down Expand Up @@ -85,13 +71,13 @@ 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
# Offense count: 1
RSpec/MultipleExpectations:
Max: 2

Expand All @@ -100,8 +86,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'
Expand All @@ -117,40 +104,25 @@ RSpec/PredicateMatcher:
Exclude:
- 'spec/pull_request_spec.rb'

# Offense count: 8
RSpec/SubjectStub:
# 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: 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:
# Offense count: 5
RSpec/SubjectStub:
Exclude:
- 'lib/simple_review_app/docker_compose_file.rb'
- 'spec/pull_request_spec.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
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.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'lib/simple_review_app.rb'
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion lib/simple_review_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -135,11 +136,12 @@ 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)
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.'
Expand Down
4 changes: 1 addition & 3 deletions lib/simple_review_app/docker_compose_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/simple_review_app/pull_request_collection.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'octokit.rb'
require 'octokit'
require 'active_model'
require_relative 'logger'
require_relative 'pull_request'
Expand Down
6 changes: 2 additions & 4 deletions lib/simple_review_app/review_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions simple_review_app.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/pull_request_collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand Down
2 changes: 1 addition & 1 deletion spec/pull_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:,
Expand Down