Commit graph

527 commits

Author SHA1 Message Date
Andrew Drake
b806d122d3 Correct "systema" typo in usage documentation. 2017-01-17 14:58:50 -08:00
Ian Cordasco
a0280240fc
Merge branch 'setuptools-exit' of scop/flake8 2017-01-14 10:33:32 -06:00
Ian Cordasco
d6b1baf8af
Display the local paths from the git hook
Instead of displaying the path to the temporary directory, as we always
have, it's been requested that we instead display the path to the file
that was copied to the temporary directory.

Closes #244
2016-12-20 19:15:18 -06:00
Ian Cordasco
5248cf3c2d
Enable users who want to track all files processed
This adds two new methods to the BaseFormatter class:

- beginning
- finished

These will indicate when Flake8 begins and finishes processing a file.

Closes #251
2016-12-20 19:08:11 -06:00
Ian Cordasco
9b8f038a97
Tidy up last few bits for performance improvement 2016-12-20 18:29:10 -06:00
Philip Witty
55fbdec61c Recreate file_checker_manager since it has references to old style_guide/formatter. 2016-12-15 11:30:10 +00:00
Ville Skyttä
2bc78e62bc Cause system exit only for non-zero exit statuses in setuptools command
See https://github.com/pypa/setuptools/issues/850#issuecomment-265445007
2016-12-08 18:13:03 +02:00
Anthony Sottile
109f5f8888 Simplify and speed up multiprocessing 2016-11-29 09:00:33 -08:00
Lukasz Langa
2f1338c342 Assign missing codes to PyFlakes messages
Some PyFlakes messages weren't covered by unique messages, making them
impossible to select/ignore. This is now fixed.

To ensure we don't regress in the future, a test has been added that fails if
there's any uncovered messages.
2016-11-28 10:34:38 -08:00
Ian Cordasco
e4582ef4e7
Only force files to be included when run from CLI
Previously we added support so users can do:

    $ flake8 bin/executable

But this broke the fact that git hooks shouldn't check things like
reStructuredText doc files. This commit restores that functionality but
will cause bin/executable to be ignored in the git hook. This seems fair
since folks can amend their filename patterns to include it explicitly.

Closes #268
2016-11-23 16:36:26 -06:00
Ian Cordasco
a52aedc0a0
Prepare for 3.3.0 development 2016-11-21 17:46:09 -06:00
Ian Cordasco
a981fe34ed
Update release notes and version string for 3.2.1 2016-11-19 19:34:33 -06:00
Ian Cordasco
ae9e832cc1 Merge branch 'bug/259' into 'master'
Handle SyntaxErrors in a slightly smarter way

SyntaxErrors are strange and mystical beasts. On top of the problems we
encountered previously in GitLab#237, it's now apparent that
SyntaxErrors can also occur across multiple lines (in fact, across the
rest of a file). In the event of a "multi-line" SyntaxError, we need to
determine what row to report and what the column number is.

For now, we're going to use the row number of the first line and limit
the column number to be less than the end of the line. It may not be
perfect, but it is slightly better.

Related-to #237  
Closes #259 

cc @arcanemagus

See merge request !151
2016-11-20 01:29:46 +00:00
Ian Cordasco
78e8165b06
Skip filename pattern check for provided files
By default, when discovering files for users, we use the filename
patterns to determine whether or not we should check that file. However,
when a user provides the path to a file, we should instead skip checking
the name against the filename patterns provided.

For example, in Flake8 2.6 this worked:

    $ flake8 bin/script.py
    $ flake8 bin/script

But prior to this commit only

    $ flake8 bin/script.py

works. This commit will skip the filename pattern check if the user
provides the path explicitly which allows

    $ flake8 bin/script

to work again as expected.

Closes #266
2016-11-19 08:21:36 -06:00
Ian Cordasco
07c187b8d3
Handle SyntaxErrors in a slightly smarter way
SyntaxErrors are strange and mystical beasts. On top of the problems we
encountered previously in GitLab#237, it's now apparent that
SyntaxErrors can also occur across multiple lines (in fact, across the
rest of a file). In the event of a "multi-line" SyntaxError, we need to
determine what row to report and what the column number is.

For now, we're going to use the row number of the first line and limit
the column number to be less than the end of the line. It may not be
perfect, but it is slightly better.

Related-to #237
Closes #259
2016-11-17 17:17:48 -06:00
Ian Cordasco
c50b747a1a
Fix subtle reporting bug for default on plugins
When we refactored our decision process to fix #239, we broke a subtle
corner case where extensions that are not off-by-default are to be
reported.

This further refactors that logic and adds specific tests around it to
ensure it works as expected and doesn't regress.

Closes #257
2016-11-15 19:56:18 -06:00
Ian Cordasco
8e4905279c
Prepare for 3.2.1 development 2016-11-15 19:48:47 -06:00
Ian Cordasco
e727bbb38b
Release 3.2.0 2016-11-14 16:38:27 -06:00
Ian Cordasco
64cbc6559d
Add release notes for 3.1.1
Bump the version string as well
2016-11-14 09:54:58 -06:00
Ian Cordasco
2197c2ea15
Correct exclude paths in git hook
When running the git hook, even though the appropriate config file is
found and processed, the exclude patterns and paths were not being
corrected to account for the temporary directory that we copy the files
into.

Related-to #223
2016-11-13 14:48:18 -06:00
Ian Cordasco
3fecbe177d
Prepare to release 3.1.0 on 2016-11-14 2016-11-12 14:54:32 -06:00
Ian Cordasco
c81a403fef
Exit non-zero if something goes wrong during a run
If we handle an exception, or early exit, or really anything, we should
exit non-zero (and we used to). This was a minor oversight.

Closes #209
Closes #248
2016-11-12 13:43:49 -06:00
Ian Cordasco
72eecbddcd Merge branch 'bug/245' into 'master'
Do not print the source when provided with -q

When users specify any number of -q's on the command-line, we should not
show the source even if they have otherwwise configured Flake8 to do so.

Closes #245

See merge request !140
2016-11-12 01:10:36 +00:00
Ian Cordasco
5dfb93c0d0
Do not print the source when provided with -q
When users specify any number of -q's on the command-line, we should not
show the source even if they have otherwwise configured Flake8 to do so.

Closes #245
2016-11-11 19:06:13 -06:00
Ian Cordasco
1dfd6bae77
Actually remove enabled extensions from ignore list
When we enable a plugin (when it's provided in the --enable-extensions)
plugin, we need to remove it both from the extended default ignore list
and the plain ignore list.

Closes #239
2016-11-09 18:47:57 -06:00
Ian Cordasco
5b1d84f0ec Merge branch 'bug/223' into 'master'
Change how we initialize our git hook application

Look for configuration files in the current directory while checking the
files in the temporary directory.

Closes #223 

Closes #210 

See merge request !136
2016-11-09 18:02:19 +00:00
Ian Cordasco
9139d11760
Exit early if the diff is empty
In case the provided diff is empty, do not run checks against any files,
simply exit.

Closes #226
2016-11-08 21:38:50 -06:00
Ian Cordasco
7320cce02b
Change how we initialize our git hook application
Look for configuration files in the current directory while checking the
files in the temporary directory.

Closes #210
Closes #223
2016-11-08 21:17:24 -06:00
Ian Cordasco
c2ef3c2ce0 Merge branch 'master' into 'master'
Fixed E305: expected 2 blank lines after class or function definition

See merge request !135
2016-11-09 02:32:25 +00:00
Ian Cordasco
35a35c2a61 Merge branch 'pycodestyle21' into 'master'
Add previous_unindented_logical_line attribute

This attribute is introduced in pycodestyle 2.1.0

Closes #246

See: https://github.com/PyCQA/pycodestyle/issues/400

See merge request !134
2016-11-09 02:31:15 +00:00
Ian Cordasco
4f04ca549b
Handle a previously unhandled code scenario
Previously, we didn't handle the case where an error code was implicitly
ignored (by not being in --select) and implicitly selected (by not being
in --ignore). This means we need to update StyleGuide#_decision_for and
StyleGuide#is_user_selected to handle these cases.

Closes #242
Related-to #239
Related-to !132
2016-11-08 20:00:01 -06:00
Ondřej Nový
901869731b Fixed E305: expected 2 blank lines after class or function definition 2016-11-08 20:13:53 +01:00
Yen Chi Hsuan
6595d3a08d Add previous_unindented_logical_line attribute
This attribute is introduced in pycodestyle 2.1.0

Closes #246

See: https://github.com/PyCQA/pycodestyle/issues/400
2016-11-08 23:34:56 +08:00
Ian Cordasco
352a7250b7
Handle empty stdin-display-name values
Apparently, some folks pass an empty string to --stdin-display-name. To
avoid the errors this causes, we need to handle it appropriately.

Closes #235
2016-10-28 07:09:43 -05:00
Ian Cordasco
68a273144e
Fix bug with --enable-extensions
We went through an iteration where we supported --enable-extensions and
then didn't. This adds back our support for --enable-extensions.

Closes #239
2016-10-25 19:28:52 -05:00
Ian Cordasco
a9e15afbf5 Merge branch 'master' into 'master'
Add --tee option to split report output stream.

The `--tee` option allows the linter report to be written to stdout, even
though it is being redirected to a file with the` --output-file` option.
This is useful if I want to store the report in a separate file for later
analysis but also be able to print the output on screen (e.g when running
in a CI environment).

See merge request !90
2016-10-25 21:34:43 +00:00
Ian Cordasco
8dfe38e9e6
Fix up FileProcessor.file_tokens property
We opted to not copy the file_tokens attribute each time it's accessed
in the merge request discussion but it was never reflected in the code.
Further, the attribute had no documentation or docstring, so we've added
that. Finally, we address a personal style nit that I otherwise wouldn't
have picked at.
2016-10-25 12:02:00 -05:00
Ian Cordasco
91a1ce47d6
Merge branch 'file-tokens' of xzise/flake8 2016-10-25 11:57:24 -05:00
Ian Cordasco
941896218d
Change how we apply lazy to the git hook 2016-10-25 05:25:44 -05:00
Ian Cordasco
0285359a14
Merge branch 'patch-1' of skovorodkin/flake8 2016-10-24 06:39:11 -05:00
Ian Cordasco
7998734fe6
Handle SyntaxErrors after new-lines specially
In some cases, when we handle SyntaxErrors we need to ensure that the
column number is correct for a 1-indexed report. In some cases, we also
need to account for the fact that the SyntaxError has happened "after" a
new-line. To extract and alter the row and column numbers, we've moved
the logic to a private static method on the FileChecker object to avoid
an overly complex method.

Closes #237
2016-10-23 07:37:08 -05:00
Ian Cordasco
c17043ff3f Merge branch 'bug/214' into 'master'
Avoid TypeErrors when handling a SyntaxError



See merge request !121
2016-08-28 00:58:19 +00:00
Ian Cordasco
585628875d
Ensure column_number is always an integer
When a SyntaxError is raised, column_number may be None. Unfortunately,
it's not obvious where that None comes from so we must handle it in
handle_error.

Closes #214
2016-08-27 19:53:14 -05:00
Sergey
2eec5060e9 Consider lazy parameter in git.find_modified_files function
Refer to 867727f304/old/flake8/hooks.py (L34)
2016-08-14 22:19:03 +00:00
Ville Skyttä
0f181954fd Spelling fixes 2016-08-13 11:13:37 +03:00
Ian Cordasco
e8cb26895e Merge branch 'feature/207' into 'master'
Add --bug-report flag to help bug reporters

When invoked it will print out JSON that has all of the debugging
information needed by the maintainers to diagnose or reproduce a bug.

Closes #207

See merge request !117
2016-08-11 00:19:58 +00:00
Ian Cordasco
2b77f2d9a0
Bump version to 3.1.0.dev0 2016-08-10 19:14:53 -05:00
Ian Cordasco
aa294d2b38
Set version to 3.0.4 2016-08-07 13:51:58 -05:00
Ian Cordasco
f67f481bee
Add --bug-report flag to help bug reporters
When invoked it will print out JSON that has all of the debugging
information needed by the maintainers to diagnose or reproduce a bug.

Closes #207
2016-08-07 12:31:14 -05:00
Ian Cordasco
78100de8c6
Handle SyntaxErrors when tokenizing a file
Closes #205
2016-08-06 07:44:20 -05:00