Commit graph

1154 commits

Author SHA1 Message Date
Daniel Quinn
4d9d325d3c Point documentation to http: instead of https:
The certificate at that URL is for `readthedocs.io`, so if you want to use https, it's best to use `flake8.readthedocs.io` and not `flake8.pycqa.org`.  As it is currently, you get a certificate error.

Note also that the `Code of Conduct` and `Getting Started Contributing` links are using `http` and pointing to the insecure domain, so if you do want https, you should change those as well.
2016-08-11 16:11:26 +00: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
f768ed6fd0 Merge branch 'add-code-coverage' into 'master'
Add coverage reporting and uploading



See merge request !116
2016-08-06 20:34:40 +00:00
Ian Cordasco
b995d56e19
Add coverage reporting and uploading
Upload our coverage data to codecov.io and aggregate it on test runs.
2016-08-06 15:21:50 -05:00
Ian Cordasco
d5a6cfcff9 Merge branch 're-add-error-codes' into 'master'
Replace list of violation codes

*Description of changes*

Replace the list of violation codes in the documentation.

*Related to:*  #206

See merge request !115
2016-08-06 13:58:50 +00:00
Ian Cordasco
b0a99d0b63
Replace list of violation codes
Closes #206
2016-08-06 08:28:52 -05:00
Ian Cordasco
690d157d1b
Add release note about handling SyntaxErrors 2016-08-06 08:03:30 -05:00
Ian Cordasco
a8029ba2d5 Merge branch 'bug/205' into 'master'
Handle SyntaxErrors when tokenizing a file

*Description of changes*

This handles the SyntaxErrors raised by tokenize.generate_tokens.

*Related to:*  #205

See merge request !114
2016-08-06 12:59:52 +00: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
1c07453ef7
Merge branch 'bug/203' 2016-08-05 06:45:29 -05: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
9a4abfbcb4 Merge branch 'specify-required-parameters' into 'master'
Document how it determines when the plugin is run

*Description of changes*

If a plugin's target (constructor or function) doesn't satisfy specific parameters, it'll never be called. This documents what the parameters must contain to be run at all.

*Related to:*  #159

See merge request !110
2016-08-05 00:23:40 +00:00
Ian Cordasco
240609edd4
Set-up default attributes for FlakesChecker 2016-08-03 16:48:39 -05:00
Ian Cordasco
c1d21393bf
Set dogfood testenv to Python 3.5
AppVeyor doesn't allow us to use `python3` to select the version of
Python 3.x that is linked as `python3.exe` so we must be explicit.
2016-08-03 16:48:39 -05:00
Ian Cordasco
a98e0d3648
Add dogfood testenv to AppVeyor list 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
7e806824df Merge branch 'update-gitlab-ci' into 'master'
Update GitLab CI configuration

*Description of changes*

Update GitLab CI. After reading [GitLab's blog post](https://about.gitlab.com/2016/07/29/the-basics-of-gitlab-ci/) about their CI system, it seems that we can easily start generating build artifacts for PRs and regular pushes.

*Related to:*  N/A

See merge request !111
2016-08-03 12:41:08 +00:00
Ian Cordasco
75994bf2c9
Use python:2.7 for python 2.7 tests 2016-08-03 07:22:34 -05:00
Ian Cordasco
c8df0f88d1
Update GitLab CI configuration
Let's build artifacts after we've completed a test successfully. This
should allow folks to install the version of Flake8 from a PR easily.
2016-08-03 07:05:22 -05:00
Fabian Neundorf
eae68a41f6 Document how it determines when the plugin is run
If a plugin's target (constructor or function) doesn't satisfy specific
parameters, it'll never be called. This documents what the parameters must
contain to be run at all.

Related to: #159
2016-08-01 14:06:33 +02: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
b02855769b Merge branch 'bug/194' into 'master'
Re-allow for relative paths for exclude

*Description of changes*

Use the directory that the configuration file is found in as the parent (instead of the current working directory) when normalizing paths.

*Related to:*  #194

See merge request !109
2016-07-30 00:42:32 +00: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
e619fd3b20 Merge branch 'bug/193' into 'master'
Open our output file in append mode always

*Description of changes*

*Related to:*  #193

See merge request !108
2016-07-29 23:31:41 +00: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
Ian Cordasco
971dcc16f0 Merge branch 'test-non-callable' into 'master'
Test loading non-callable plugins

*Description of changes*

This is just a simple addition to prevent a regression regarding bug #164 and merge request !101.

*Related to:*  #164, !101

See merge request !106
2016-07-29 17:49:39 +00:00
Ian Cordasco
87c488b9cc Merge branch 'master' into 'master'
Fixes #199: Report errors when run via setuptools.

*Description of changes*

*Related to:*  (Add bug number here)

See merge request !107
2016-07-29 17:49:15 +00:00
Alex Wood
f4a91f938f Report errors when run via setuptools.
Closes #199
2016-07-29 13:18:57 -04:00
Ian Cordasco
f6ef0c0d61 Merge branch 'release_note_for_entry_point_not_callable_fix' into 'master'
Add 3.0.3 release note about GitLab#164

Add 3.0.3 release note about #164

See merge request !103
2016-07-29 17:14:09 +00:00
Marc Abramowitz
40f7041a62 Add 3.0.3 release note about GitLab#164 2016-07-29 10:05:48 -07:00
Fabian Neundorf
78edfdea63 Test loading non-callable plugins
With d234f22 it did not load plugins which aren't callable. This is adding a
basic test to it.
2016-07-29 18:58:12 +02:00
Ian Cordasco
20c619f649 Merge branch 'diable-multiprocessing-on-win' into 'master'
Diable multiprocessing behaviour on Windows

*Description of changes*

Due to https://bugs.python.org/issue27649, while Flake8 can *run* with multiprocessing on Windows, it does not behave as we expect it to behave. To provide the best experience that is in agreement with our documentation, we must disable multiprocessing until https://bugs.python.org/issue27649 is fixed and released.

Closes #184

See merge request !105
2016-07-29 12:16:45 +00: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
530767d36d Merge branch 'bug/195' into 'master'
Allow plugins that are on by default to be ignored

*Description of changes*

Previously, users were unable to ignore the error code of a plugin that was on by default. This adds a tiny bit of extra logic to re-enable that behaviour.

*Related to:*  #195

See merge request !104
2016-07-29 00:43:07 +00: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
Ian Cordasco
c0e5066577 Merge branch 'patch-1' into 'master'
Fix hyperlink in Links.



See merge request !102
2016-07-28 19:23:02 +00:00
Jason R. Coombs
3dd2c90f84 Fix hyperlink in Links. 2016-07-28 19:14:41 +00:00
Ian Cordasco
4fc4df2fc1 Merge branch 'raise_exception_when_plugin_entry_point_is_not_callable' into 'master'
Raise exception when entry_point not callable

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
```

*Related to:*  164

See merge request !101
2016-07-28 19:01:46 +00: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
Ian Cordasco
ebc7ffd4e7 Merge branch 'fix-report-ordering' into 'master'
Sort reports by line and column

*Description of changes*

The reports have been incorrectly sorted. This fixes the sorting order to use the line number and then column. It also adds a test to verify that the sorting algorithm works.

*Related to:*  #196

See merge request !100
2016-07-28 17:56:57 +00: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