Open Bug 1610346 Opened 6 years ago Updated 4 years ago

Disable lint checks or provide a command to auto-fix all of them

Categories

(Tree Management :: Treeherder, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: ekyle, Unassigned)

Details

My PRs include hours devoted to lint fixes. Let's provide a way to autofix all lint errors, and disable any lint fixes that can not be auto-fixed.

Passing operational tests should be the only requirement.

https://github.com/mozilla/treeherder/issues/5841

I envisioned using pre-commit for the linters since it takes so little time to execute.
Perhaps we can reduce it to "pre-push".

On another note, once we can start an IDE within a venv (thus, all packages being available within the IDE) we can use plugins to fix issues automatically.

This would be part of the GSoC I'm trying to arrange for this summer.

You can try installing hooks on your local development to give it a try:
http://flake8.pycqa.org/en/latest/user/using-hooks.html
https://github.com/timothycrosley/isort#git-hook

:armenzg I already run ./runtests.sh, and it is enough that it is modified so that passing it will mean passing the checks on travis.

  • isort should be set to autofix
  • some flake8 checks are on travis, but not in the ./runtests.sh

Running the lint fixes as a pre-push hook is too late; the commit has already been done, requiring yet-another-commit with the lint changes. We can still commit with --no-verify if we want to commit faster.

Priority: -- → P3

Can I work on this issue?

Kyle, we can use a pre-commit hook instead of pre-push.

Shivansh, could you see if flake8 and isort in runtests.sh can be changed to autofix?
Thanks for your help!

(In reply to Shivansh Srivastava from comment #4)

Can I work on this issue?

Also, look at the .travis.yml which runs some number of formatting rules not included in the ./runtests.sh: There are javascript checks that are running over the python codebase (not fixing python code, rather looking for json files and other web-like files).

Component: Treeherder: Docs & Development → TreeHerder
You need to log in before you can comment on or make changes to this bug.