[BUG] erb-lint errors
luisgfmarques opened this issue · 5 comments
After add the erb-lint in project , like discussed in issue #510 and merged with PR number #1204, had be create new 17610 erros in files of project.
Description
when we run the command bundle exec erblint --lint-all --enable-all-linters
to verify the erros of erb-lint ,the console return is:
pointing out that we have 17610 errors.
Expected Behavior
No error Found in ERB files
Actual Behavior
17610 erro(s) were found in ERB files
Possible Fix
execute the command:
bundle exec erblint --lint-all --enable-all-linters --autocorrect
this autocorrect of erb-lint fix 7663 erros, but the major part of erros maybe need fix manually
Steps to Reproduce
- run the code
bundle exec erblint --lint-all --enable-all-linters
Context
this bug reduce the quality of codes where the erb-lint had identify the errors
Your Environment
- Ruby version: 2.7.6
- Operating System and version: Ubuntu 20.04LTS
Thanks @luisgfmarques. Since there are SO many errors, maybe it'd make sense to look at a few sample files. I'd recommend you find a few files with a handful of different errors. Once you do that, paste in the output by testing just those files and show what they look like after the autocorrect. After you do that, let me know what you think worked, what didn't work and how it can be improved.
What do you think?
hi @wwahammy , sorry for the delay in response, well I had to do some tests and the major errors are String not translated in emails Mensagem, running autocorrect in sudo user and without tag --enable-all-linters , the number of errors reduce to 4199 ( in my machine ), and the major errors are Indent with spaces instead of tabs with the autocorrect not had the fix. logically we had reduced the number of linters tests but I think is a better start if we select manually the linters we want to use in the erb-lint file and apply the autocorrect in files where they run. After that we make manually the fix they don't do manually, with one good first issue for the community.
When, I had the test in my friend's machine the numbers had different the numbers of errors and autocorrect fix I had done, if you can run tests in your machine so we can make the comparison of numbers, maybe you will have more lucky of me and fix all lints with autocorrect :)
@luisgfmarques Sorry about not getting back to you until now.
So, first off, you should never need to run this as sudo. If you're doing that, something else is wrong.
Additionally, I think you should run a few specific files through erb-lint to get a sense of what the errors actually are. You can do that by running `bundle exec erblint --enable-all-linters path/to/erb-file.erb path/to/erb-file2.erb ..." Pick a few of the simpler erb files and then see what the results are and then please report back with that info.
Also, consider using the autocorrect and see if you get helpful results. Do they make sense? Feel free to report that back too.
Hi @wwahammy, thanks for the feedback. So, running some erb files like you said, we got results like:
path: app/views/profiles/fundraisers.html.erb
path: app/views/profiles/_profile_tabs.html.erb
Analyzing these results together with some more erb files, we can conclude that most of the errors presented are related to indentation with spaces instead of tabs.
Using the autocorrect in the path app/views/profiles/fundraisers.html.erb, we got the following results:
File before using the autocorrect:
We note that the errors that persisted are all from strings not translated. But running bin/rails server
after using autocorrect, we realize that the application breaks. Then, we want to know how to proceed.
@victorhugo21 nice work, this is good.
I think if you look at the "corrected" results you'll realize what the problem is. Remember, the goal is to use this to be more reliable and consistent. Do you think the code is both of those things after your run erb-lint and autocorrects? If not, why? And most importantly, what needs to change to do that?