Commit graph

2506 commits

Author SHA1 Message Date
Ian Cordasco
6f08d9d4a4
Move git integration into flake8.main
Also add the --install-hook option and plumb it's installation through
flake8.main.vcs's function that understands how to install the desired
VCS integration bits.

Finally, we also mock out the mercurial integration.
2016-06-13 10:33:15 -05:00
Ian Cordasco
8b9b9bbe89
Make a first pass at a git pre-commit hook 2016-06-13 07:15:14 -05:00
Ian Cordasco
9c47fe3c08
Convert flake8.api to a submodule 2016-06-11 16:43:41 -05:00
Michael Penkov
118709a7bd Adding myself to CONTRIBUTORS.txt
I pushed last year
(https://github.com/PyCQA/flake8/pull/2#issuecomment-77674012) and
forgot to add myself.
2016-06-10 11:28:48 +03:00
Ian Cordasco
b10aa91b82
Use function for pep8 plugins
This will make the transition to pycodestyle much easier
2016-06-09 19:57:49 -05:00
Ian Cordasco
107f595d13
Add flake8.api and docs for it
Stub out the primary method people seem to use.
2016-06-08 11:48:36 -05:00
Ian Cordasco
e21628ad82
Update our warning message about Windows 2016-06-07 20:00:16 -05:00
Ian Cordasco
55f10211a3
Check for version of Python on Windows
Certain versions of Python on Windows are capable of using
multiprocessing safely and correctly. Instead of completely disabling
multiprocessing on Windows, this allows us to check for safe versions.

This also updates our internal utility documentation to add missing
functions and add a strongly worded warning about the API of those
functions.
2016-06-07 19:56:41 -05:00
Ian Cordasco
49d1cf953c
Ensure that a file exists before processing it
If we don't check for a file's existence, then we'll find ourselves with
a hung subprocess due to an exception that happens with in it.
2016-06-07 19:37:06 -05:00
Ian Cordasco
2e5c646d74
Exclude our fixtures from Flake8 2016-06-07 19:08:54 -05:00
Ian Cordasco
ba7f4db7e9
Add test fixture that mirrors documented usage 2016-06-07 18:46:58 -05:00
Ian Cordasco
4c0b1cd5e1
Fix tests broken by updating the default ignore list 2016-06-07 18:46:43 -05:00
Ian Cordasco
27dbd61f12
Add documentation around ignoring errors 2016-06-07 18:46:24 -05:00
Ian Cordasco
2cd3ac91d1
Start adding test fixture files
This adds E501 which is actually a poor test. Currently,
pep8.maximum_line_length does its own check for noqa instead of relying
on the Checker. See also: https://github.com/PyCQA/pycodestyle/pull/539
2016-06-07 18:03:58 -05:00
Ian Cordasco
3d512ae2f5
Update default ignore for when we upgrade pep8 2016-06-07 18:03:37 -05:00
Ian Cordasco
8362fa7acd
Add distinction between reported and ignored errors
This allows us to properly exit if no errors were reported (due to,
for example, # noqa).
2016-06-07 18:02:53 -05:00
Ian Cordasco
9ebaa5c69c
Add tests for parse_unified_diff
We could probably use non-git diff fixtures, but those are what we have
for now.
2016-06-07 10:14:45 -05:00
pinguin999
95d9eae378 Per Code Line
How to ignore one code line
2016-06-07 14:41:18 +02:00
Ian Cordasco
02bcbee245
Add --stdin-display-name to modify report output 2016-06-06 19:46:29 -05:00
Ian Cordasco
689562f1e8
Allow reporting on files passed via stdin 2016-06-06 19:42:12 -05:00
Ian Cordasco
59c3ba75e6
Wire up last pieces to make --diff work
To make sure we reduce as much duplication as possible, we parse the
diff output in our main command-line Application. That then takes
responsibility for telling the StyleGuide about the line numbers that
are in the diff as well as telling the file checker manager which files
from the diff should be checked.
2016-06-06 13:03:55 -05:00
Ian Cordasco
0cdde196e8
Add utils.parse_unified_diff function
This will read stdin using utils.stdin_get_value and parse it into
a dictionary similar to pep8/pycodestyle's parse_udiff function.

This differs from that function in the order in which it parses the
diff and also in that it does not try to filter the paths in the diff.
It lets a different level take care of that for it.

This will likely be used to send paths to the FileCheckerManager and
also send the ranges to the StyleGuide so it can filter errors not in
those ranges.
2016-06-06 08:41:22 -05:00
Ian Cordasco
c4f463e4fb
Symlink the contributing docs to CONTRIBUTING 2016-06-04 15:46:51 -05:00
Ian Cordasco
e93091575c
Remove last trailing whitespace 2016-06-04 15:23:31 -05:00
Ian Cordasco
0fbfeb919a
Trim trailing whitespace in contributing docs 2016-06-04 15:19:11 -05:00
Ian Cordasco
0a418f8d1e
Refactor docs requirements into file for RTD 2016-06-04 14:26:37 -05:00
Ian Cordasco
eb9fcac064
Add contributing documentation 2016-06-04 14:18:44 -05:00
Ian Cordasco
699d116fb0
Use correct basepython for docs testenvs 2016-06-04 13:53:02 -05:00
Ian Cordasco
9ecca93a9b
Add more BaseFormatter subclass tests 2016-06-04 13:02:29 -05:00
Ian Cordasco
d477715064
Fix linting issues 2016-06-04 13:02:09 -05:00
Ian Cordasco
9c2e747528
Add tests around BaseFormatter#after_init 2016-06-04 12:39:11 -05:00
Ian Cordasco
250005b100 Use platform independent path separator
When normalizing paths in flake8.utils, we use the os.path.sep constant
to determine if the item is intended to be a path. If Windows users then
have a path like

    foo\bar

Specified, they will get the same behaviour as a *nix user with

    foo/bar
2016-06-03 07:44:41 -05:00
Ian Cordasco
ba2d94888c Add tests for BaseFormatter 2016-06-01 16:56:17 -05:00
schlamar
6922f58ed3 Enable multiprocessing on Windows on unaffected Python versions
The upstream bug in Python is fixed in Python 2.7.11+ and Python 3.2+
2016-06-01 07:40:02 +02:00
Ian Lee
25503452b0 Updated documentation references to pep8 (now pycodestyle) 2016-05-31 11:08:25 -07:00
Ian Lee
1db863e60a Updated package to use pycodestyle
This change was originally triggered by @gvanrossum requeesting
that pep8 (the tool) be renamed to avoid confusion with PEP-8
the document. This request is tracked at:

https://github.com/PyCQA/pycodestyle/issues/466
2016-05-31 11:02:09 -07:00
Ian Cordasco
15043a4ab7 Update our linecache test to correct it 2016-05-30 16:48:30 -05:00
Ian Cordasco
467672fc5c Refactor Error formatting and handling
This allows us to handle --show-source in our formatters by default.

This also adds the physical line information to the Error class instead
of passing it to is_inline_ignored. This allows us to avoid using
linecache in our formatters.
2016-05-30 16:43:11 -05:00
Ian Cordasco
8300e0f97c Update dependency version constraints 2016-05-30 16:00:59 -05:00
Ian Cordasco
f54c0874f8 Handle sdist installation without tox 2016-05-30 16:00:45 -05:00
Ian Cordasco
df0a799c94 Add configparser to pypy testenv 2016-05-30 12:58:15 -05:00
Ian Cordasco
33f982b446 Rely on Python 3.4 backport of configparser
Python 2.7's ConfigParser module does not allow for the behaviour we
have documented for config files in Flake8 3.0. To compensate for that,
we add a dependency on the configparser backport on PyPI for Python 2.7
2016-05-30 12:51:31 -05:00
Ian Cordasco
e9ddf7533b Add template in comments for new options
Also ensure that existing documentation is consistent with the template
2016-05-29 21:04:03 -05:00
Ian Cordasco
4c3d176f9a Add a first pass at documenting cli options 2016-05-29 20:56:30 -05:00
Ian Cordasco
2fcb222ff9 Fix default printing for --exclude help text 2016-05-28 21:09:05 -05:00
Ian Cordasco
89c9ec795e Start adding descriptions of options 2016-05-28 12:20:46 -05:00
Ian Cordasco
466ef2e596 Add example configuration sections to the docs
Add tests to verify our examples do not regress
2016-05-28 12:00:47 -05:00
Ian Cordasco
91e07ebcff Refactor off-by-default plugins and enabling them
We move the logic to add or remove a plugin from the default ignore
list to individual methods on the Plugin class (Plugin#enable,
Plugin#disable) and use that when registering and parsing options.

If the plugin is off-by-default, Plugin#register_options will use
Plugin#disable. When parsing options via Plugin#provide_options, if
the plugin has been specified in --enable-extensions then it will be
re-enabled via Plugin#enable.
2016-05-28 11:57:18 -05:00
Ian Cordasco
50d74e3cce Add more to configuration documentation 2016-05-27 11:03:36 -05:00
Ian Cordasco
a7898e0389 Begin adding user-facing documentation
Especially around invocation and configuration
2016-05-26 13:21:25 -05:00