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

Fix coding style #242

Merged
merged 1 commit into from
Sep 23, 2024
Merged

Conversation

n-rodriguez
Copy link
Contributor

Thank you!


expect(content_of 'gemfiles/ruby_version.gemfile').to eq <<-Gemfile.strip_heredoc
expect(content_of("gemfiles/ruby_version.gemfile")).to eq <<-GEMFILE.strip_heredoc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [86/80]


expect(content_of 'gemfiles/breakfast.gemfile').to eq <<-Gemfile.strip_heredoc
expect(content_of("gemfiles/breakfast.gemfile")).to eq <<-GEMFILE.strip_heredoc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [83/80]

select { |gem| gem.include?(gem_name) }
installed_gem = Dir.glob("tmp/stage/#{path}/#{Gem.ruby_engine}/*/gems/*")
.map { |path| path.split("/").last }
.select { |gem| gem.include?(gem_name) }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/DotPosition: Place the . on the previous line, together with the method call receiver.
Layout/MultilineMethodCallIndentation: Use 2 (not 19) spaces for indenting an expression in an assignment spanning multiple lines.

map { |path| path.split('/').last }.
select { |gem| gem.include?(gem_name) }
installed_gem = Dir.glob("tmp/stage/#{path}/#{Gem.ruby_engine}/*/gems/*")
.map { |path| path.split("/").last }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/DotPosition: Place the . on the previous line, together with the method call receiver.
Layout/MultilineMethodCallIndentation: Use 2 (not 19) spaces for indenting an expression in an assignment spanning multiple lines.

warn 'Your current version of Bundler does not support parallel installation. Please ' +
'upgrade Bundler to version >= 1.4.0, or invoke `appraisal` without `--jobs` option.'
warn "Your current version of Bundler does not support parallel installation. Please " +
"upgrade Bundler to version >= 1.4.0, or invoke `appraisal` without `--jobs` option."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [97/80]

method_option "retry", type: :numeric, default: 1,
desc: "Retry network and git requests that have failed"
method_option "without", banner: "GROUP_NAMES",
desc: "A space-separated list of groups referencing gems to skip " +
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.

banner: "SIZE",
desc: "Install gems in parallel using the given number of workers."
method_option "retry", type: :numeric, default: 1,
desc: "Retry network and git requests that have failed"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.

desc "install", "Resolve and install dependencies for each appraisal"
method_option "jobs", aliases: "j", type: :numeric, default: 1,
banner: "SIZE",
desc: "Install gems in parallel using the given number of workers."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.

:desc => "A space-separated list of groups referencing gems to skip " +
desc "install", "Resolve and install dependencies for each appraisal"
method_option "jobs", aliases: "j", type: :numeric, default: 1,
banner: "SIZE",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignHash: Align the elements of a hash literal if they span more than one line.

@@ -25,7 +27,7 @@ def self.customize(heading, gemfile)
lockfile: "#{gemfile.send('gemfile_name')}.lock",
lockfile_path: gemfile.send("lockfile_path"),
relative_gemfile_path: gemfile.relative_gemfile_path,
relative_lockfile_path: "#{gemfile.relative_gemfile_path}.lock",
relative_lockfile_path: "#{gemfile.relative_gemfile_path}.lock"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/TrailingCommaInArguments: Put a comma after the last parameter of a multiline method call.

Eventually, we'll move to standard, but this is a nice improvement which
makes working with Appraisal much more pleasant.

This commit does the following:

* use double quotes everywhere
* use the new Ruby 1.9 hash syntax
* use uppercase heredoc delimiters
* add parentheses to nested method call
* add missing frozen string literal comment
* %w-literals should be delimited by [ and ]
* space inside } is missing
* fix indentation
* avoid comma after the last parameter of a method call
* remove unnecessary disabling of Layout/LineLength
* remove unnecessary spacing
* use hash literal {} instead of Hash.new
* place the . on the next line, together with the method name
* use 2 spaces for indentation in a heredoc by using <<~ instead of <<-
* make sure that the block will be associated with the PARTS.map method call
* use class << self instead of def self. to define class methods
* add missing space
@nickcharlton nickcharlton merged commit a075b0a into thoughtbot:main Sep 23, 2024
1 check was pending
TMP_GEM_ROOT = File.join(PROJECT_ROOT, "tmp", "bundler")
TMP_GEM_BUILD = File.join(PROJECT_ROOT, "tmp", "build")
ENV["APPRAISAL_UNDER_TEST"] = "1"

RSpec.configure do |config|
config.raise_errors_for_deprecations!

config.define_derived_metadata(:file_path => %r{spec\/acceptance\/}) do |metadata|
config.define_derived_metadata(file_path: %r{spec\/acceptance\/}) do |metadata|
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [81/80]

@@ -165,10 +167,10 @@ def run(command, raise_on_error = true)
end

if raise_on_error && exitstatus != 0
raise RuntimeError, <<-error_message.strip_heredoc
raise RuntimeError, <<-ERROR_MESSAGE.strip_heredoc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RedundantException: Redundant RuntimeError argument can be removed.

end

it "runs install command with path on Bundler" do
@appraisal.install("path" => "vendor/appraisal")

expect(Appraisal::Command).to have_received(:new).
with("#{bundle_check_command} || #{bundle_install_command_with_path}")
expect(Appraisal::Command).to have_received(:new).with("#{bundle_check_command} || #{bundle_install_command_with_path}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [126/80]

@appraisal.install("retry" => 3)

expect(Appraisal::Command).to have_received(:new).
with("#{bundle_check_command} || #{bundle_install_command_with_retries}")
expect(Appraisal::Command).to have_received(:new).with("#{bundle_check_command} || #{bundle_install_command_with_retries}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [129/80]


@appraisal.install("jobs" => 42)

expect(Appraisal::Command).to have_received(:new).
with("#{bundle_check_command} || #{bundle_parallel_install_command}")
expect(Appraisal::Command).to have_received(:new).with("#{bundle_check_command} || #{bundle_parallel_install_command}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [125/80]

"Lockfile: %{lockfile_path}", # rubocop:disable Style/FormatStringToken, Metrics/LineLength
appraisal,
"Lockfile: %{lockfile_path}", # rubocop:disable Style/FormatStringToken
appraisal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/TrailingCommaInArguments: Put a comma after the last parameter of a multiline method call.

)).to eq("Lockfile: #{lockfile}")
end

it "returns the heading with the lockfile path" do
expect(described_class.send(
:customize,
"Lockfile: %{lockfile_path}", # rubocop:disable Style/FormatStringToken, Metrics/LineLength
appraisal,
"Lockfile: %{lockfile_path}", # rubocop:disable Style/FormatStringToken
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [86/80]

"Lockfile: %{lockfile}", # rubocop:disable Style/FormatStringToken, Metrics/LineLength
appraisal,
"Lockfile: %{lockfile}", # rubocop:disable Style/FormatStringToken
appraisal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/TrailingCommaInArguments: Put a comma after the last parameter of a multiline method call.

)).to eq("Gemfile: #{gemfile_full_path}")
end

it "returns the heading with the lockfile name" do
expect(described_class.send(
:customize,
"Lockfile: %{lockfile}", # rubocop:disable Style/FormatStringToken, Metrics/LineLength
appraisal,
"Lockfile: %{lockfile}", # rubocop:disable Style/FormatStringToken
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [81/80]

"Gemfile: %{gemfile_path}", # rubocop:disable Style/FormatStringToken, Metrics/LineLength
appraisal,
"Gemfile: %{gemfile_path}", # rubocop:disable Style/FormatStringToken
appraisal
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/TrailingCommaInArguments: Put a comma after the last parameter of a multiline method call.

@n-rodriguez n-rodriguez deleted the fix/coding_style branch September 23, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants