Open Nerian opened 1 year ago
Thanks for the report 👍 Since slimi is just a Slim parser and has nothing to do with RuboCop, I transferred this issue from slimi to rubocop-slim.
Perhaps this is not a problem with the implementation of individual plugins such as rubocop-slim or rubocop-erb, but with rubocop, so I think it should actually be recognized as a rubocop's template API issue.
In rubocop, there is a mechanism to repeat autocorrection for a single file until there are no more offenses. On the other hand, rubocop's template API has a mechanism to treat multiple Ruby codes embedded in one template file as multiple virtual files. I assume that these mechanisms do not work well together, resulting in this problem...
After investigating for a while, I found out that RuboCop generates multiple ProcessedSource from one template, autocorrects them independently, and writes the conversion result to the original template file multiple times. Individual conversions do not take other conversions into account. So, in the end, it appears that only the result of the autocorrect for the last ProcessedSlource processed is written to the original template file.
Hi,
I detected the following issue:
Given a template with:
When I run
rubocop -A
I getAnd the file is auto corrected like this:
So auto correction works only partially when there are multiple issues in a given template.