Commit graph

2506 commits

Author SHA1 Message Date
Leonardo Rochael Almeida
b2b4cae8e3 Allow stdin and directly named files to be excluded from check
For the sake of IDEs, check filename for exclusion even if the file is directly
named in the command line.

Also, if the filename is "-" (stdin) check the provided display name for
exclusion.

Also, avoid calling path checking functions on the "-" filename:

 * fnmatch.fnmatch()
 * os.path.isdir()
 * os.path.exists()
2016-07-20 18:45:01 -03:00
Ian Cordasco
d69cb0564a Merge branch 'document-polyfill' into 'master'
Document flake8-polyfill in compatibility section

*Description of changes*

Document the existence and usage of the flake8-polyfill section.

Closes: #158 
Closes: #161 
Closes: #167 

See merge request !77
2016-07-20 13:49:12 +00:00
Ian Cordasco
8a2e7ff908
Trim trailing whitespace in compat docs 2016-07-20 08:17:33 -05:00
Ian Cordasco
370912988f
Document flake8-polyfill in compatibility section
Yesterday we released the flake8-polyfill package to help with Flake8
compatibility issues. This adds documentation to Flake8 to help people
use that and to guide them towards it.
2016-07-20 08:12:45 -05:00
Ian Cordasco
9f2eac7df1 Merge branch 'legacy-api-tests' into 'master'
Add Legacy API unit tests

*Description of changes*

Add unit tests around the legacy API.

*Related to:*  n/a

See merge request !76
2016-07-19 16:26:42 +00:00
Ian Cordasco
21a6df725b
Add a bunch more legacy API tests 2016-07-19 11:12:51 -05:00
Ian Cordasco
9cbb31b463 Merge branch 'git-config-parsing' into 'master'
Fix git config parsing

Because the `git config --get --bool <option>` external command adds an extraneous newline for readability purposes, that character need to be stripped for proper parsing.

*Related to:*  #170 

See merge request !75
2016-07-19 12:27:25 +00:00
Sabbir Muhit
b712405586 Fix git config parsing
Since the "git config" command adds a newline to the end of its output, the extraneous whitespace needs to be stripped out for proper parsing.

Fixes #170
2016-07-18 22:44:45 -04:00
Ian Cordasco
8b4f12872e
Add more simple tests for the legacy api 2016-07-16 21:06:27 -05:00
Ian Cordasco
6e3107001f
Begin adding tests for the Legacy API 2016-07-16 20:27:07 -05:00
Ian Cordasco
e778c6ebc3 Merge branch 'bug/168' into 'master'
Add OptionManager#parse_known_args

*Description of changes*

Add `parse_known_args` to our `OptionManager` interface so plugin flags can be specified. This provides similar behaviour to argparse's `parse_known_args` method on its `ArgumentParser`. When we transition to argparse, we'll be able to take direct advantage of that.

*Related to:*  #168

See merge request !74
2016-07-16 15:17:16 +00:00
Ian Cordasco
73be9b0e90
Add OptionManager#parse_known_args
If a user specified `--max-complexity` on the command-line, they
would be told that it did not exist. The same would be true of any
option provided by a plugin. This is because we parse the command-line
arguments twice in Flake8 -- the first time to specify the verbosity
and destination for logging, the second time to actually execute Flake8.
Since plugin options are not registered to start with the first time,
they are not valid options. So when we first parse the options, we should
only attempt to parse the ones which we know about.

Closes #168
2016-07-16 10:07:19 -05:00
Ian Cordasco
43df3ecf74
Use raw strings for docstring 2016-07-14 08:18:38 -05:00
Ian Cordasco
ec678de427
Document Legacy API 2016-07-14 08:13:10 -05:00
Ian Cordasco
911c69f0fd
Fix up docstrings and __all__ in api.legacy
If users do `from flake8.api.legacy import *` we only want them to get
get_style_guide imported. The other classes are not meant to be created
by users.
2016-07-14 07:47:10 -05:00
Ian Cordasco
dc05fce516
Run the individual methods in Application#initialize
We need to initialize part of the Application so we can set options
passed by the user, but we also want to delay making things, e.g.,

- Formatter
- Style Guide
- etc.

Until we have the options solidified so we don't have to do annoying
things.
2016-07-14 07:45:08 -05:00
Ian Cordasco
4d6929c8ab Merge branch 'add-statistics' into 'master'
Add the statistics module

*Description of changes*

Start adding support for `--statistics` and legacy `get_statistics` API.

*Related to:*  (Add bug number here)

See merge request !73
2016-07-13 01:07:58 +00:00
Ian Cordasco
2ffcf96b4b
Use statistics in the legacy report class 2016-07-12 20:04:20 -05:00
Ian Cordasco
14cab7e81b
Add statistics collection to StyleGuide 2016-07-12 20:04:04 -05:00
Ian Cordasco
61430951ec
Add more tests around our Statistics class 2016-07-12 19:58:44 -05:00
Ian Cordasco
2d3f062191
Add actual tests around statistics module
Also refactor our statistics module to be a bit smarter and less
namedtuple happy. The Statistic class had no reason to be a tuple,
I have no clue why I wrote it that way last night.
2016-07-12 08:21:57 -05:00
Ian Cordasco
1a722bbe7b
Add empty test file for our statistics module 2016-07-11 20:24:38 -05:00
Ian Cordasco
6cfb292b1b
Add the statistics module 2016-07-11 20:13:41 -05:00
Ian Cordasco
58e67634cd
Add build testenv for future CI work 2016-07-10 09:31:43 -05:00
Ian Cordasco
2dec2ebc6e
Set default python for flake8 testenv 2016-07-10 09:29:57 -05:00
Ian Cordasco
edd84fba52 Merge branch 'bug/157' into 'master'
Handle errors reported in empty files

*Description of changes*

Some plugins return errors in empty files which previously caused an IndexError.

*Related to:*  #157 

See merge request !71
2016-07-10 01:29:17 +00:00
Ian Cordasco
e977c6671a
Update tests for errors with no physical line 2016-07-09 20:26:08 -05:00
Ian Cordasco
57e82688df
Handle errors reported in empty files
Some plugins (e.g., flake8-future-import) report errors for empty
files. Those plugins default to reporting the line number as 1 which
caused earlier versions of Flake8 3.0 beta to crash on an IndexError

Closes #157
2016-07-09 20:21:26 -05:00
Ian Cordasco
7ea6da2d55 Merge branch 'add-empty-test-fixture' into 'master'
Add empty file as a test fixture

*Description of changes*

Related to a bug earlier this week. Add an empty file as a test fixture to make sure we don't break on empty files.

*Related to:*  #157

See merge request !70
2016-07-10 00:54:09 +00:00
Ian Cordasco
8e27f0fbcf
Add empty file as a test fixture 2016-07-09 19:41:47 -05:00
Ian Cordasco
ee44be0c82 Merge branch 'docs/update-plugin-dev' into 'master'
Add new Flake8 classifier to Trove list

*Description of changes*

PyPI added `Framework :: Flake8` to its list of official classifiers. This adds it to the documentation for Plugin Developers.

*Related to:*  N/A

See merge request !69
2016-07-09 21:24:57 +00:00
Ian Cordasco
469da96001
Add new Flake8 classifier to Trove list 2016-07-09 16:16:07 -05:00
Ian Cordasco
2e5100d44c Merge branch 'bug/163' into 'master'
Update setuptools integration for setup.cfg

*Description of changes*

Allow setuptools to parse config options from setup.cfg and pass them along via the attributes on our Flake8 command.

*Related to:*  #163

See merge request !67
2016-07-09 21:10:44 +00:00
Ian Cordasco
f93a3f3c7b Merge branch 'get-option' into 'master'
Use option name provided by the parser

Use the `Option` object returned to get the actual name.

*Related to:* #158

See merge request !68
2016-07-09 20:09:23 +00:00
Fabian Neundorf
fabb13c5d1 Use option name provided by the parser
When calling `add_option` it returns an `Option` object which can return the
primary name of the option via `get_opt_name`. This should be used primarily
in the cross compatible implementation so that the order of parameters does
not matter.
2016-07-09 21:27:19 +02:00
Ian Cordasco
ae794fb46a
Update setuptools integration for setup.cfg
When flake8's config is in setup.cfg, setuptools attempts to set those
options on the command instance. If they don't exist, it fails early
complaining that a specific option does not exist.

This adds this back and does it better than the Flake8 2.x version.

Closes #163
2016-07-09 07:02:27 -05:00
Ian Cordasco
45a57df542 Merge branch 'backwards-compat-api' into 'master'
Backwards Compatibility API

*Description of changes*

Add `flake8.api.legacy` to replace `flake8.engine`'s public API.

*Related to:*  N/A

See merge request !66
2016-07-08 16:08:27 +00:00
Ian Cordasco
1372d0dd1c
Handle kwargs passed to get_style_guide 2016-07-07 17:39:02 -05:00
Ian Cordasco
a4ce229fb6
Fill in most of the legacy API
This does not handle setting custom options via the parameters to
get_style_guide.
2016-07-07 13:29:53 -05:00
Ian Cordasco
41cd67f747
Simplify our test environments 2016-06-30 20:09:46 -05:00
Ian Cordasco
cde783d135
Clean up setup.py a bit 2016-06-30 16:03:02 -05:00
Ian Cordasco
4a05d02ca6
Fix up MANIFEST.in 2016-06-30 15:34:29 -05:00
Ian Cordasco
6a2ad045fa
Add the skeleton for the LegacyStyleGuide 2016-06-30 08:27:32 -05:00
Ian Cordasco
f963641e93
Update defaults
McCabe reports C90* not C* and Flake8 2 used to exclude .eggs and *.egg
2016-06-30 06:54:10 -05:00
Ian Cordasco
6208a4969b
Add README to linters
Add basepythons to dogfood and readme
2016-06-29 19:17:20 -05:00
Ian Cordasco
8f5348136f
Remove exc_info for logging.exception
It's redundant and the docs say explicitly that it's ignored.
2016-06-29 15:22:22 -05:00
Ian Cordasco
5b8a875965
Add 3.0.0b2 release notes 2016-06-28 20:47:44 -05:00
Ian Cordasco
75e1c1efbf
Revert "Prefer .flake8 if present for options."
The intended behaviour already existed.

This reverts commit db9d4ad8b4.
2016-06-28 20:47:16 -05:00
Ian Cordasco
15745558c1
Iterate over the checkers fewer times 2016-06-28 20:27:29 -05:00
Ian Cordasco
d8665435a5
Bump version for next beta release 2016-06-28 20:26:50 -05:00