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

Add automatic code checks / formatting #36

Open
Valian opened this issue Dec 8, 2020 · 0 comments
Open

Add automatic code checks / formatting #36

Valian opened this issue Dec 8, 2020 · 0 comments

Comments

@Valian
Copy link

Valian commented Dec 8, 2020

I'm usually using tool called pre-commit https://pre-commit.com/

It's something that works great as an addition to CI / CD. Just before making a commit, pre-commit automatically runs all changed files through a series of fast checks, such as flake8, black, isort etc. It usually takes less than a second, and makes it possible to eliminate style-related discussion during Code Review.

My usual configuration file:

repos:
  - repo: https://github.com/ambv/black
    rev: 20.8b1
    hooks:
      - id: black
        language_version: python3.8
        args: ['--line-length=120']
  - repo: https://github.com/asottile/seed-isort-config
    rev: v1.6.0
    hooks:
      - id: seed-isort-config
        language_version: python3.8
        args: ['--application-directories=src/backend']
  - repo: https://github.com/pre-commit/mirrors-isort
    rev: v4.3.4
    hooks:
      - id: isort
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.1.0
    hooks:
      - id: end-of-file-fixer
      - id: check-merge-conflict
      - id: mixed-line-ending
      - id: trailing-whitespace
      - id: check-added-large-files
        args: ['--maxkb=1024']
      - id: flake8
        language_version: python3
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

No branches or pull requests

1 participant