Commit graph

460 commits

Author SHA1 Message Date
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
Ian Cordasco
7730a790f4 Merge branch 'release-notes/3.0.4' into 'master'
Set version to 3.0.4 and start release notes

*Description of changes*

Start tracking release notes for 3.0.4

See merge request !113
2016-08-05 22:58:37 +00:00
Ian Cordasco
a9be6feeae
Set version to 3.0.4 and start release notes 2016-08-05 17:53:53 -05:00
Ian Cordasco
ce94cfea69 Merge branch 'bug/179' into 'master'
Serialize Checkers PluginTypeManager to a dict

*Description of changes*

Try to side-step issues with attributes not being set/updated on plugins when used with multiprocessing and Queues.

*Related to:*  #179, #164 

See merge request !98
2016-08-05 19:58:29 +00:00
Ian Cordasco
f434e9adf5
Clean up usage of InvalidSyntax exception 2016-08-05 06:39:08 -05:00
Wouter Bolsterlee
cddf982a0a Do not treat AttributeError as if it were an IOError
...and avoid .strerror altogether since py3 does not have it.
See #203.
2016-08-05 11:16:27 +02:00
Wouter Bolsterlee
45ae0b9eeb Use str(exc) instead of exc.message
...since on py3 tokenize.TokenError does not have a 'message' attribute.
See #203.
2016-08-05 11:15:04 +02:00
Ian Cordasco
240609edd4
Set-up default attributes for FlakesChecker 2016-08-03 16:48:39 -05:00
Ian Cordasco
e14d0e6352
Serialize Checkers PluginTypeManager to a dict
It seems likely that the multiprocessing module on Windows is not
capable of serializing an object with the structure that we have and
preserving the attributes we dynamically set on plugins (like the
FlakesChecker). To avoid issues like this with all plugins (although
we have only found this on Windows with the FlakesChecker), let's try
serializing the Checkers PluginTypeManager to a dictionary so that the
only object that a Queue is really trying to serialize/deserialize is
the FlakesChecker itself.

Related to #179
2016-08-03 16:48:39 -05:00
Ian Cordasco
0b861e31ef
Bump version for v3.0.3
Update release date as well
2016-07-30 06:58:42 -05:00
Ian Cordasco
22650e5086
Reset Application.formatter attribute in init_report
For our Legacy API users, StyleGuide.init_report should reset the
formatter attribute before calling Application.make_formatter().

Closes #200
2016-07-30 06:42:34 -05:00
Ian Cordasco
63f5f15068
Re-allow for relative paths for exclude
Previously, all testing was done from the directory in which the
configuration file lived, so this bug went unnoticed. However, if you
run Flake8 against its own source from a directory above, you would
notice that the patterns in the exclude config value in tox.ini were
ignored. This is because we (like any reasonable person) are using
relative paths. The path is relative, however, to the directory in
which the configuration file was located. So we keep track of which
directory that is and use that to normalize the paths in the config
file.

Yes, there is an unrelated change to our tox.ini in this commit as
well. ;-)

Closes #194
2016-07-29 19:27:06 -05:00
Ian Cordasco
e93aad6043
Open our output file in append mode always
This avoid overwriting portions of our log output when using Flake8
in verbose mode.

Closes #193
2016-07-29 18:14:14 -05:00
Alex Wood
f4a91f938f Report errors when run via setuptools.
Closes #199
2016-07-29 13:18:57 -04:00
Ian Cordasco
429d8a196e
Diable multiprocessing behaviour on Windows
Due to https://bugs.python.org/issue27649, we cannot continue to
expect multiprocessing to work as we expect and document it on Windows.
As such, we are going to revert back to our previous behaviour of
disabling it across all versions of Python on Windows to provide the
default expected behaviour of Flake8 on that Operating System.
2016-07-29 07:04:37 -05:00
Ian Cordasco
c670217c24
Allow plugins that are on by default to be ignored
Previously, to ensure that plugins on by default were reported, we
added them to the select list. This means that ignoring them became
impossible. To accomodate our reporting logic and a user's ability
to ignore, we need to keep our select and extended select lists
separated.

This allows us to have a better understanding of who is selecting what,
where, and how and make our decision as to whether or not an error
should be reported more wisely.

Closes #195
2016-07-28 19:28:13 -05:00
Marc Abramowitz
d234f22e09 Raise exception when entry_point not callable
E.g.:

```
$ .tox/flake8/bin/flake8 mobileweb
Traceback (most recent call last):
  File ".tox/flake8/bin/flake8", line 9, in <module>
    load_entry_point('flake8', 'console_scripts', 'flake8')()
  File "/Users/marca/dev/git-repos/flake8/src/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/Users/marca/dev/git-repos/flake8/src/flake8/main/application.py", line 316, in run
    self._run(argv)
  File "/Users/marca/dev/git-repos/flake8/src/flake8/main/application.py", line 299, in _run
    self.initialize(argv)
  File "/Users/marca/dev/git-repos/flake8/src/flake8/main/application.py", line 289, in initialize
    self.find_plugins()
  File "/Users/marca/dev/git-repos/flake8/src/flake8/main/application.py", line 143, in find_plugins
    self.check_plugins.load_plugins()
  File "/Users/marca/dev/git-repos/flake8/src/flake8/plugins/manager.py", line 375, in load_plugins
    plugins = list(self.manager.map(load_plugin))
  File "/Users/marca/dev/git-repos/flake8/src/flake8/plugins/manager.py", line 267, in map
    yield func(self.plugins[name], *args, **kwargs)
  File "/Users/marca/dev/git-repos/flake8/src/flake8/plugins/manager.py", line 373, in load_plugin
    return plugin.load_plugin()
  File "/Users/marca/dev/git-repos/flake8/src/flake8/plugins/manager.py", line 173, in load_plugin
    raise failed_to_load
flake8.exceptions.FailedToLoadPlugin: Flake8 failed to load plugin "P999" due to Plugin <module 'teamcity.flake8_plugin' from '/Users/marca/dev/git-repos/teamcity-messages/teamcity/flake8_plugin.pyc'> is not a callable. It might be written for an older version of flake8 and might not work with this version.
```

This is nicer than the previous behavior of raising an obscure `PicklingError` and then hanging.

```
$ .tox/flake8/bin/flake8 mobileweb
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/queues.py", line 268, in _feed
    send(obj)
PicklingError: Can't pickle <type 'module'>: attribute lookup __builtin__.module failed
```

See #164
2016-07-28 11:49:58 -07:00
Fabian Neundorf
ad3b486909 Sort reports by line and column
Originally the reports have been sorted by column and message (without the
error code), so it didn't order after the line number.

Closes #196
2016-07-28 19:25:13 +02:00