Commit graph

120 commits

Author SHA1 Message Date
Anthony Sottile
c5b7c35d81 Use fixtures for the symlink tests to fix appveyor 2017-09-08 08:35:13 -07:00
Anthony Sottile
fbcd096ea9 Simplify mixed-line-ending hook 2017-09-05 20:25:39 -07:00
Anthony Sottile
47c4d9ebed Fix mixed-line-ending tests on windows 2017-09-05 19:30:56 -07:00
Morgan Courbet
fc8a5b27e9 Add mixed-line-ending hook 2017-09-05 19:30:55 -07:00
Anthony Sottile
2913408db3 debug statements hook works for non-utf8 files 2017-08-14 20:20:32 -07:00
Anthony Sottile
0c5f040a7f Use new git lfs (broken due to lfs returning non-lfs files) 2017-07-26 02:59:08 -07:00
Anthony Sottile
b281d87906 Upgrade pre-commit hooks 2017-07-17 17:41:44 -07:00
Anthony Sottile
e9aea74a77 Upgrade add-trailing-comma to 0.4.1 2017-07-15 13:06:38 -07:00
Anthony Sottile
2a902e0a07 Use asottile/add-trailing-comma 2017-07-12 18:58:30 -07:00
Anthony Sottile
a574f8cb2b Merge pull request #212 from pre-commit/no_gpg_moar
Don't gpg sign during test
2017-07-05 12:30:33 -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
e1ec204be0 Don't gpg sign during test 2017-07-05 12:24:03 -07:00
Chris Kuehl
13991f09d2 Add a checker for executables without shebangs 2017-07-02 21:14:25 -07:00
Anthony Sottile
abea6d293d Use 0.15.0 types 2017-07-02 20:57:10 -07:00
Anthony Sottile
aa50988889 Merge pull request #199 from pre-commit/rebase_conflict
Support rebase conflicts in check-merge-conflicts
2017-07-02 19:43:55 -07:00
Daniel Gallagher
7102e0c8a3 file-contents-sorter should add newline at end of files missing newlines
Make an explicit 'else' path for readability
2017-06-26 08:10:32 -07:00
Daniel Gallagher
7cfec24f77 Fix bug with the file-contents-sorter hook when processing file that does not end in a newline 2017-06-25 14:40:03 -07:00
Anthony Sottile
50871f83cc Merge pull request #206 from dlgallagher/requirements_txt_fixer_followup
Some style tweaks (requirements_txt_fixer)
2017-06-25 14:53:25 -04:00
Daniel Gallagher
844d9830de Some style tweaks 2017-06-25 10:14:58 -07:00
Daniel Gallagher
89ddf17888 Inline tuple parameterized test tuple 2017-06-25 09:48:16 -07:00
Daniel Gallagher
d188f2ecf8 Merge branch 'master' into file_contents_sorter_hook 2017-06-25 09:39:21 -07:00
Anthony Sottile
d419bef35c Merge pull request #205 from dlgallagher/fix_requirements_txt_fixer_on_empty_requirements_files
Fix NoneTypeError when requirements file is empty
2017-06-24 00:35:39 -04:00
Daniel Gallagher
7ccfa05f2f Fix NoneTypeError when requirements file is empty 2017-06-23 17:19: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
05d9c8c805 Make tests pass 2017-06-23 15:10:10 -07:00
Daniel Gallagher
b941d0e6df Respond to review feedback 2017-06-23 14:58:24 -07:00
Daniel Gallagher
4af7451154 Update README.md about file-contents-sorter 2017-06-23 11:32:05 -07:00
Daniel Gallagher
9425c5d6b5 First commit of file-contents-sorter precommit hook 2017-06-23 00:33:13 -07:00
Anthony Sottile
6076fd1b15 Support rebase conflicts in check-merge-conflicts 2017-06-12 10:39:07 -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
ushuz
10f8bd2f22 Add unit test for --no-ensure-ascii option 2017-03-20 20:19:01 +08:00
Oliver Zhou
c380d0b3e3 Handling default django test filename of "tests.py" 2017-03-15 00:40:53 -07:00
Anthony Sottile
ef7c425a3e Require a newer version of autopep8 2017-03-13 14:34:13 -07:00
Anthony Sottile
9cee71b5df Add pyupgrade 2017-03-12 18:01:29 -07:00
Mike Fiedler
312e721ce9
Add flag to detect-aws-credentials to allow missing keys
In the event that there exists no configuration for AWS credentials and
they are not exported in to the current environment, a flag may be
passed to allow exiting the hook successfully.

Resolves #174

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
2017-02-10 12:54:03 -05:00
Anthony Sottile
81147337c5 Only return nonzero when rewriting whitespace 2017-02-07 09:45:31 -08:00
Anthony Sottile
7752c42452 Add .pre-commit-hooks.yaml for forward compatibility
See pre-commit/pre-commit#470
2017-01-21 18:03:59 -08:00
Daniel Roschka
3939aee4a3 Address issues mentioned in review 2017-01-03 19:05:49 +01:00
Daniel Roschka
0fd09bf67a Add AWS_CONFIG_FILE to the environment variables
Turns out there is an additional environment variable AWS_CONFIG_FILE,
which gets evaluated for finding configuration files as well. This
commit adds support for it.
2016-12-30 10:39:38 +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
Daniel Roschka
c549cb25a1 Detect Ed25519 keys as well
Ed255519 keys generated by OpenSSH contain "BEGIN OPENSSH PRIVATE KEY"
as identifier. This commit adds coverage for such keys as well.
2016-12-26 19:09:53 +01:00
Anthony Sottile
70e405ede2 Add a new hook to forbid new submodules 2016-11-30 09:56:42 -08:00
Lucas Cimon
54e83f7ceb Displaying the filename when the check-json hook fails with a UnicodeDecodeError - fix #148 2016-11-12 09:15:10 +01:00
David Brown
e9e9c3d577 add test to show how it works a bit more 2016-11-03 18:05:43 -07:00
dmlb2000
84b1fb6827 let pre-commit fix some stuff 2016-11-03 15:54:48 -07:00
dmlb2000
7f057b0bd5 change the name to show both working and not instead of overwriting the function name 2016-11-03 15:51:24 -07:00
dmlb2000
845a3d5bdf adds top keys list of keys in hashes to put at the top of a hash
This adds custom sorting to preferencially add a list of top keys
at the start of any json hash in the json document
2016-11-03 09:41:23 -07:00
Anthony Sottile
1858edd9da Merge pull request #135 from Lucas-C/master
trailing-whitespace hook: restoring original file in case of failure - fixes #134
2016-08-31 07:35:34 -07:00
Lucas Cimon
cb23c48b0d Post-review fixes 2016-08-31 11:44:59 +02:00
Anthony Sottile
8be6f4c77e Remove pylint 2016-08-22 14:38:49 -07:00