News for hackers. Stuff that matters.
Re:GitHub Super Linter: one linter to rule them all by tlrobinson on Thursday June 18, 2020 @04:23PM (#23567561)
This is basically solved by pinning the formatter to a specific version in your project's dependencies, and enforcing its use in continuous integration.

Of course that doesn't help if you're setting up the formatter for the first time, or want to upgrade to a new version.

Some tools like GitHub's diff do try to deemphasize whitespace but it's pretty limited.

Re:GitHub Super Linter: one linter to rule them all by l0b0 on Thursday June 18, 2020 @04:48PM (#23567838)
In easy steps (Python/Git specific):

1. Use a tracked directory for Git hooks: `git config --local core.hooksPath 'git-hooks'`.

2. Create format.bash and lint.bash.

2.1. Run `black` and `isort` in format.bash.

2.2. Run `flake8`, `mypy`, `black` and `isort` in lint.bash.

2.3. Run lint.bash in the pre-commit hook.

2.4. By default, lint/format only files which are different from origin/master to save time: `git diff --diff-filter=d --name-only -z origin/master "[asterisk].py"`.

3. In CI, run lint.bash with `--all` or some other keyword to verify formatting on every file: `git ls-files -z -- "[asterisk].py"`.

After more than a year with this setup I absolutely adore it.

Re:GitHub Super Linter: one linter to rule them all by tlrobinson on Friday June 19, 2020 @01:44AM (#23571366)
Even better, IMHO, is just setting your editor to format on save. That way you can just write ugly code and hit save to get it formatted.

I've found git hooks to be more trouble than they're worth.

But as long as it's enforced in CI you can leave it up to individual team members how they want to do it.