Some out-of-the-box hooks for pre-commit

Overview

Build Status Azure DevOps coverage pre-commit.ci status

pre-commit-hooks

Some out-of-the-box hooks for pre-commit.

See also: https://github.com/pre-commit/pre-commit

Using pre-commit-hooks with pre-commit

Add this to your .pre-commit-config.yaml

-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.0.1  # Use the ref you want to point at
    hooks:
    -   id: trailing-whitespace
    # -   id: ...

Hooks available

check-added-large-files

Prevent giant files from being committed.

  • Specify what is "too large" with args: ['--maxkb=123'] (default=500kB).
  • Limits checked files to those indicated as staged for addition by git.
  • If git-lfs is installed, lfs files will be skipped (requires git-lfs>=2.2.1)
  • --enforce-all - Check all listed files not just those staged for addition.

check-ast

Simply check whether files parse as valid python.

check-builtin-literals

Require literal syntax when initializing empty or zero Python builtin types.

  • Allows calling constructors with positional arguments (e.g., list('abc')).
  • Allows calling constructors from the builtins (__builtin__) namespace (builtins.list()).
  • Ignore this requirement for specific builtin types with --ignore=type1,type2,….
  • Forbid dict keyword syntax with --no-allow-dict-kwargs.

check-case-conflict

Check for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT.

check-docstring-first

Checks for a common error of placing code before the docstring.

check-executables-have-shebangs

Checks that non-binary executables have a proper shebang.

check-json

Attempts to load all json files to verify syntax.

check-merge-conflict

Check for files that contain merge conflict strings.

check-shebang-scripts-are-executable

Checks that scripts with shebangs are executable.

check-symlinks

Checks for symlinks which do not point to anything.

check-toml

Attempts to load all TOML files to verify syntax.

check-vcs-permalinks

Ensures that links to vcs websites are permalinks.

  • --additional-github-domain DOMAIN - Add check for specified domain. Can be repeated multiple times. for example, if your company uses GitHub Enterprise you may use something like --additional-github-domain github.example.com

check-xml

Attempts to load all xml files to verify syntax.

check-yaml

Attempts to load all yaml files to verify syntax.

  • --allow-multiple-documents - allow yaml files which use the multi-document syntax
  • --unsafe - Instead of loading the files, simply parse them for syntax. A syntax-only check enables extensions and unsafe constructs which would otherwise be forbidden. Using this option removes all guarantees of portability to other yaml implementations. Implies --allow-multiple-documents.

debug-statements

Check for debugger imports and py37+ breakpoint() calls in python source.

destroyed-symlinks

Detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to. This usually happens on Windows when a user clones a repository that has symlinks but they do not have the permission to create symlinks.

detect-aws-credentials

Checks for the existence of AWS secrets that you have set up with the AWS CLI. The following arguments are available:

  • --credentials-file CREDENTIALS_FILE - additional AWS CLI style configuration file in a non-standard location to fetch configured credentials from. Can be repeated multiple times.
  • --allow-missing-credentials - Allow hook to pass when no credentials are detected.

detect-private-key

Checks for the existence of private keys.

double-quote-string-fixer

This hook replaces double quoted strings with single quoted strings.

end-of-file-fixer

Makes sure files end in a newline and only a newline.

fix-byte-order-marker

removes UTF-8 byte order marker

fix-encoding-pragma

Add # -*- coding: utf-8 -*- to the top of python files.

  • To remove the coding pragma pass --remove (useful in a python3-only codebase)

file-contents-sorter

Sort the lines in specified files (defaults to alphabetical). You must provide list of target files as input to it. Note that this hook WILL remove blank lines and does NOT respect any comments.

forbid-new-submodules

Prevent addition of new git submodules.

mixed-line-ending

Replaces or checks mixed line ending.

  • --fix={auto,crlf,lf,no}
    • auto - Replaces automatically the most frequent line ending. This is the default argument.
    • crlf, lf - Forces to replace line ending by respectively CRLF and LF.
      • This option isn't compatible with git setup check-in LF check-out CRLF as git smudge this later than the hook is invoked.
    • no - Checks if there is any mixed line ending without modifying any file.

name-tests-test

Assert that files in tests/ end in _test.py.

  • Use args: ['--django'] to match test*.py instead.

no-commit-to-branch

Protect specific branches from direct checkins.

  • Use args: [--branch, staging, --branch, master] to set the branch. Both master and main are protected by default if no branch argument is set.
  • -b / --branch may be specified multiple times to protect multiple branches.
  • -p / --pattern can be used to protect branches that match a supplied regex (e.g. --pattern, release/.*). May be specified multiple times.

Note that no-commit-to-branch is configured by default to always_run. As a result, it will ignore any setting of files, exclude, types or exclude_types. Set always_run: false to allow this hook to be skipped according to these file filters. Caveat: In this configuration, empty commits (git commit --allow-empty) would always be allowed by this hook.

pretty-format-json

Checks that all your JSON files are pretty. "Pretty" here means that keys are sorted and indented. You can configure this with the following commandline options:

  • --autofix - automatically format json files
  • --indent ... - Control the indentation (either a number for a number of spaces or a string of whitespace). Defaults to 2 spaces.
  • --no-ensure-ascii preserve unicode characters instead of converting to escape sequences
  • --no-sort-keys - when autofixing, retain the original key ordering (instead of sorting the keys)
  • --top-keys comma,separated,keys - Keys to keep at the top of mappings.

requirements-txt-fixer

Sorts entries in requirements.txt and removes incorrect entry for pkg-resources==0.0.0

sort-simple-yaml

Sorts simple YAML files which consist only of top-level keys, preserving comments and blocks.

Note that sort-simple-yaml by default matches no files as it enforces a very specific format. You must opt in to this by setting files, for example:

    -   id: sort-simple-yaml
        files: ^config/simple/

trailing-whitespace

Trims trailing whitespace.

  • To preserve Markdown hard linebreaks use args: [--markdown-linebreak-ext=md] (or other extensions used by your markdownfiles). If for some reason you want to treat all files as markdown, use --markdown-linebreak-ext=*.
  • By default, this hook trims all whitespace from the ends of lines. To specify a custom set of characters to trim instead, use args: [--chars,"<chars to trim>"].

Deprecated / replaced hooks

  • check-byte-order-marker: instead use fix-byte-order-marker

As a standalone package

If you'd like to use these hooks, they're also available as a standalone package.

Simply pip install pre-commit-hooks

Comments
  • No support for pycodestyle

    No support for pycodestyle

    flake8 was officialy deprecated and mostly replaced by pycodestyle which is currently does not have a pre-commit-hook.

    Initially I was considering repurposing the flake8 hook but I think it will be better to have a new one as doing the swap may also involve renaming its section inside setup.cfg or tox.ini.

    opened by ssbarnea 25
  • Pin down flake8 version

    Pin down flake8 version

    Dear authors of pre-commit,

    I've been using this for quite some time in CI and everything worked nicely. However, today, new version of flake8 came out and as I install pre-commit for every CI RUN new errors started to pop-out (W605 specifically).

    Would it be possible to pin down the flake8 version in setup.py? And increase the version as versions of pre-commit-hooks increase? I'm willing to make the PR.

    With regards Krystof

    question 
    opened by KPilnacek 22
  • UnicodeDecodeError in detect-aws-credentials is unreadable

    UnicodeDecodeError in detect-aws-credentials is unreadable

    Detect AWS Credentials...................................................Failed
    hookid: detect-aws-credentials
    
    Traceback (most recent call last):
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
        sys.exit(main())
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
        bad_filenames = check_file_for_aws_keys(args.filenames, keys)
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
        text_body = content.read()
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xeb in position 103: invalid continuation byte
    Traceback (most recent call last):
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
        sys.exit(main())
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
        bad_filenames = check_file_for_aws_keys(args.filenames, keys)
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
        text_body = content.read()
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 2346: invalid start byte
    Traceback (most recent call last):
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
        sys.exit(main())
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
        bad_filenames = check_file_for_aws_keys(args.filenames, keys)
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
        text_body = content.read()
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 187: invalid continuation byte
    Traceback (most recent call last):
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/bin/detect-aws-credentials", line 11, in <module>
        sys.exit(main())
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 133, in main
        bad_filenames = check_file_for_aws_keys(args.filenames, keys)
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/site-packages/pre_commit_hooks/detect_aws_credentials.py", line 74, in check_file_for_aws_keys
        text_body = content.read()
      File "/home/ryan/.cache/pre-commit/repo8jj7q4iz/py_env-python3.7/lib/python3.7/codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 167: invalid continuation byte
    

    It rejected the commit, so that's good. And I'm not sure if I can recommend any improvements to the handling of invalid unicode since I haven't looked at the code in this module.

    But for sure this error message could be more useful. There are 773 files in this commit and it would sure be nice to know which one(s) have this problem.

    Edit: Ideally if there's an exception it would continue to the next file so all the files that couldn't be processed can be listed to the user before the commit is rejected. I'm not looking forward to fixing one file, doing git commit, fixing another... 500 times. ;)

    enhancement good-first-issue 
    opened by rpdelaney 20
  • yapf hook

    yapf hook

    https://github.com/google/yapf looks like a neat tool to potentially replace autopep8. It does appear to be a bit immature, but once it stabilizes I think it could make for a good hook.

    opened by guykisel 20
  • check-executables-have-shebangs not correct on windows

    check-executables-have-shebangs not correct on windows

    does not seem to work right on windows

    i am dealing with a primarily linux / python project but on a windows machine.

    i have set git config core.filemode false

    i created a new file and stage and i verify that filemode is 644:

    >git ls-files -s newfile.py
    100644 3edd36f71bf2081c70a0eaf39dec6980d0a9f791 0       newfile.py
    

    but hook still fails

    hookid: check-executables-have-shebangs
    
    newfile.py: marked executable but has no (or invalid) shebang!
      If it isn't supposed to be executable, try: chmod -x newfile.py
      If it is supposed to be executable, double-check its shebang.
    

    why is this file causing error?

    opened by dstandish 18
  • end-of-file-fixer fails against a

    end-of-file-fixer fails against a ".git/MERGE_MSG" file

    I'm running git merge --no-ff release-7.1.2 -m "Merge branch 'release-7.1.2' into master" and it fails because it's incorrectly checking files inside the .git directory:

    Fix End of Files.........................................................Failed
    hookid: end-of-file-fixer
    
    Fixing .git/MERGE_MSG
    
    pre-commit 1.11.1
    git version 2.19.0
    macOS 10.14 (18A391)
    
    opened by revolter 16
  • Add hook for appending newline to end of files

    Add hook for appending newline to end of files

    A hook I have use for, and which I've mostly already written (should write up some more tests), is to ensure that files end with a blank newline - i.e. a add-trailing-newline hook. This is necessary for certain shells where there are issues reading the last line of includes.

    I can't see any material here about contribution, but I did have a brief look through older closed MRs and found that you appreciated issues before opening any MRs.

    question 
    opened by anderslindho 15
  • Eventual deprecation of flake8

    Eventual deprecation of flake8

    More of a heads up than anything -- not that many will see this 😆

    Now that I've added a .pre-commit-hooks.yaml to the flake8 repository, we'll eventually be deprecating the flake8 hook defined here.

    The rough ordering for that:

    • [x] flake8 makes its next tagged release (probably 3.7.0) -- I'm not sure on the timeline for this yet, we have to fix some new parsing of per_file_ignores and then probably will wait until pycodestyle / pyflakes make a new release(s) and then go go go?
    • [x] the flake8 hook will be "soft" deprecated. Probably nothing more than some messaging in the README. This will probably be pre-commit-hooks==2.X where X is some minor release greater than the current release
    • [x] Further after, (pre-commit-hooks==3) flake8 will be removed as a dependency in this repository and the flake8 executable will be replaced with a stub similar to the one added when autopep8-wrapper was deprecated

    The rationale for this change:

    • Direct access to the flake8 git repository better funnels people to raise issues in the correct place
    • It is easier to pin the exact version of flake8 you are using (and leverage pre-commit autoupdate to get to a newer version)
    • pre-commit-hooks is no longer plagued by spurious VersionConflict errors

    This issue is mostly a FYI / tracking issue for those events

    opened by asottile 14
  • Trailing whitespace not working

    Trailing whitespace not working

    I just installed pre-commit, added this .pre-commit-config.yaml file:

    # See http://pre-commit.com for more information
    # See http://pre-commit.com/hooks.html for more hooks
    repos:
    -   repo: https://github.com/pre-commit/pre-commit-hooks
        sha: v1.1.1
        hooks:
        -   id: trailing-whitespace
    

    and added a trailing space to a line in a file in the project, staged it, and when I commit it, it commits with the space, instead of removing it.

    opened by revolter 14
  • pre-commit flake8 check fails with no error message

    pre-commit flake8 check fails with no error message

    The pre-commit flake8 check is failing without any error message for me. It just says Failed.

    pre-commit runtests: commands[1] | pre-commit run --all-files
    Trim Trailing Whitespace.................................................Passed
    Fix End of Files.........................................................Passed
    Check docstring is first.................................................Passed
    Check that executables have shebangs.................(no files to check)Skipped
    Check for merge conflicts................................................Passed
    Check Yaml...............................................................Passed
    Debug Statements (Python)................................................Passed
    Fix double quoted strings................................................Passed
    Flake8...................................................................Failed
    Check for added large files..............................................Passed
    Check for byte-order marker..............................................Passed
    Fix python encoding pragma...............................................Passed
    Fix requirements.txt.....................................................Passed
    Reorder python imports...................................................Passed
    autopep8.................................................................Passed
    pyupgrade................................................................Passed
    ERROR: InvocationError: '/nail/home/drolando/pg/python/yelp_zipkin_utils/.tox/pre-commit/bin/pre-commit
     run --all-files'
    _______________________________________________ summary _______________________________________________
      py27: commands succeeded
      py36: commands succeeded
      py37: commands succeeded
    ERROR:   pre-commit: commands failed
    Makefile:4: recipe for target 'test' failed
    make: *** [test] Error 1
    

    If I source the virtualenv and run flake8 everything works though, so there seems to be something special with the way pre-commit runs it.

    [email protected] yelp_zipkin_utils (git master) ✓
    ~>  source .tox/pre-commit/bin/activate
    [email protected] yelp_zipkin_utils (git master) ✓
    ~>  flake8
    drolan[email protected] yelp_zipkin_utils (git master) ✓
    ~>  
    
    ~>  cat .pre-commit-config.yaml
    repos:
    -   repo: [email protected]:mirrors/pre-commit/pre-commit-hooks
        rev: v2.4.0
        hooks:
        -   id: trailing-whitespace
        -   id: end-of-file-fixer
        -   id: check-docstring-first
        -   id: check-executables-have-shebangs
        -   id: check-merge-conflict
        -   id: check-yaml
        -   id: debug-statements
        -   id: double-quote-string-fixer
        -   id: flake8
        -   id: check-added-large-files
        -   id: check-byte-order-marker
        -   id: fix-encoding-pragma
        -   id: requirements-txt-fixer
    
    ~>  cat tox.ini | grep -A 3 flake8
    [flake8]
    ignore =
    exclude = .git,.tox,docs,virtualenv_run
    filename = *.py
    (pre-commit)
    

    The interesting thing is that it works fine if I use python3.6, it only seems to fail if I use python3.7 (3.7.5). @asottile have you seen this issue before? Any suggestion on how to debug it otherwise? Adding -v doesn't print anything useful...

    opened by drolando 13
  • Detect mixed line endings

    Detect mixed line endings

    It would be great if pre-commit-hooks could detect mixed line endings.

    In Atom ("Mixed"): image

    Keywords for future searches: newline, new line, end of line, end-of-line, EOL, line terminator, linebreak, line-break, line break, line-ending, linefeed, line feed, line-feed, LF, carriage return, carriage-return, CR, CRLF, CR-LF

    enhancement 
    opened by nagromc 13
  • add new forbid-empty-files hook

    add new forbid-empty-files hook

    As previously discussed in #834, this hook prevents empty files from being committed. It works out of the box and is compatible with python projects since __init__.py are excluded by default.

    opened by antonag32 0
  • Proposal: Check empty files

    Proposal: Check empty files

    I need to write a hook to ensure empty files are not being committed, looking around the issues section it seems this has not been mentioned yet. Is this something considered generic/useful enough to be included in this repo? If so we could discuss further details about it and I can end up making a PR for it.

    opened by antonag32 6
  • Forbid the combination of unique and ignore case options in file_contents_sorter.py

    Forbid the combination of unique and ignore case options in file_contents_sorter.py

    Example output when both options are specified:

    usage: file_contents_sorter.py [-h] [--ignore-case | --unique] filenames [filenames ...]
    file_contents_sorter.py: error: argument --unique: not allowed with argument --ignore-case
    

    Closes #794.

    opened by renegaderyu 0
  • `file-contents-sorter` Not working same way everytime

    `file-contents-sorter` Not working same way everytime

    I get strange issue that file-contents-sorter hook does not work same way everytime. I made little test case which trickers the issue. If i run this 10 times it will sometimes pass and sometimes not. I did not have time to look what problem might be.

    Add this to file_contents_sorter_test.py

    (
        b'pre\nPre\n',
        ['--unique', '--ignore-case'],
        PASS,
        b'pre\nPre\n',
    ),
    

    And run it with for run in {1..10}; do pytest tests/file_contents_sorter_test.py; done This gives me that about 30% pass and 70% fails

    opened by teksturi 4
Releases(v4.3.0)
  • v4.3.0(Jun 7, 2022)

    Features

    • check-executables-have-shebangs: use git config core.fileMode to determine if it should query git.
      • #730 PR by @Kurt-von-Laven.
    • name-tests-test: add --pytest-test-first test convention.
      • #779 PR by @asottile.

    Fixes

    • check-shebang-scripts-are-executable: update windows instructions.
      • #774 PR by @mdeweerd.
      • #770 issue by @mdeweerd.
    • check-toml: use stdlib tomllib when available.
      • #771 PR by @DanielNoord.
      • #755 issue by @sognetic.
    • check-added-large-files: don't run on non-file stages.
      • #778 PR by @asottile.
      • #777 issue by @skyj.
    Source code(tar.gz)
    Source code(zip)
  • v4.2.0(Apr 6, 2022)

    Features

    • name-tests-test: updated display text.
      • #713 PR by @asottile.
    • check-docstring-first: make output more parsable.
      • #748 PR by @asottile.
    • check-merge-conflict: make output more parsable.
      • #748 PR by @asottile.
    • debug-statements: make output more parsable.
      • #748 PR by @asottile.

    Fixes

    • check-merge-conflict: fix detection of ====== conflict marker on windows.
      • #748 PR by @asottile.

    Updating

    • Drop python<3.7.
      • #719 PR by @asottile.
    • Changed default branch from master to main.
      • #744 PR by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v4.1.0(Dec 24, 2021)

    Features

    • debug-statements: add pdbr debugger.
      • #614 PR by @cansarigol.
    • detect-private-key: add detection for additional key types.
      • #658 PR by @ljmf00.
    • check-executables-have-shebangs: improve messaging on windows.
      • #689 PR by @pujitm.
      • #686 issue by @jmerdich.
    • check-added-large-files: support --enforce-all with git-lfs.
      • #674 PR by @amartani.
      • #560 issue by @jeremy-coulon.

    Fixes

    • check-case-conflict: improve performance.
      • #626 PR by @guykisel.
      • #625 issue by @guykisel.
    • forbid-new-submodules: fix false-negatives for pre-push.
      • #619 PR by @m-khvoinitsky.
      • #609 issue by @m-khvoinitsky.
    • check-merge-conflict: fix execution in git worktrees.
      • #662 PR by @errsyn.
      • #638 issue by @daschuer.

    Misc.

    • Normalize case of hook names and descriptions.
      • #671 PR by @dennisroche.
      • #673 PR by @revolter.
    Source code(tar.gz)
    Source code(zip)
  • v4.0.1(May 16, 2021)

  • v4.0.0(May 15, 2021)

    Features

    • check-json: report duplicate keys.
      • #558 PR by @AdityaKhursale.
      • #554 issue by @adamchainz.
    • no-commit-to-branch: add main to default blocked branches.
      • #565 PR by @ndevenish.
    • check-case-conflict: check conflicts in directory names as well.
      • #575 PR by @slsyy.
      • #70 issue by @andyjack.
    • check-vcs-permalinks: forbid other branch names.
      • #582 PR by @jack1142.
      • #581 issue by @jack1142.
    • check-shebang-scripts-are-executable: new hook which ensures shebang'd scripts are executable.
      • #545 PR by @scop.

    Fixes

    • check-executables-have-shebangs: Short circuit shebang lookup on windows.
      • #544 PR by @scop.
    • requirements-txt-fixer: Fix comments which have indentation
      • #549 PR by @greshilov.
      • #548 issue by @greshilov.
    • pretty-format-json: write to stdout using UTF-8 encoding.
      • #571 PR by @jack1142.
      • #570 issue by @jack1142.
    • Use more inclusive language.
      • #599 PR by @asottile.

    Breaking changes

    • Remove deprecated hooks: flake8, pyflakes, autopep8-wrapper.
      • #597 PR by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v3.4.0(Dec 15, 2020)

    Features

    • file-contents-sorter: Add --unique argument
      • #524 PR by @danielhoherd.
    • check-vcs-permalinks: Add --additional-github-domain option
      • #530 PR by @youngminz.
    • New hook: destroyed-symlinks to detect unintentional symlink-breakages on windows.
      • #511 PR by @m-khvoinitsky.
    Source code(tar.gz)
    Source code(zip)
  • v3.3.0(Oct 20, 2020)

    Features

    • file-contents-sorter: add --ignore-case option for case-insensitive sorting
      • #514 PR by @Julian.
    • check-added-large-files: add --enforce-all option to check non-added files as well
      • #519 PR by @mshawcroft.
      • #518 issue by @mshawcroft.
    • fix-byte-order-marker: new hook which fixes UTF-8 byte-order marker.
      • #522 PR by @jgowdy.

    Deprecations

    • check-byte-order-marker is now deprecated for fix-byte-order-marker
    Source code(tar.gz)
    Source code(zip)
  • v3.2.0(Jul 30, 2020)

    Features

    • debug-statements: add support for pydevd_pycharm debugger
      • #502 PR by @jgeerds.

    Fixes

    • check-executables-have-shebangs: fix git-quoted files on windows (spaces, non-ascii, etc.)
      • #509 PR by @pawamoy.
      • #508 issue by @pawamoy.
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(May 20, 2020)

    Features

    • check-executables-have-shebangs: on windows, validate the mode bits using git
      • #480 PR by @mxr.
      • #435 issue by @dstandish.
    • requirements-txt-fixer: support more operators
      • #483 PR by @mxr.
      • #331 issue by @hackedd.

    Fixes

    • pre-commit-hooks-removed: Fix when removed hooks used args
      • #487 PR by @pedrocalleja.
      • #485 issue by @pedrocalleja.
    Source code(tar.gz)
    Source code(zip)
  • v3.0.1(May 20, 2020)

  • v3.0.0(May 20, 2020)

    Features

    • detect-aws-credentials: skip empty aws keys
      • #450 PR by @begoon.
      • #449 issue by @begoon.
    • debug-statements: add detection wdb debugger
      • #452 PR by @itsdkey.
      • #451 issue by @itsdkey.
    • requirements-txt-fixer: support line continuation for dependencies
      • #469 PR by @aniketbhatnagar.
      • #465 issue by @aniketbhatnagar.

    Fixes

    • detect-aws-credentials: fix UnicodeDecodeError when running on non-UTF8 files.
      • #453 PR by @asottile.
      • #393 PR by @a7p
      • #346 issue by @rpdelaney.

    Updating

    • pre-commit/pre-commit-hooks now requires python3.6.1+

      • #447 PR by @asottile.
      • #455 PR by @asottile.
    • flake8 / pyflakes have been removed, use flake8 from pycqa/flake8 instead:

      -   repo: https://gitlab.com/pycqa/flake8
          rev: 3.8.1
          hooks:
          -   id: flake8
      
      • #476 PR by @asottile.
      • #477 PR by @asottile.
      • #344 issue by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(Feb 5, 2020)

    Fixes

    • Fix sorting of requirements which use egg=...
      • #425 PR by @vinayinvicible.
    • Fix over-eager regular expression for test filename matching
      • #429 PR by @rrauenza.

    Updating

    • Use flake8 from pycqa/flake8 instead:

      -   repo: https://gitlab.com/pycqa/flake8
          rev: 3.7.9
          hooks:
          -   id: flake8
      
    Source code(tar.gz)
    Source code(zip)
  • v2.4.0(Oct 28, 2019)

    Features

    • Add diff output to pretty-format-json when run without --autofix.
      • #408 PR by @joepin.
    • Add --chars option to trailing-whitespace fixer to control which characters are stripped instead of all whitespace.
      • #421 PR by @iconmaster5326.

    Fixes

    • Fix requirements-txt-fixer when file does not end in a newline.
      • #414 issue by @barakreif.
      • #415 PR by @barakreif.
    • Fix double printing of filename in pretty-format-json.
      • #419 PR by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Aug 5, 2019)

    Features

    • Add rpdb to detected debuggers in debug-statements
      • #389 PR by @danlamanna.
    • Add check-toml hook
      • #400 PR by @MarSoft.
      • #400 PR by @ssbarnea.

    Fixes

    • Add __main__ block to pre_commit.file_contents_sorter so it can be invoked using python -m
      • #405 PR by @squeaky-pl.

    Misc.

    • Fix git-lfs tests in azure pipelines
      • #403 PR by @ssbarnea.
    Source code(tar.gz)
    Source code(zip)
  • v2.2.3(May 16, 2019)

  • v2.2.2(May 15, 2019)

  • v2.2.1(Apr 21, 2019)

  • v2.2.0(Apr 21, 2019)

    Features

    • Switch from pyyaml to ruamel.yaml
      • This enforces (among other things) duplicate key checking in yaml.
      • #351 PR by @asottile.
    • Add a new --pattern option to no-commit-to-branch for regex matching branch names.
      • #375 issue by @marcjay.
      • #376 PR by @marcjay.

    Fixes

    • Set require_serial: true for flake8
      • flake8 internally uses multiprocessing.
      • #358 PR by @asottile.
    • Don't run check-executables-have-shebangs / trailing-whitespace hooks during the commit-msg stage.
      • #361 issue by @revolter.
      • #362 PR by @revolter.
    • Run check-byte-order-marker against types: [text]
      • #371 PR by @tobywf.
      • #372 PR by @tobywf.
    • Do not require UTF-8-encoded files for check-docstring-first
      • #345 issue by @x007007007.
      • #374 PR by @asottile.

    Misc.

    • pre-commit-hooks now is type checked with mypy.
      • #360 PR by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Apr 21, 2019)

    Features

    • Detect PGP/GPG private keys in detect-private-key
      • #329 PR by @rpdelaney.
    • Report filenames when fixing files in mixed-line-endings
      • #341 PR by @gimbo.
      • #340 issuey by @gimbo.

    Fixes

    • Handle CRLF / CR line endings in end-of-file-fixer
      • #327 PR by @mtkennerly.

    Docs

    • Clarify and document arguments for detect-aws-credentials
      • #333 PR by @rpdelaney.
    • Clarify autopep8-wrapper is deprecated in description
      • #343 PR by @TheKevJames.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Oct 13, 2018)

    Breaking changes

    • autopep8-wrapper has been moved to pre-commit/mirrors-autopep8
      • #92 issue by @asottile.
      • #319 issue by @blaggacao.
      • #321 PR by @asottile.
    • trailing-whitespace defaults to --no-markdown-linebreak-ext
      • #310 issue by @asottile.
      • #324 PR by @asottile.
    • hooks.yaml (legacy pre-commit hook metadata) deleted
      • #323 PR by @asottile.
    • pre-types compatibility metadata removed
      • #323 PR @asottile.

    Docs

    • Correct documentation for no-commit-to-branch
      • #318 PR by @milin.

    Updating

    • Minimum supported version of pre-commit is now 0.15.0
    • Use autopep8 from pre-commit/mirrors-autopep8
    • To keep mardown hard linebreaks, for trailing-whitespace use args: [--markdown-linebreak-ext=md,markdown] (the previous default value)
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0-1(Sep 27, 2018)

    (Note: this is a tag-only release as no code changes occurred)

    Fixes

    • Don't run end-of-file-fixer during commit-msg stage
      • #315 issue by @revolter.
      • #317 PR by @revolter.
    Source code(tar.gz)
    Source code(zip)
  • v1.4.0(Jul 22, 2018)

    Features

    • no-commit-to-branch: allow --branch to be specified multiple times
      • #190 PR by @moas.
      • #294 PR by @asottile.
    • check-merge-conflict: add --assume-in-merge to force checks outside of a merge commit situation
      • #300 issue by @vinayinvicible.
      • #301 PR by @vinayinvicible.

    Fixes

    • Don't match whitespace in VCS urls
      • #293 PR by @asottile.
    • Fix invalid escape sequences
      • #296 PR by @asottile.
    • Fix ResourcesWarnings
      • #297 PR by @asottile.

    Misc

    • Test against python3.7
      • #304 PR by @expobrain.
    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(May 28, 2018)

    Features

    • Add an --unsafe argument to check-yaml to allow custom yaml tags
      • #273 issue by @blackillzone.
      • #274 PR by @asottile.
    • Automatically remove pkg-resources==0.0.0 in requirements-txt-fixer
      • #275 PR by @nvtkaszpir.
    • Detect breakpoint() (python3.7+) in debug-statements hook.
      • #283 PR by @asottile.
    • Detect sshcom and putty hooks in detect-private-key
      • #287 PR by @vin01.

    Fixes

    • Open files as UTF-8 (autopep8-wrapper, check-docstring-first, double-quote-string-fixer)
      • #279 PR by @nvtkaszpir.
    • Fix AttributeError in check-builtin-literals for some functions
      • #285 issue by @EgoWumpus.
      • #286 PR by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.3(Feb 28, 2018)

  • v1.2.2(Feb 28, 2018)

  • v1.2.1-1(Feb 24, 2018)

    (Note: this is a tag-only release as no code changes occurred)

    Fixes:

    • Don't pass filenames for no-commit-to-branch
      • #268 issue by @dongyuzheng.
      • #269 PR by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Feb 19, 2018)

    Fixes:

    • detect-aws-credentials false positive when key was empty
      • #258 issue by @PVSec.
      • #260 PR by @PVSec.
    • no-commit-to-branch no longer crashes when not on a branch
      • #265 issue by @hectorv.
      • #266 PR by @asottile.
    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Jan 14, 2018)

    Features:

    • Add new check-builtin-literals hook.
      • #249 #251 PR by @benwebber.
    • pretty-format-json no longer depends on simplejson.
      • #254 PR by @cas--.
    • detect-private-key now detects gcp keys.
      • #255 issue by @SaMnCo @nicain.
      • #256 PR by @nicain.
    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Oct 19, 2017)

  • v1.1.0(Oct 12, 2017)

Owner
pre-commit
A framework for managing and maintaining multi-language pre-commit hooks.
pre-commit
🍏 Make Thinc faster on macOS by calling into Apple's native Accelerate library

🍏 Make Thinc faster on macOS by calling into Apple's native Accelerate library

Explosion 81 Nov 26, 2022
Interpreting-compiling programming language.

HoneyASM The programming language written on Python, which can be as interpreted as compiled. HoneyASM is easy for use very optimized PL, which can so

TalismanChet 1 Dec 25, 2021
VirtualBox Power Driver for MAAS (Metal as a Service)

vboxpower VirtualBox Power Driver for MAAS (Metal as a Service) A way to manage the power of VirtualBox virtual machines via the MAAS webhook driver.

Saeid Bostandoust 131 Dec 17, 2022
A simple chatbot that I made for school project

Chatbot: Python A simple chatbot that I made for school Project. Tho this chatbot is dumb sometimes, but it's not too bad lol. Check it Out! FAQ How t

Prashant 2 Nov 13, 2021
It's an .exe file that can notify your chia profit and warning message every time automatically.

chia-Notify-with-Line 警示程式 It's an .exe file that can notify your chia profit and warning message every time automatically. 這是我自行設計的小程式,有轉成.exe檔了,可以在沒

You,Yu 1 Oct 28, 2021
Convex Optimisation MVA course - Assignment

Convex Optimisation MVA course - Assignment This repository contains the coding files of the third assignment in the MVA Convex Optimisation course. U

1 Nov 27, 2021
KeyLogger cliente-servidor em Python para estudos

KeyLogger Esse projeto é apenas para estudos, não nos responsabilisamos por qualquer uso indevido ou prejudiciais do mesmo. Sobre O objetivo do projet

1 Dec 17, 2021
适用于HoshinoBot下的雀魂插件。可进行近期对局查询、查询个人数据等功能,更多功能正在扩展

Majsoul_bot This is a Majsoul plugin for HoshinoBot 这是一个HoshinoBot的雀魂相关插件 本项目目前正在扩展,后续会扩展更多功能,敬请期待 前言 项目地址:https://github.com/DaiShengSheng/Majsoul_bo

黛笙笙 33 Dec 14, 2022
Python-geoarrow - Storing geometry data in Apache Arrow format

geoarrow Storing geometry data in Apache Arrow format Installation $ pip install

Joris Van den Bossche 11 Mar 03, 2022
Wunderland desktop wallpaper and Microsoft Teams background.

Wunderland Professional Impress your colleagues, friends and family with this edition of the "Wunderland" wallpaper. With the nostalgic feel of the or

3 Dec 14, 2022
A simple flashcard app built as a final project for a databases class.

CS2300 Final Project - Flashcard app 'FlashStudy' Tech stack Backend Python (Language) Django (Web framework) SQLite (Database) Frontend HTML/CSS/Java

Christopher Spencer 2 Feb 03, 2022
Demodulate and error correct FIS-B and ADS-B signals on 978 MHz.

FIS-B 978 ('fisb-978') is a set of programs that demodulates and error corrects FIS-B (Flight Information System - Broadcast) and ADS-B (Automatic Dep

2 Nov 15, 2022
Rofi script to minimize / unminimize multiple windows in qtile

Qminimize Rofi script to minimize / unminimize multiple windows in qtile Additional requirements : EWMH module fuzzywuzzy module How to use it : - Clo

9 Sep 18, 2022
A faster copy of nell's comet nuker

Astro a faster copy of nell's comet nuker also nell uses external libraries like it's cocaine man never learned to use ansi color codes (ily nell) (On

horrid 8 Aug 15, 2022
Plugin to generate BOM + CPL files for JLCPCB

KiCAD JLCPCB tools Plugin to generate all files necessary for JLCPCB board fabrication and assembly Gerber files Excellon files BOM file CPL file Furt

bouni 566 Dec 29, 2022
A simple, light-weight and highly maintainable online judge system for secondary education

y³OJ a simple, light-weight and highly maintainable online judge system for secondary education 一个简单、轻量化、易于维护的、为中学信息技术学科课业教学设计的 Online Judge 系统。 Onlin

20 Oct 04, 2022
A simplified python interface to COPASI.

BasiCO This project hosts a simplified python interface to COPASI. While all functionality from COPASI is exposed via automatically generated SWIG wra

COPASI 8 Dec 21, 2022
Pipenv-local-deps-repro - Reproduction of a local transitive dependency on pipenv

Reproduction of the pipenv bug with transitive local dependencies. Clone this re

Lucas Duailibe 2 Jan 11, 2022
flake8 plugin which checks that there is no use of sleep in the code.

flake8-sleep flake8 plugin which checks for use of sleep function. installation Using Pypi: pip install flake8-sleep flake8 codes Code Description SLP

1 Nov 26, 2021
A clock widget for linux ez to use no need for cmd line ;)

A clock widget in LINUX A clock widget for linux ez to use no need for cmd line ;) How to install? oh its ez just go to realese! what are the paltform

1 Feb 15, 2022