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

Lint ERB files via HoundCI #2982

Merged
merged 1 commit into from
Dec 14, 2018
Merged

Lint ERB files via HoundCI #2982

merged 1 commit into from
Dec 14, 2018

Conversation

kennyadsl
Copy link
Member

@kennyadsl kennyadsl commented Dec 1, 2018

Now that Hound supports ERB linting I think it's a good idea to start using that linter in Solidus.

Linting is done with this tool: https://github.com/Shopify/erb-lint

Since we are already linting Ruby code with Rubocop I configured hound to use the same rules that we have for the rest of the application. See #2982 (comment)

What do you think?

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

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

I'm always for this kind of thing!

@kennyadsl
Copy link
Member Author

I'm not sure if we also want to lint all the current files. It's a lot of work and we could ask some help to the erblint --autocorrect command, even if it would need an accurate check of the result.

But honestly I'm more worried about breaking the commits history making git blame on specific lines more complex, do you think it's worth it?

.hound.yml Outdated Show resolved Hide resolved
@jacobherrington
Copy link
Contributor

jacobherrington commented Dec 3, 2018

I personally think it's worth some short-term pain to increase the friendliness and quality of our ERB templates. Of course, it seems that you're the one doing most of the work, so it's up to you. 😉

I don't mind adding to the Git history, but other people might feel differently.

@aldesantis
Copy link
Member

@kennyadsl I'm all for opportunistic refactoring, so I wouldn't fix current files all in one go as it's a lot of work. Instead, let's fix issues as they arise, what do you think?

@kennyadsl
Copy link
Member Author

Yes, probably that's the best option, considering also that our admin UI could need a look and feed refresh sooner or later and we'd touch those files anyway.

@kennyadsl kennyadsl removed the WIP label Dec 5, 2018
@aitbw
Copy link
Contributor

aitbw commented Dec 5, 2018

My two cents: I think the best approach when fixing linting issues is to tackle one folder per PR. For example: under backend/app/views/spree/admin we have products and orders —suppose all templates on these folders have issues. I would fix products issues on one PR and orders in another one. It's far easier to review changes with this approach, and it's mostly conflict-free.

@kennyadsl
Copy link
Member Author

Ok, considering the feedback received (if linting on existing files needs to happen we need one or more separate PRs) I think this PR is ready to accept reviews :)

@kennyadsl kennyadsl added the WIP label Dec 13, 2018
@kennyadsl kennyadsl force-pushed the erb-lint branch 2 times, most recently from a07bcfc to f3a2003 Compare December 14, 2018 16:52
@@ -1,3 +1,10 @@
<% some_data = '[1,2,3,]' %>
<%some_data%>

Choose a reason for hiding this comment

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

Use 1 space after <% instead of 0 space.
Use 1 space before %> instead of 0 space.

@kennyadsl
Copy link
Member Author

I've removed the link to the .rubocop.yml config from the .erblint.yml file since it's still not supported by HoundCI. I've also removed the .erblint.yml file at all since that was the only configuration present. This is now ready to be merged in my opinion.

@kennyadsl kennyadsl removed the WIP label Dec 14, 2018
@jacobherrington
Copy link
Contributor

I'm still completely in support of this getting merged.

@kennyadsl kennyadsl merged commit 1abaece into solidusio:master Dec 14, 2018
@kennyadsl kennyadsl deleted the erb-lint branch December 14, 2018 21:10
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.

7 participants