Skip to content

Commit

Permalink
Set Style/AccessorGrouping to separated (#9336)
Browse files Browse the repository at this point in the history
* Set `Style/AccessorGrouping` to `separated`

* Autocorrect `Style/AccessorGrouping`
  • Loading branch information
JamieMagee authored Mar 22, 2024
1 parent d1e4333 commit 4a83645
Show file tree
Hide file tree
Showing 114 changed files with 429 additions and 190 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ Performance/UnfreezeString:
Performance/UriDefaultParser:
Enabled: true
Style/AccessorGrouping:
Enabled: false
EnforcedStyle: 'separated'
Style/ArgumentsForwarding:
Enabled: true
Style/ArrayCoercion:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def conflicting_dependencies

private

attr_reader :dependency_name, :target_version, :lockfile_name
attr_reader :dependency_name
attr_reader :target_version
attr_reader :lockfile_name

def parent_specs
version = Gem::Version.new(target_version)
Expand Down
3 changes: 2 additions & 1 deletion bundler/helpers/v1/lib/functions/dependency_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

module Functions
class DependencySource
attr_reader :gemfile_name, :dependency_name
attr_reader :gemfile_name
attr_reader :dependency_name

RUBYGEMS = "rubygems"
PRIVATE_REGISTRY = "private"
Expand Down
9 changes: 6 additions & 3 deletions bundler/helpers/v1/lib/functions/force_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ def run

private

attr_reader :dependency_name, :target_version, :gemfile_name,
:lockfile_name, :credentials,
:update_multiple_dependencies
attr_reader :dependency_name
attr_reader :target_version
attr_reader :gemfile_name
attr_reader :lockfile_name
attr_reader :credentials
attr_reader :update_multiple_dependencies
alias update_multiple_dependencies? update_multiple_dependencies

def new_dependencies_to_unlock_from(error:, already_unlocked:)
Expand Down
4 changes: 3 additions & 1 deletion bundler/helpers/v1/lib/functions/lockfile_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def run

private

attr_reader :gemfile_name, :lockfile_name, :dependencies
attr_reader :gemfile_name
attr_reader :lockfile_name
attr_reader :dependencies

def generate_lockfile # rubocop:disable Metrics/PerceivedComplexity
dependencies_to_unlock = dependencies.map { |d| d.fetch("name") }
Expand Down
6 changes: 4 additions & 2 deletions bundler/helpers/v1/lib/functions/version_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ module Functions
class VersionResolver
GEM_NOT_FOUND_ERROR_REGEX = /locked to (?<name>[^\s]+) \(/

attr_reader :dependency_name, :dependency_requirements,
:gemfile_name, :lockfile_name
attr_reader :dependency_name
attr_reader :dependency_requirements
attr_reader :gemfile_name
attr_reader :lockfile_name

def initialize(dependency_name:, dependency_requirements:,
gemfile_name:, lockfile_name:)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def conflicting_dependencies

private

attr_reader :dependency_name, :target_version, :lockfile_name
attr_reader :dependency_name
attr_reader :target_version
attr_reader :lockfile_name

def parent_specs
version = Gem::Version.new(target_version)
Expand Down
3 changes: 2 additions & 1 deletion bundler/helpers/v2/lib/functions/dependency_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

module Functions
class DependencySource
attr_reader :gemfile_name, :dependency_name
attr_reader :gemfile_name
attr_reader :dependency_name

RUBYGEMS = "rubygems"
PRIVATE_REGISTRY = "private"
Expand Down
9 changes: 6 additions & 3 deletions bundler/helpers/v2/lib/functions/force_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ def run

private

attr_reader :dependency_name, :target_version, :gemfile_name,
:lockfile_name, :credentials,
:update_multiple_dependencies
attr_reader :dependency_name
attr_reader :target_version
attr_reader :gemfile_name
attr_reader :lockfile_name
attr_reader :credentials
attr_reader :update_multiple_dependencies
alias update_multiple_dependencies? update_multiple_dependencies

def extra_top_level_deps(specs)
Expand Down
4 changes: 3 additions & 1 deletion bundler/helpers/v2/lib/functions/lockfile_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def run

private

attr_reader :gemfile_name, :lockfile_name, :dependencies
attr_reader :gemfile_name
attr_reader :lockfile_name
attr_reader :dependencies

def generate_lockfile # rubocop:disable Metrics/PerceivedComplexity
dependencies_to_unlock = dependencies.map { |d| d.fetch("name") }
Expand Down
6 changes: 4 additions & 2 deletions bundler/helpers/v2/lib/functions/version_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ module Functions
class VersionResolver
GEM_NOT_FOUND_ERROR_REGEX = /locked to (?<name>[^\s]+) \(/

attr_reader :dependency_name, :dependency_requirements,
:gemfile_name, :lockfile_name
attr_reader :dependency_name
attr_reader :dependency_requirements
attr_reader :gemfile_name
attr_reader :lockfile_name

def initialize(dependency_name:, dependency_requirements:,
gemfile_name:, lockfile_name:)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def updated_gemfile_content

private

attr_reader :dependencies, :gemfile
attr_reader :dependencies
attr_reader :gemfile

def replace_gemfile_version_requirement(dependency, file, content)
return content unless requirement_changed?(file, dependency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def updated_gemspec_content

private

attr_reader :dependencies, :gemspec
attr_reader :dependencies
attr_reader :gemspec

def replace_gemspec_version_requirement(gemspec, dependency, content)
return content unless requirement_changed?(gemspec, dependency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ module Dependabot
module Bundler
class FileUpdater
class GitPinReplacer
attr_reader :dependency, :new_pin
attr_reader :dependency
attr_reader :new_pin

def initialize(dependency:, new_pin:)
@dependency = dependency
Expand All @@ -27,7 +28,8 @@ def rewrite(content)

class Rewriter < Parser::TreeRewriter
PIN_KEYS = %i(ref tag).freeze
attr_reader :dependency, :new_pin
attr_reader :dependency
attr_reader :new_pin

def initialize(dependency:, new_pin:)
@dependency = dependency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ def updated_lockfile_content

private

attr_reader :dependencies, :dependency_files, :repo_contents_path,
:credentials, :options
attr_reader :dependencies
attr_reader :dependency_files
attr_reader :repo_contents_path
attr_reader :credentials
attr_reader :options

def build_updated_lockfile
base_dir = dependency_files.first.directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ module Dependabot
module Bundler
class FileUpdater
class RequirementReplacer
attr_reader :dependency, :file_type, :updated_requirement,
:previous_requirement
attr_reader :dependency
attr_reader :file_type
attr_reader :updated_requirement
attr_reader :previous_requirement

def initialize(dependency:, file_type:, updated_requirement:,
previous_requirement: nil, insert_if_bare: false)
Expand Down Expand Up @@ -115,7 +117,9 @@ def on_send(node)

private

attr_reader :dependency, :file_type, :updated_requirement
attr_reader :dependency
attr_reader :file_type
attr_reader :updated_requirement

def insert_if_bare?
@insert_if_bare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ def prepared_dependency_files

private

attr_reader :dependency_files, :dependency, :replacement_git_pin,
:latest_allowable_version
attr_reader :dependency_files
attr_reader :dependency
attr_reader :replacement_git_pin
attr_reader :latest_allowable_version

def remove_git_source?
@remove_git_source
Expand Down
10 changes: 7 additions & 3 deletions bundler/lib/dependabot/bundler/update_checker/force_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ def updated_dependencies

private

attr_reader :dependency, :dependency_files, :repo_contents_path,
:credentials, :target_version, :requirements_update_strategy,
:options
attr_reader :dependency
attr_reader :dependency_files
attr_reader :repo_contents_path
attr_reader :credentials
attr_reader :target_version
attr_reader :requirements_update_strategy
attr_reader :options

def update_multiple_dependencies?
@update_multiple_dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ def lowest_security_fix_version

private

attr_reader :dependency, :dependency_files, :repo_contents_path,
:credentials, :ignored_versions, :security_advisories,
:options
attr_reader :dependency
attr_reader :dependency_files
attr_reader :repo_contents_path
attr_reader :credentials
attr_reader :ignored_versions
attr_reader :security_advisories
attr_reader :options

def fetch_latest_version_details
return dependency_source.latest_git_version_details if dependency_source.git?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ class DependencySource
GIT = "git"
OTHER = "other"

attr_reader :dependency, :dependency_files, :repo_contents_path,
:credentials, :options
attr_reader :dependency
attr_reader :dependency_files
attr_reader :repo_contents_path
attr_reader :credentials
attr_reader :options

def initialize(dependency:,
dependency_files:,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ def updated_requirements

private

attr_reader :requirements, :updated_source,
:latest_version, :latest_resolvable_version,
:update_strategy
attr_reader :requirements
attr_reader :updated_source
attr_reader :latest_version
attr_reader :latest_resolvable_version
attr_reader :update_strategy

def check_update_strategy
return if ALLOWED_UPDATE_STRATEGIES.include?(update_strategy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ module BundlerErrorPatterns
Bundler::Fetcher::FallbackError
).freeze

attr_reader :dependency_files, :repo_contents_path, :credentials
attr_reader :dependency_files
attr_reader :repo_contents_path
attr_reader :credentials

#########################
# Bundler context setup #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ def latest_allowable_version_incompatible_with_ruby?

private

attr_reader :dependency, :unprepared_dependency_files,
:repo_contents_path, :credentials, :ignored_versions,
:replacement_git_pin, :latest_allowable_version,
:options
attr_reader :dependency
attr_reader :unprepared_dependency_files
attr_reader :repo_contents_path
attr_reader :credentials
attr_reader :ignored_versions
attr_reader :replacement_git_pin
attr_reader :latest_allowable_version
attr_reader :options

def remove_git_source?
@remove_git_source
Expand Down
4 changes: 3 additions & 1 deletion cargo/lib/dependabot/cargo/file_updater/lockfile_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def updated_lockfile_content

private

attr_reader :dependencies, :dependency_files, :credentials
attr_reader :dependencies
attr_reader :dependency_files
attr_reader :credentials

# Currently, there will only be a single updated dependency
def dependency
Expand Down
3 changes: 2 additions & 1 deletion cargo/lib/dependabot/cargo/file_updater/manifest_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def updated_manifest_content

private

attr_reader :dependencies, :manifest
attr_reader :dependencies
attr_reader :manifest

def requirement_changed?(file, dependency)
changed_requirements =
Expand Down
6 changes: 4 additions & 2 deletions cargo/lib/dependabot/cargo/update_checker/file_preparer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ def prepared_dependency_files

private

attr_reader :dependency_files, :dependency, :replacement_git_pin,
:latest_allowable_version
attr_reader :dependency_files
attr_reader :dependency
attr_reader :replacement_git_pin
attr_reader :latest_allowable_version

def unlock_requirement?
@unlock_requirement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ def lowest_security_fix_version

private

attr_reader :dependency, :dependency_files, :credentials,
:ignored_versions, :security_advisories
attr_reader :dependency
attr_reader :dependency_files
attr_reader :credentials
attr_reader :ignored_versions
attr_reader :security_advisories

def fetch_latest_version
versions = available_versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ def updated_requirements

private

attr_reader :requirements, :updated_source, :update_strategy,
:target_version
attr_reader :requirements
attr_reader :updated_source
attr_reader :update_strategy
attr_reader :target_version

def check_update_strategy
return if ALLOWED_UPDATE_STRATEGIES.include?(update_strategy)
Expand Down
6 changes: 4 additions & 2 deletions cargo/lib/dependabot/cargo/update_checker/version_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def latest_resolvable_version

private

attr_reader :dependency, :credentials,
:prepared_dependency_files, :original_dependency_files
attr_reader :dependency
attr_reader :credentials
attr_reader :prepared_dependency_files
attr_reader :original_dependency_files

def fetch_latest_resolvable_version
base_directory = prepared_dependency_files.first.directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def dependency_file

private

attr_reader :path, :lockfile, :directory
attr_reader :path
attr_reader :lockfile
attr_reader :directory

def details_from_lockfile
keys = FileParser::DEPENDENCY_GROUP_KEYS
Expand Down
Loading

0 comments on commit 4a83645

Please sign in to comment.