Commit graph

297 commits

Author SHA1 Message Date
Anthony Sottile
07c938e1b1 Allow arbitrary binary to pass the private key hook check. Resolves #64 2015-06-11 13:28:10 -07: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
Alexander Dupuy
5c752935fd Refactor check-merge-conflicts tests
Do a straight test of detecting a real merge conflict as generated by git.
Test artificial conflict detection while pending merge without a real conflict.
Test artificial non-conflict non-detection in a resolved merge conflict.
Rename test_does_not_care... function to reflect what we want to care about.
Rename is_in_merge_conflict to is_in_merge since that is what it checks.
2015-05-09 04:29:38 +02:00
Alexander Dupuy
eefc46f901 Don't report markup titles as merge conflicts
Several markup formats, such as Markdown or Re(Structured)Text
can format titles as text with '=' characters as double underlining,
like this:
```
My Page Title
=============

Lorem ipsum...
```

Rather that considering any line starting with seven '=' as a conflict marker,
require a space (or line-ending newline) after the equals.
This could still create a false positive for a seven character title,
like "Problem", but the markup formats generally allow extra '=' characters,
so by formatting the text like this:
```
Problem
========

Not...
```
these pre-commit warnings can be avoided.

Also updates the tests to add newlines for more realistic conflict files
(while a file might not end with a newline, conflict markers will).
Prevent false negative on test_does_not_care_when_not_in_a_conflict()
by making sure that README.md contains a line identical to a conflict string
(exactly seven '=' followed by a newline).
2015-05-09 04:20:38 +02:00
Mike Cooper
edee3f64b9 Add q as a debug statement
q is a debugging tool: https://pypi.python.org/pypi/q
2015-04-10 10:55:33 -07:00
Anthony Sottile
635fa7dd9d Only check merge conflicts on conflict commits 2015-03-20 16:21:02 -07:00
Anthony Sottile
713fab4bc7 Remove dependency on plumbum 2015-03-20 14:15:30 -07:00
Guy Kisel
86d8446800 Fix off by one error in line number enumeration 2015-03-13 16:32:21 -07:00
Guy Kisel
779a42919a Add check-merge-conflict hook 2015-03-13 16:30:14 -07:00
Guy Kisel
db4b8f02f3 Add --django flag to test name checker 2015-03-11 17:44:59 -07:00
Cameron Paul
68a7729327 Detect OpenSSH private keys 2015-03-07 09:35:30 -08:00
Anthony Sottile
d96cef92c9 Respect autopep8 config. Resolves #38. 2015-02-26 18:23:52 -08:00
Anthony Sottile
151d485a81 More naturally sort requirements. 2015-02-12 09:30:17 -08:00
Anthony Sottile
2983d4478f Use the tokenizer for great success 2015-02-10 08:17:35 -08:00
Anthony Sottile
9326fad9c8 Simplify string-fixer 2015-02-09 09:45:58 -08:00
Ken Struys
12f02dfeb8 implemented a basic double quote string fixer 2015-02-08 21:05:12 -08:00
Anthony Sottile
dd9a07daf1 Fix end-of-file-fixer on windows 2015-01-19 16:43:10 -08:00
Anthony Sottile
ddc9208a5f Add check-xml hook. 2015-01-17 10:30:58 -08:00
Anthony Sottile
e1c091a4e3 Use the CLoader when present to validate yaml 2015-01-15 09:44:48 -08:00
Anthony Sottile
9b830ad92e Merge pull request #22 from guykisel/check-case-conflict
Add check_case_conflict hook
2015-01-12 16:44:48 -08:00
gkisel
c682b50749 Add check_case_conflict hook #21 2015-01-12 15:38:22 -08:00
Cameron Paul
f06dfdae7f Print on requirements.txt failure 2015-01-12 13:03:11 -06:00
Anthony Sottile
b08f834d65 Update pre-commit hooks 2015-01-04 16:05:54 -08:00
Anthony Sottile
63f01e99ac Fix name-tests-test 2015-01-04 15:03:56 -08:00
Anthony Sottile
53f1dc0163 Add check-docstring-first hook. 2015-01-04 13:06:21 -08:00
Anthony Sottile
2f1d2bbe5b Remove @entry decorator (and misc cleanup) 2015-01-04 11:08:53 -08:00
Anthony Sottile
9bfa01da81 Merge pull request #16 from pre-commit/large_added_files
Add check-added-large-files hook
2014-12-31 12:34:28 -08:00
Anthony Sottile
e0a6e66528 Add check-added-large-files hook 2014-12-31 12:21:21 -08:00
Anthony Sottile
e3312c773e Use fileinput instead of sed. 2014-12-23 12:05:49 -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
243fe50bc1 Add a hook for checking parseable json. 2014-08-19 16:03:48 -07:00
Anthony Sottile
830ea6d8c8 Give a better message when ast is not parseable. 2014-06-19 17:44:40 -07:00
Anthony Sottile
00d5904b80 Fix pylint. 2014-06-01 16:08:31 -07:00
Anthony Sottile
b80ca9e84a Update project setup. 2014-04-13 22:09:26 -07:00
Anthony Sottile
63b595ec2c check_yaml should not require any arguments. 2014-04-03 22:22:00 -07:00
Anthony Sottile
3e45f53e68 Add a hook for yaml files. 2014-04-03 21:36:03 -07:00
Anthony Sottile
57f1533b84 Added end of file fixer hook. 2014-03-22 21:40:57 -07:00
Anthony Sottile
45741545dc Refactored how entry points work. 2014-03-22 18:21:54 -07:00
Anthony Sottile
12794c1c19 Add some tests for tests_should_end_in_test hook 2014-03-18 21:25:36 -07:00
Anthony Sottile
ab35cd3634 Add name-tests-test hook 2014-03-14 15:42:24 -07:00
Anthony Sottile
acd9eaf6ed Add trailing whitespace fixer. 2014-03-14 15:18:29 -07:00
Anthony Sottile
10c042c99c Fix debug statement hook 2014-03-14 14:51:42 -07:00
Anthony Sottile
4fc86a807b Added debug statement hook. 2014-03-14 14:23:08 -07:00
Anthony Sottile
27291ffa31 Initial commit. 2014-03-13 08:41:35 -07:00