Commit graph

917 commits

Author SHA1 Message Date
Ian Cordasco
1de71fbe89
Set a default value for --select
This allows us to add --append-to-select and --append-to-ignore at a
later date that will work as expected and in a consistent manner.
2016-06-16 08:27:28 -05:00
Ian Cordasco
023de21fe2
Find filenames for mercurial hook
Extract the files changed in a particular commit or set of commits
for the commit and qrefresh mercurial hooks.
2016-06-16 07:20:09 -05:00
Ian Cordasco
eff77e2bc2
Set a lower-limit on flake8-docstrings
flake8-docstrings is broken on 0.2.6 with flake8 2.6.0, 0.2.7 was
released today which fixes the problem. Let's avoid that version if at
all possible.
2016-06-16 06:35:51 -05:00
Ian Cordasco
29896e648a
Use a template for git pre-commit hook
Previously, we forced Flake8 to be installed in whatever Python
environment that the user was using. This allows someone to use Flake8
from a virtual environment, e.g., if you use the tox.ini from this
commit, you can do:

    tox -e venv -- flake8 --install-hook git

And that will allow you to use the Python and Flake8 from
./.tox/venv/bin/python. This means that you can avoid installing
Flake8 globally and still have a working commit hook.
2016-06-16 06:30:07 -05:00
Ian Cordasco
07101231d9
Ensure that the directories exist
If we create our temporary directory structure for our files, we need
to ensure that all the directories (including the ones in the filename)
exist before we copy the contents to that location.
2016-06-16 06:29:04 -05:00
Ian Cordasco
27eb975411
Properly unpack stdout and stdin
subprocess.Popen#communicate returns (stdout, stdin) but we were only
unpacking stdout from it causing an exception.
2016-06-16 06:27:45 -05:00
Ian Cordasco
a4b0793bf7
Use correct stat module constant
Previously we were using stat.IROTH instead of stat.S_IROTH. I must
have been thinking about retirement. ;-)
2016-06-16 06:26:02 -05:00
Ian Cordasco
b1f039a476
Add information about new --verbose behaviour 2016-06-15 09:20:26 -05:00
Ian Cordasco
25502f6ade
Add note about # noqa: <errors> 2016-06-15 07:48:46 -05:00
Ian Cordasco
3af48abac6
Remove CHANGES.rst 2016-06-14 20:48:44 -05:00
Ian Cordasco
29419b0ac3
Start a changelog entry for 3.0.0 2016-06-14 20:48:04 -05:00
Ian Cordasco
e2ef07fe80
Copied one too many lines from template 2016-06-14 20:47:35 -05:00
Ian Cordasco
8bb3048775
Add documentation for --install-hook 2016-06-14 20:43:00 -05:00
Ian Cordasco
8a18cfa4a3
Add documentation around specifying a format string 2016-06-14 20:10:09 -05:00
Ian Cordasco
18d6e6264c
Revert silliness around setting choices for --format
If we restrict the user's ability to specify a format string, we break
existing workflows.
2016-06-14 20:04:52 -05:00
Ian Cordasco
472e7c9589
Add release notes portion of documentation 2016-06-14 09:58:24 -05:00
Ian Cordasco
706520828d
Fix documentation build 2016-06-14 09:57:49 -05:00
Ian Cordasco
deb59817cf
Use the same interface for vcs installation
flake8.main.git.install was already returning False if it couldn't
find the directory to install into. This makes mercurial.install do
the same thing and allows the vcs.install callback to understand that.
2016-06-14 08:04:13 -05:00
Ian Cordasco
84456866a5
Fix integration tests 2016-06-14 08:03:48 -05:00
Ian Cordasco
3cd8ef7d34
Add docstrings and a new-line for pydocstyle 2016-06-14 08:02:54 -05:00
Ian Cordasco
dc8fc0058d
Configure bandit to ignore subprocess warnings 2016-06-14 07:58:13 -05:00
Ian Cordasco
6dca1d6fd7
Start fleshing out mercurial hook
This also reports errors with hook installation using exceptions and
includes far more exceptions for mercurial since it has more failure
modes.
2016-06-13 20:36:44 -05:00
Ian Cordasco
53438fca1d
Refactor parts of flake8.main.cli into separate modules 2016-06-13 20:36:22 -05:00
Ian Cordasco
de587a9ccb
Correct usage of tempfile
The stdlib module is tempfile not tempdir ;-)
2016-06-13 10:43:46 -05:00
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
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
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