1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

rubocop: fix offences of the Style/NumericLiteralPrefix cop

This commit is contained in:
Kyrylo Silin 2019-03-02 12:07:44 +02:00
parent 823bfb3bcc
commit 15fc7aec9a
4 changed files with 5 additions and 15 deletions

View file

@ -305,16 +305,6 @@ Style/MultipleComparison:
Exclude:
- 'lib/pry/indent.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedOctalStyle.
# SupportedOctalStyles: zero_with_o, zero_only
Style/NumericLiteralPrefix:
Exclude:
- 'lib/pry/history.rb'
- 'spec/history_spec.rb'
- 'spec/pryrc_spec.rb'
# Offense count: 24
# Cop supports --auto-correct.
Style/ParallelAssignment:

View file

@ -111,7 +111,7 @@ class Pry
@history_file
else
FileUtils.mkdir_p(File.dirname(history_file_path)) unless File.exist?(history_file_path)
@history_file = File.open(history_file_path, 'a', 0600).tap do |file|
@history_file = File.open(history_file_path, 'a', 0o600).tap do |file|
file.sync = true
end
end

View file

@ -147,7 +147,7 @@ describe Pry do
error = Class.new(RuntimeError)
expect(File).to receive(:open)
.with(File.join(ENV['HOME'].to_s, "/test_history"), 'a', 0600)
.with(File.join(ENV['HOME'].to_s, "/test_history"), 'a', 0o600)
.and_raise(error)
expect { history.push 'a line' }.to raise_error error
@ -167,7 +167,7 @@ describe Pry do
it "handles #{error_class} failure to write history" do
Pry.config.history.should_save = true
expect(File).to receive(:open).with(file_path, "a", 0600).and_raise(error_class)
expect(File).to receive(:open).with(file_path, "a", 0o600).and_raise(error_class)
expect(history).to receive(:warn).with(/Unable to write history file:/)
expect { history.push("anything") }.to_not raise_error
end

View file

@ -36,11 +36,11 @@ describe Pry do
it "should not load the pryrc if pryrc's directory permissions do not allow this" do
Dir.mktmpdir do |dir|
File.chmod 0000, dir
File.chmod 0o000, dir
Pry::LOCAL_RC_FILE.replace File.join(dir, '.pryrc')
Pry.config.should_load_rc = true
expect { Pry.start(self, input: StringIO.new("exit-all\n"), output: StringIO.new) }.to_not raise_error
File.chmod 0777, dir
File.chmod 0o777, dir
end
end