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

Add erblint #1646

Merged
merged 7 commits into from
May 13, 2020
Merged

Add erblint #1646

merged 7 commits into from
May 13, 2020

Conversation

murny
Copy link
Contributor

@murny murny commented May 12, 2020

#989 Brings in ERBLint for Jupiter

Majority of the fixes are white space diffs (will document when that is not the case)

I also added this to CI, but seems to be breaking (looks like its linting our Gems which we should be ignoring 🤔 )

@ualbertalib-bot
Copy link

ualbertalib-bot commented May 12, 2020

2 Warnings
⚠️ There are code changes, but no corresponding tests. Please include tests if this PR introduces any modifications in behavior.
⚠️ This PR is too big! Consider breaking it down into smaller PRs.

Generated by 🚫 Danger

.erb-lint.yml Outdated
exclude:
- '**/*.en.html.erb'

# ErbSafety:
Copy link
Contributor Author

@murny murny May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically runs https://github.com/Shopify/better-html. So it be nice to have this. Currently with default config its complaining about our usages of raw or .html_safe in a few places (like kaminari pagination views). So might provide our own config to disable these offenses so we continue to have this turned on.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a code comment here and left this turned off. We will leave this as disabled for time being. I tried to add an .better-html.yml config, but doesn't seem to be as fleshed out as erblint or rubocop configs. Doesn't seem like you can exclude cops, only change their values. Very little documentation about this as well. Better-html brings in only ~5 cops and we will probably turn off 2 of them, so not seeing if this is worth the hassle. Will leave it off. Maybe in future better documentation will be there (this is probably the reason why this is disabled as a default as well).

@@ -60,6 +60,9 @@ jobs:
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
run: bundle exec danger

- name: Run ERBLint
Copy link
Contributor Author

@murny murny May 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to look into this. Currently failing with lint failures that I don't see on local. Looks like its validating down into our Gems which is causing a bunch of false positives. Will fix this

@@ -2,7 +2,9 @@
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= Rails.application.secrets.google_analytics_token %>"></script>
<%# TODO: javascript_tag, nonce: true do %>
<%= javascript_tag do %>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They really don't like javascript_tag. I really couldn't find out why either? From looking into their source It seems like they are not able to valid ERB inside them so they prefer you don't have them in your project. They autocorrect it to just replace it with what it would of rendered anyways (a <script> tag)

rubocop_config:
inherit_from:
- .rubocop.yml
Layout/InitialIndentation:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using their recommendation of turning off these cops. We could maybe look into this more

mbarnett
mbarnett previously approved these changes May 12, 2020
Copy link
Contributor

@mbarnett mbarnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting

@@ -195,6 +195,8 @@ en:
results:
no_items_found: 'No items found'
skip_to_results: 'Skip to Search Results'
range_facet_result:
to: 'to'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, it even caught some hard-coded English we missed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah there was 5 places we hardcoded stuff. Which is pretty good with how many views we got!

Copy link
Contributor

@mbarnett mbarnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved!

@murny murny merged commit 6f2750d into integration_postmigration May 13, 2020
@murny murny deleted the add-erblint branch May 13, 2020 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants