Commit Graph

151 Commits

Author SHA1 Message Date
Anthony Sottile d6d3bd9460 v2.3.0 2019-08-05 10:33:34 -07:00
Semyon Maryasin 8d7d40c7cc Add README entry for check-toml hook 2019-08-03 19:16:51 +01:00
Anthony Sottile 0b70e285e3 v2.2.3 2019-05-16 09:58:18 -07:00
Anthony Sottile e8e54f7f99 v2.2.2 2019-05-15 10:17:27 -07:00
Anthony Sottile 9ee4347a8f v2.2.1 2019-04-21 13:17:05 -07:00
Anthony Sottile 7905d805af v2.2.0 2019-04-21 13:15:43 -07:00
Marc Jay 6568414fc5 Clarify default behaviour in README for no-commit-to-branch 2019-04-20 14:06:59 +01:00
Marc Jay 7b959d140f Tidy up indentation in README changes for no-commit-to-branch 2019-04-20 13:52:59 +01:00
Marc Jay 8d2785b9d6 Amend approach for no-commit-to-branch to use regex matching based on
feedback. Adds --pattern optional argument which can be used alongside
--branch to block commits to a branch which matches a supplied
regex expression
2019-04-20 13:46:49 +01:00
Marc Jay d6847c4827 Add wildcard matching to no-commit-to-branch hook so that commits can
be blocked on, for example, all release branches with 'release/*'
2019-04-09 23:53:39 +01:00
Anthony Sottile 8bb94f0bd4 azure pipelines [skip travis] [skip appveyor] 2019-03-10 16:56:44 -07:00
Anthony Sottile c8bad492e1 v2.1.0 2018-12-26 09:48:02 -08:00
Ryan Delaney 2d4833c73e Rename metavar to clarify required usage syntax 2018-10-28 15:58:14 -07:00
Ryan Delaney 4b8eb6f96a Add required argument to cli parameter 2018-10-28 12:07:03 -07:00
Ryan Delaney efc5b9ecc1 Add missing parameter --allow-missing-credentials 2018-10-28 12:05:42 -07:00
Anthony Sottile e01bc2c2a1 v2.0.0 2018-10-12 19:55:16 -07:00
Anthony Sottile 08e2918d60
Merge pull request #321 from pre-commit/suggest_mirrors_autopep8
Remove autopep8-wrapper in favor of autopep8
2018-10-12 19:23:26 -07:00
Anthony Sottile 99453a5366 Default --no-markdown-linebreak-ext for trailing-whitespace 2018-10-12 18:15:39 -07:00
Anthony Sottile 526904b159 Remove autopep8-wrapper in favor of autopep8 2018-10-11 17:19:35 -07:00
Anthony Sottile 3aa6c641d2
Update README.md 2018-10-10 11:15:13 -07:00
Shakya, Milind 023851e657 Fix readme to correctly reflect no-commit-to-branch args 2018-10-04 17:40:47 -04:00
Anthony Sottile 219c70a9c1 v1.4.0 2018-07-22 09:32:56 -07:00
Anthony Sottile baec308367 Allow multiple branches to be protected
Original patch by @moas
2018-06-09 11:18:33 -07:00
Anthony Sottile ffcda22d77 Suggest https:// git urls
Committed via https://github.com/asottile/all-repos
2018-05-28 10:58:28 -07:00
Anthony Sottile a6209d8d4f v1.3.0 2018-05-28 10:34:46 -07:00
Anthony Sottile 805530fe29 Update debug-statements description 2018-05-14 09:16:37 -07:00
Michał Sochoń 9e28aaf275 Simplify check, extend README 2018-03-26 00:02:23 +02:00
Anthony Sottile 1bdd699a79
Fix typo 2018-03-19 10:13:18 -07:00
Anthony Sottile a21def36e3 Add an `--unsafe` option to `check-yaml` 2018-03-19 09:28:18 -07:00
Anthony Sottile 92e1570c28 v1.2.3 2018-02-28 09:14:40 -08:00
Anthony Sottile 1b12723c29 v1.2.2 2018-02-28 09:01:18 -08:00
Anthony Sottile 6c9a7e832a v1.2.1-1 2018-02-24 09:39:32 -08:00
Anthony Sottile b1a8062750 v1.2.1 2018-02-19 13:27:08 -08:00
Anthony Sottile 0ddb3b8527 v1.2.0 2018-01-13 17:36:06 -08:00
Anthony Sottile f3ff3316a3
Merge pull request #251 from benwebber/fix/check-builtin-literals-attributes
check-builtin-literals: Ignore function attribute calls
2017-12-10 14:10:22 -08:00
Anthony Sottile 1f262dab15
Document minimum version required for `git-lfs`
Resolves #252
2017-12-04 17:28:46 -08:00
Ben Webber 775867626d check-builtin-literals: Ignore function attribute calls 2017-11-30 18:33:36 +00:00
Ben Webber 35996b7a25 Add check to enforce literal syntax for Python builtin types
This check requires authors to initialize empty or zero builtin types
using the literal syntax (e.g., `{}` instead of `dict()`).

Authors may ignore this requirement for certain builtins using the
`--ignore` option.

Authors may also forbid calling `dict()` with keyword arguments
(`dict(a=1, b=2)`) using the `--no-allow-dict-kwargs` flag.
2017-11-26 00:46:03 +00:00
Anthony Sottile f1e943e6bf v1.1.1 2017-10-19 10:34:23 -07:00
Anthony Sottile 8a98c5e590 v1.1.0 2017-10-12 16:00:22 -07:00
Anthony Sottile e87b81afd9 Add an --allow-multiple-documents option to check-yaml 2017-10-12 15:52:10 -07:00
Anthony Sottile c326dc2fce v1.0.0 2017-10-09 13:17:25 -07:00
Anthony Sottile 9db0a745f6 Add hook for ensuring vcs permalinks 2017-10-06 23:37:13 -07:00
Anthony Sottile dec98f7bc8 v0.9.5 2017-09-27 07:55:32 -07:00
Anthony Sottile efdceb4e40 v0.9.4 2017-09-19 10:26:18 -07:00
Anthony Sottile 9730eb3beb v0.9.3 2017-09-07 19:54:30 -07:00
Morgan Courbet fc8a5b27e9 Add mixed-line-ending hook 2017-09-05 19:30:55 -07:00
Anthony Sottile 78dffcc819 v0.9.2 2017-08-21 10:58:25 -07:00
Dan eebb2e6d87 Update README.md
Fix error in README.md
2017-07-27 15:09:31 -07:00
Anthony Sottile 20209f691b Merge pull request #180 from pre-commit/require_new_autopep8
Require a newer version of autopep8
2017-07-05 12:27:36 -07:00
Anthony Sottile 7192665e31 v0.9.1 2017-07-02 22:27:09 -07:00
Anthony Sottile 16879bcf16 Merge pull request #211 from pre-commit/check-executables-have-shebangs
Add a checker for executables without shebangs
2017-07-02 21:26:06 -07:00
Anthony Sottile 5dbbd4dd08 v0.9.0 2017-07-02 21:21:19 -07:00
Chris Kuehl 13991f09d2 Add a checker for executables without shebangs 2017-07-02 21:14:25 -07:00
Daniel Gallagher 5dd1819e8b Warn users of file-contents-sorter that blank lines are removed and comments are not respected 2017-06-25 15:37:58 -07:00
Daniel Gallagher d188f2ecf8 Merge branch 'master' into file_contents_sorter_hook 2017-06-25 09:39:21 -07:00
Daniel Gallagher b6eff3d39e Add sort-simple-yaml hook (originally private hook from yelp_pre_commit_hooks) 2017-06-23 16:26:00 -07:00
Daniel Gallagher 4af7451154 Update README.md about file-contents-sorter 2017-06-23 11:32:05 -07:00
Anthony Sottile 78818b90cd v0.8.0 2017-06-06 14:26:36 -07:00
Evan Felix a8592669d9 Add a no commit to specific branch hook. (#185)
* add no commit code and config

* add the code

* remove version tweak

* fix logic, remove newline

* add Tests and cleanup testing issues

* remove extraneous modules

* cleanup some pep8 and flake issues

* reorder imports

* more fixes for syntax checking

* code cleanup based off asottile comments

* Use Contractions Properly, alphabatize new hook.

* Adding support for branches with a slash in them.
2017-03-20 10:36:51 -07:00
Anthony Sottile ef7c425a3e Require a newer version of autopep8 2017-03-13 14:34:13 -07:00
Anthony Sottile 6ff0a78460 Change `sha` in readme to be a real value
I noticed in our traffic on pre-commit/pre-commit that there were a lot of hits to [this issue](https://github.com/pre-commit/pre-commit/issues/366) presumably due to copy pasting from this readme.

This should reduce frustration in that regard (we'll have to remember to update this whenever bumping the version).
2017-02-25 12:33:07 -08:00
Anthony Sottile 46251c9523 Fix coveralls badge 2017-02-01 08:30:58 -08:00
Daniel Roschka 53697318ee Fix a typo in the README 2016-12-30 16:53:09 +01:00
Daniel Roschka b0d4cdb1ee Improve searching for configured AWS credentials
The previous approach for finding AWS credentials was pretty naive and
only covered contents of a single file (~/.aws/credentials by
default).

The AWS CLI documentation states various other ways to configure
credentials which weren't covered:
https://docs.aws.amazon.com/cli/latest/topic/config-vars.html#credentials
Even that aren't all ways, a look into the code shows:
https://github.com/boto/botocore/blob/develop/botocore/credentials.py

This commit changes the behavior so the hook will behave in a way
that if the AWS CLI is able to obtain credentials from local files,
the hook will find them as well.

The changes in detail are:
- detect AWS session tokens and handle them like secret keys.
- always search credentials in the default AWS CLI file locations
  ( ~/.aws/config, ~/.aws/credentials, /etc/boto.cfg and ~/.boto)
- detect AWS credentials configured via environment variables in
  AWS_SECRET_ACCESS_KEY, AWS_SECURITY_TOKEN and AWS_SESSION_TOKEN
- check additional configuration files configured via environment
  variables (AWS_CREDENTIAL_FILE, AWS_SHARED_CREDENTIALS_FILE and
  BOTO_CONFIG)
- print out the first four characters of each secret found in files to
  be checked in, to make it easier to figure out, what the secrets
  were, which were going to be checked in
- improve error handling for parsing ini-files
- improve tests

There is a major functional change introduced by this commit:
Locations the AWS CLI gets credentials from are always searched and
there is no way to disable them. --credentials-file is still there to
specify one or more additional files to search credentials in. It's
the purpose of this hook to find and check files for found
credentials, so it should work in any case. As this commit also
improves error handling for not-existing or malformed configuration
files, it should be no big deal.

Receiving credentials via the EC2 and ECS meta data services is not
covered intentionally, to not further increase the amount of changes
in this commit and as it's probably an edge case anyway to have this
hook running in such an environment.
2016-12-30 08:41:24 +01:00
Anthony Sottile 96fb7fa10f Document pretty-format-json. Resolves #156 2016-12-07 10:44:29 -08:00
Chris Kuehl 4b928ab06b Add forbid-new-submodules to hooks.yaml 2016-11-30 10:25:51 -08:00
Anthony Sottile b4a9600fa5 Document `--indent` for pretty-format-json 2016-08-22 14:23:23 -07:00
Anthony Sottile 03bf17f2b0 Add a --remove option to fix-encoding-pragma 2016-04-27 11:18:14 -07:00
Anthony Sottile ea867c2e68 Merge pull request #109 from mattclegg/no-sort-keys
Adding no-sort-keys to pretty_format_json
2016-04-14 08:11:26 -07:00
Anthony Sottile fe9c404019 Forbid files with a UTF-8 BOM 2016-03-18 10:59:31 -07:00
Sébastien Larivière f769c208bc Addding no-sort-keys to pretty_format_json, this allows to disable the sort on the keys 2016-03-12 17:04:33 -05:00
Anthony Sottile 64943e8641 Add metadata for check-symlinks 2016-01-15 07:47:33 -08:00
Simon Boudrias 3284a1aa57 Fix code syntax in README 2015-12-01 15:42:07 -08:00
Anthony Sottile aa2ba6f94f Add encoding pragma hook. Resolves pre-commit/pre-commit#15 2015-11-13 12:39:43 -08:00
Anthony Sottile 44fbe61e3d Update description about autopep8. Closes #83 2015-10-18 12:36:14 -07:00
Anthony Sottile 8a8aaf5a60 Add a hook to verify python ast. 2015-08-04 13:48:30 -07:00
Anthony Sottile 99574324eb Merge pull request #60 from arahayrabedian/master
AWS credential checking
2015-06-17 11:46:15 -07:00
Ara Hayrabedian 993c05be65 update readme to reflect that we no longer check for access keys, only secrets 2015-06-13 16:32:30 +04:00
Léo Cavaillé 55bf22dc4a Add new hook pretty-format-json
This new hook allows to standardize one's JSON files (sorted key/4
spaces indent).
By default it just fails if any file is not complying with the standard,
but you can also pass the arg `--autofix` and the hook will
pretty-format the file itself.

Good in use combined with the `check-json` hook.
2015-06-11 00:08:03 -04:00
Ara Hayrabedian 95bf20d52d add aws credential checking ONLY FOR YOUR OWN credentials if they're set in a configurable credentials file (AWS CLI tools' native format) 2015-06-01 23:16:51 +04:00
Alexander Dupuy a6023ac0d7 Implement Markdown trailing space line break preservation
Markdown uses two or more trailing spaces on a line to indicate a forced
line break `<br/>` - these will be preserved for files with a markdown
extension (default = `.md` or `.markdown`).

Add `--markdown-linebreak-ext=X,Y` to add extensions (`*` matches any),
and `--no-markdown-linebreak-ext` to disable this feature.

If you want to set specific extension `foo` only (and not md/markdown),
use `--no-markdown-linebreak-ext --markdown-linebreak-ext=foo`

Tries to prevent --markdown-linebreak-ext from eating filenames as if they were
extensions by rejecting any with '.' or '/' (or even Windows-style '\' or ':')

Update README.md to include information on these arguments as well as
arguments added to other hooks

Add extensive tests using pytest.mark.parametrize

test that `txt` file is not considered as 'txt' extension
test that `.txt` file is not considered as 'txt' extension

The latter is the (correct) behavior of os.path.splitext(), and an example
of why it is better to use the libraries than to mangle strings yourself.
2015-05-11 08:52:32 +02:00
Guy Kisel 779a42919a Add check-merge-conflict hook 2015-03-13 16:30:14 -07:00
Cameron Paul 68a7729327 Detect OpenSSH private keys 2015-03-07 09:35:30 -08:00
Anthony Sottile 9d1ac3273b Update README.md 2015-02-27 07:58:59 -08:00
Anthony Sottile 9f107a0327 v0.4.0 2015-02-22 08:39:33 -08:00
Ken Struys 12f02dfeb8 implemented a basic double quote string fixer 2015-02-08 21:05:12 -08:00
Anthony Sottile 5fe82b3a37 Update README.md 2015-01-19 18:06:06 -08:00
Anthony Sottile ddc9208a5f Add check-xml hook. 2015-01-17 10:30:58 -08:00
gkisel 566b64ab00 Add check-case-conflict to README.md #21 #22 2015-01-13 12:50:31 -08:00
Kent Wills b273a4486f change wording so that people know this hook needs arguments. 2015-01-12 12:23:13 -05:00
Anthony Sottile 53f1dc0163 Add check-docstring-first hook. 2015-01-04 13:06:21 -08:00
Anthony Sottile e0a6e66528 Add check-added-large-files hook 2014-12-31 12:21:21 -08:00
Cameron Paul b83ea591b5 Added requirements.txt hook 2014-12-16 12:39:03 -08:00
Anthony Sottile 86b1c9da8e Add autopep8-wrapper hook. 2014-08-22 11:00:43 -07:00
Anthony Sottile 48294fb9c1 Update README 2014-08-19 17:33:08 -07:00
Anthony Sottile 24609dea4a Update readme. 2014-06-18 06:49:45 -07:00
Anthony Sottile 5c7c61673a Add coveralls 2014-06-05 10:02:24 -07:00
Anthony Sottile be8b296a0a Add Travis bling 2014-03-22 18:40:47 -07:00
Anthony Sottile cd74dc150c Update link in README 2014-03-13 09:26:06 -07:00