-
Notifications
You must be signed in to change notification settings - Fork 919
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 rubocop redundant freeze warnings #5468
Fix rubocop redundant freeze warnings #5468
Conversation
53bb76d
to
3970bc8
Compare
@@ -6,12 +6,12 @@ | |||
module Composer | |||
module Helpers | |||
# From composers json-schema: https://getcomposer.org/schema.json | |||
COMPOSER_V2_NAME_REGEX = %r{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$}.freeze | |||
COMPOSER_V2_NAME_REGEX = %r{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$} |
Check failure
Code scanning / CodeQL
Inefficient regular expression
@@ -6,12 +6,12 @@ | |||
module Composer | |||
module Helpers | |||
# From composers json-schema: https://getcomposer.org/schema.json | |||
COMPOSER_V2_NAME_REGEX = %r{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$}.freeze | |||
COMPOSER_V2_NAME_REGEX = %r{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$} |
Check failure
Code scanning / CodeQL
Inefficient regular expression
7a97e8f
to
655de48
Compare
96eccbf
to
a534e2a
Compare
I had to do a painful rebase on this one, and easily could have made a mistake. So once #5447 is merged and this is rebased on top of that, do a careful inspection of the changes to ensure I didn't screw it up. |
COMPARISON = /===|==|>=|<=|<|>|~=|!=/ | ||
VERSION = /([1-9][0-9]*!)?[0-9]+[a-zA-Z0-9\-_.*]*(\+[0-9a-zA-Z]+(\.[0-9a-zA-Z]+)*)?/ | ||
|
||
REQUIREMENT = /(?<comparison>#{COMPARISON})\s*\\?\s*(?<version>#{VERSION})/ |
Check warning
Code scanning / CodeQL
Overly permissive regular expression range
a534e2a
to
50bd13a
Compare
@@ -188,6 +185,7 @@ def handle_cargo_errors(error) | |||
end | |||
|
|||
if error.message.include?("authenticate when downloading repo") || | |||
# TODO stop catching this 200 error: https://github.com/dependabot/dependabot-core/pull/5332#discussion_r936888624 |
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.
Discovered this while looking at a related git blame... This could be pulled into a separate PR, but since just this small comment I thought okay to shoehorn into this PR.
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.
How about we create a new draft PR that makes the change suggested by the TODO, and then we can pull that in when we're ready for it?
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.
good idea, I'll open a draft PR shortly... I'd also like to leave in the code comment so that we don't lose track of it...
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.
46efc29
to
a77350a
Compare
9a0f9ee
to
feaacf9
Compare
@@ -188,6 +185,7 @@ def handle_cargo_errors(error) | |||
end | |||
|
|||
if error.message.include?("authenticate when downloading repo") || | |||
# TODO: stop catching this 200 error: https://github.com/dependabot/dependabot-core/pull/5332#discussion_r936888624 |
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.
Was this included by accident?
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.
feaacf9
to
c7af02c
Compare
Merging once passes CI as this lint rule is super safe fix |
ca558b9
to
c6691c7
Compare
Rubocop is warning about things that are double frozen, ie `.freeze` is redundant. These warnings started showing up as part of the Ruby 3.1 upgrade, and were excluded from that PR in order to minimize noise. So this fixes them. Co-authored-by: Mattt <mattt@github.com>
c6691c7
to
fd64bac
Compare
Fix Rubocop freeze warnings.
Rubocop is warning about things that are double frozen, ie
.freeze
is redundant.These warnings started showing up as part of the Ruby 3.1 upgrade, and
were excluded from that PR in order to minimize noise.