Skip to content

Instantly share code, notes, and snippets.

@mateuspadua
Last active February 11, 2020 16:39
Show Gist options
  • Save mateuspadua/0f71cfd3a65f82dfba61407db7a5a3d9 to your computer and use it in GitHub Desktop.
Save mateuspadua/0f71cfd3a65f82dfba61407db7a5a3d9 to your computer and use it in GitHub Desktop.
How add pre-commit on project
[flake8]
max-line-length = 88
exclude=*/migrations/*
[settings]
force_grid_wrap=0
include_trailing_comma=True
line_length=88
multi_line_output=3
use_parentheses=True
{
"default": true,
"MD013": false,
"MD041": false
}
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: check-yaml
- id: check-json
- id: check-added-large-files
- id: end-of-file-fixer
- id: trailing-whitespace
- id: flake8
additional_dependencies: [
"flake8-print==3.1.4"
]
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
hooks:
- id: isort
args: [-rc]
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.21.0
hooks:
- id: markdownlint
args: [--fix]
@mateuspadua
Copy link
Author

mateuspadua commented Feb 10, 2020

Tip for installation: create a virtual development env with Python 3 and follow the steps bellow:

  • create the 4 files above, in the root of your project.
  • pip install pre-commit
  • pre-commit install

(optional) Run against all the files

  • pre-commit run --all-files

Always that you run git commit -m"..." from now the pre-commit will be used to fix any non-stander irregularities.

That way:
image

@muriloviana
Copy link

We can optimize the .markdownlint.json with the following code:

{
    "default": true,
    "MD013": false,
    "MD041": false
}

@mateuspadua
Copy link
Author

We can optimize the .markdownlint.json with the following code:

{
    "default": true,
    "MD013": false,
    "MD041": false
}

Done, :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment