-
Notifications
You must be signed in to change notification settings - Fork 72
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: Stage IV #171
RuboCop: Stage IV #171
Conversation
33b654b
to
9d62078
Compare
@@ -66,7 +65,7 @@ def add_custom_transformation(options) | |||
raise InlineSvg::Configuration::Invalid.new("#{options.fetch(:transform)} should implement the .create_with_value and #transform methods") | |||
end | |||
|
|||
@custom_transformations.merge!(Hash[*[options.fetch(:attribute, :no_attribute), options]]) | |||
@custom_transformations.merge!(options.fetch(:attribute, :no_attribute) => options) |
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.
Manual fix 1: looks safe to me
@@ -65,7 +64,7 @@ def self.without_empty_values(params) | |||
def self.all_default_values | |||
custom_transformations | |||
.values | |||
.select { |opt| opt[:default_value] != nil } | |||
.reject { |opt| opt[:default_value].nil? } |
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.
Manual fix 2: looks safe to me
end | ||
rescue NameError | ||
raise InlineSvg::Configuration::Invalid.new("asset_file should implement the #named method") | ||
end |
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.
suggestion: review with "hide whitespaces"
85766aa
to
609a448
Compare
@jamesmartin rebased and ready for review Most of the changes are related to non-production code There are two changes on production code with a manual fix, they have a comment and I'm quite positive they are safe |
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.
Looks good overall. Not 100% sold on swapping inject
for each_with_object
. Keen to understand what the motivation for that change is. 🤔
- `Layout/DotPosition` - `Lint/AmbiguousOperator` - `Lint/LiteralInInterpolation` - `RSpec/BeEmpty` - `RSpec/ContextMethod` - `RSpec/HookArgument` - `RSpec/MatchArray` - `RSpec/NotToNot` - `Style/ExpandPathArguments` - `Style/HashSyntax` - `Style/NestedParenthesizedCalls` - `Style/RedundantBegin` - `Style/RedundantConstantBase` - `Style/RedundantReturn` - `Style/RegexpLiteral` Some manual fixes: - `Lint/RedundantSplatExpansion` and subsequent unsafe manual fix of `Style/HashConversion` - `Style/NonNilCheck` and subsequent switch unsafe manual fix of `Style/InverseMethods`
609a448
to
40c7a16
Compare
Hi @jamesmartin, sorry for the bump I did the requested change, I think this can be merged, there are very few changes to production code. Then we can proceed by enabling frozen string literals, which should also save memory and improve performance (even if there are no benchmarks at the moment, I will try to do implement something: I would like to test inline_svg for a project I have in mind from a long time (streamline Font Awesome usage in Rails applications) |
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.
Thanks for incorporating the feedback, @tagliala. ✨
Requires #170
I've tried to only fix objective or almost-objective offenses, if you don't like some of the fixes let me know.
There are very few changes to production code
This PR fixes:
Layout/DotPosition
Lint/AmbiguousOperator
Lint/LiteralInInterpolation
RSpec/BeEmpty
RSpec/ContextMethod
RSpec/HookArgument
RSpec/MatchArray
RSpec/NotToNot
Style/EachWithObject
Style/ExpandPathArguments
Style/HashSyntax
Style/NestedParenthesizedCalls
Style/RedundantBegin
Style/RedundantConstantBase
Style/RedundantReturn
Style/RegexpLiteral
Some manual fixes:
Lint/RedundantSplatExpansion
and subsequent unsafemanual fix of
Style/HashConversion
Style/NonNilCheck
and subsequent switch fromselect !nil
toreject nil