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

Enforce tab indentation in templates #15289

Merged
merged 5 commits into from
Apr 11, 2021
Merged

Conversation

silverwind
Copy link
Member

This adds editorconfig-checker [1] to lint the template files so they conform the editorconfig files. I fixed all current identation issues using the fix mode of eclint [2] and some manual corrections.

We can extend this linting to other files later, for now I'd like this PR to focus on HTML template files only.

[1] https://github.com/editorconfig-checker/editorconfig-checker
[2] https://github.com/jedmao/eclint

@silverwind silverwind added type/refactoring Existing code has been cleaned up. There should be no new functionality. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. labels Apr 5, 2021
@silverwind silverwind added this to the 1.15.0 milestone Apr 5, 2021
@silverwind
Copy link
Member Author

Note, the checker module is actually https://github.com/editorconfig-checker/editorconfig-checker.javascript which is a JS wrapper around the golang tool, for ease of installation using npm.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 5, 2021
This adds editorconfig-checker [1] to lint the template files so they
conform the editorconfig files. I fixed all current identation issues
using the fix mode of eclint [2] and some manual corrections.

We can extend this linting to other files later, for now I'd like this
PR to focus on HTML template files only.

[1] https://github.com/editorconfig-checker/editorconfig-checker
[2] https://github.com/jedmao/eclint
@silverwind
Copy link
Member Author

silverwind commented Apr 10, 2021

Rebased

Diff is best viewed with whitespace disabled: https://github.com/go-gitea/gitea/pull/15289/files?diff=unified&w=1

Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

I'd like to have this for sooo long :D - thanks

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 10, 2021
@6543
Copy link
Member

6543 commented Apr 10, 2021

@silverwind one thing missing:

templates/repo/issue/milestones.tmpl:
        17: Wrong indentation type(spaces instead of tabs)

@silverwind
Copy link
Member Author

And it swiftly caught a rebase error of mine, fixed.

https://drone.gitea.io/go-gitea/gitea/38396/1/3

@6543
Copy link
Member

6543 commented Apr 10, 2021

this hopefully let us prevent issues like: #14719, ...

@silverwind
Copy link
Member Author

It does only lint the intendation, imbalanced tags are still possible and I'm looking for a linter that can detect these. Maybe https://github.com/ember-template-lint/ember-template-lint.

@6543
Copy link
Member

6543 commented Apr 10, 2021

@silverwind what command did you use for auto-fix the templates, I'll need this to resolve conflicts in other pulls :)

@silverwind
Copy link
Member Author

silverwind commented Apr 10, 2021

npm i -g eclint
eclint fix <file>

Be aware it does not fix all cases. Also see https://github.com/jedmao/eclint#cli

@silverwind silverwind changed the title Enforce tab indendation in templates Enforce tab indentation in templates Apr 10, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 10, 2021
@techknowlogick techknowlogick merged commit d848098 into go-gitea:master Apr 11, 2021
@silverwind silverwind deleted the ec branch April 12, 2021 11:34
@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants