-
Notifications
You must be signed in to change notification settings - Fork 21
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
rubocop update #83
Merged
Merged
rubocop update #83
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7348219
rubocop update
jreidinger 13bc9f6
simplify code
jreidinger b268f06
disable zero predicate check
jreidinger 2ec32dc
more size empty reverts
jreidinger 875f437
remove unmatching enable
jreidinger 4a26963
Disable the Style/MutableConstant Rubocop check
lslezak 0aa5cac
Revert the Rubocop Style/MutableConstant change
lslezak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,13 +34,10 @@ class DevicesList | |
|
||
class << self | ||
attr_reader :device_class | ||
|
||
# rubocop:disable TrivialAccessors | ||
# Macro-style method to specify the class of the elements | ||
def list_of(klass) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again, remove also the |
||
@device_class = klass | ||
end | ||
# rubocop:enable TrivialAccessors | ||
end | ||
|
||
def_delegators :@list, :each, :empty?, :length, :size | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,12 +46,12 @@ class DiskSize | |
# Accept Numbers, Strings, or DiskSize objects as initializers. | ||
# | ||
def initialize(size = 0) | ||
if size.is_a?(Yast::Storage::DiskSize) | ||
@size = size.to_i | ||
@size = if size.is_a?(Yast::Storage::DiskSize) | ||
size.to_i | ||
elsif size.is_a?(::String) | ||
@size = Yast::Storage::DiskSize.parse(size).size | ||
Yast::Storage::DiskSize.parse(size).size | ||
else | ||
@size = size.round | ||
size.round | ||
end | ||
end | ||
|
||
|
@@ -145,9 +145,7 @@ def parse(str) | |
# "MiB", ...). The base of this exponent is 1024. The base unit is KiB. | ||
# | ||
def unit_exponent(unit) | ||
# rubocop:disable Style/AndOr | ||
UNITS.index(unit) or raise ArgumentError, "expected one of #{UNITS}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more time, deleting |
||
# rubocop:enable Style/AndOr | ||
end | ||
|
||
# Return the unit multiplier for any of the known binary units ("KiB", | ||
|
@@ -185,21 +183,21 @@ def -(other) | |
end | ||
|
||
def *(other) | ||
if other.is_a?(Numeric) | ||
return DiskSize.unlimited if unlimited? | ||
DiskSize.new(@size * other) | ||
else | ||
if !other.is_a?(Numeric) | ||
raise TypeError, "Unexpected #{other.class}; expected Numeric value" | ||
end | ||
|
||
return DiskSize.unlimited if unlimited? | ||
DiskSize.new(@size * other) | ||
end | ||
|
||
def /(other) | ||
if other.is_a?(Numeric) | ||
return DiskSize.unlimited if unlimited? | ||
DiskSize.new(@size.to_f / other) | ||
else | ||
if !other.is_a?(Numeric) | ||
raise TypeError, "Unexpected #{other.class}; expected Numeric value" | ||
end | ||
|
||
return DiskSize.unlimited if unlimited? | ||
DiskSize.new(@size.to_f / other) | ||
end | ||
|
||
# | ||
|
@@ -237,7 +235,7 @@ def to_human_readable | |
size2 /= 1024.0 | ||
unit_index += 1 | ||
end | ||
[size2 / 2.0, UNITS[unit_index]] # FIXME: Make unit translatable | ||
[size2 / 2.0, UNITS[unit_index]] # FIXME: Make unit translatable | ||
end | ||
|
||
# Return numeric size and unit ("MiB", "GiB", ...) in human-readable form | ||
|
@@ -280,7 +278,7 @@ def inspect | |
end | ||
|
||
def pretty_print(*) | ||
print "#{inspect}" | ||
print inspect | ||
end | ||
|
||
private | ||
|
@@ -298,7 +296,7 @@ def any_operand_unlimited?(other) | |
# | ||
#---------------------------------------------------------------------- | ||
# | ||
if $PROGRAM_NAME == __FILE__ # Called direcly as standalone command? (not via rspec or require) | ||
if $PROGRAM_NAME == __FILE__ # Called direcly as standalone command? (not via rspec or require) | ||
size = Yast::Storage::DiskSize.new(0) | ||
print "0 B: #{size} (#{size.size})\n" | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, remove also this four lines below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is actually auto correction from rubocop, probably only one half is implemented