Skip to content
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

[BUG] erb-lint errors #1215

Open
luisgfmarques opened this issue Jul 12, 2022 · 5 comments
Open

[BUG] erb-lint errors #1215

luisgfmarques opened this issue Jul 12, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@luisgfmarques
Copy link
Contributor

luisgfmarques commented Jul 12, 2022

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:

Captura_de_tela_de_2022-07-12_16-11-34
unknown

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
unknown
unknown

Steps to Reproduce

  1. 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
@luisgfmarques luisgfmarques added the bug Something isn't working label Jul 12, 2022
@wwahammy
Copy link
Member

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?

@wwahammy wwahammy changed the title [BUG] erb-lint erros. [BUG] erb-lint errors Jul 12, 2022
@luisgfmarques
Copy link
Contributor Author

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 :)

@wwahammy
Copy link
Member

@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.

@victorhugo21
Copy link
Contributor

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
image

path: app/views/profiles/_profile_tabs.html.erbimage

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:
image

After:
image
image
image

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.
image

@wwahammy
Copy link
Member

wwahammy commented Aug 3, 2022

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants