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
Test multi-offenses for Layout/DotPosition cop #8794
Conversation
I've gotten confused from |
@@ -1693,4 +1693,41 @@ def self.some_method(foo, bar: 1) | |||
expect(status).to eq(0) | |||
expect(source_file.read).to eq(source) | |||
end | |||
|
|||
it 'corrects multiple Layout/DotPosition offenses' do |
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.
You can use expect_correction
in your new test on the cop's spec rather than having it be tested through the CLI spec.
Maybe @jonas054 could share some information about the expected use of the |
Hi there, is there anything I can do to get this moving forward ? Auto-correction working only one line at a time |
Sorry about the delay! I've been pretty busy with other things.
Yeah, exactly.
If people make mistakes I guess there should be. |
Thanks for merging and cutting the release
Happy to improve this (quick) fix when there is some guidelines |
@tdeo @dvandersluis I understand that you're confused about the use of There are two places in the code base where the method is used in conditions. This way of calling it is wrong, and it just happens to work in those two places because Looking at
|
@jonas054 I think there were a bunch of PRs that removed it from some cops a month or two ago because there were problems where multiple offenses wouldn't be detected after |
Hi,
I'd like to show an issue I've been having with multi-offenses autocorrect for the
Layout/DotPosition
cop, I have a potential fix coming in a second commit.In some cases, when having multiple offenses for this cop, it only autocorrects the first it finds and exits, which is very painful when relying on auto-correct to change from one style to another.
I'm not familiar with the
ConfigurableEnforcedStyle
, but my guess is that it is used for guessing the best style to use when auto-generating a config file.I've found accross the code multiple use of both the pattern
return unless opposite_style_detected
and simple calls toopposite_style_detected
:Is there a practice that should be enforced for using
opposite_style_detected
?Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.