Skip to content

Pre-commit hooks for enforcing formatting #123

@clbarnes

Description

@clbarnes

pre-commit and its RiiR sibling prek manage a bunch of different pre-commit hooks which could make development more consistent. They are broadly compatible, with prek being faster and more efficient for most common actions.
Using prek, I tried

  • trailing-whitespace
  • end-of-file-fixer
  • check-yaml
  • check-json
  • pretty-format-json
  • mixed-line-ending, fix=lf
  • proselint
  • typos
  • codespell

Most are from prek's builtins; a few are from pre-commit's recommendations.

Any of them will introduce quite a lot of non-meaningful git churn and so should be added immediately after a release, ideally one at a time.

In particular, end-of-file-fixer and pretty-format-json edit a lot of the JSON examples.

proselint helped me fix some issues but gets a few false positives on helpful lints, so we may not be able to use it here.
codespell didn't find anything useful.
typos found some false positives which could be configured around (e.g. flagging "OME" as a misspelling of "some"), but then didn't find some other actual typos.
These should probably be omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions