Commit graph

1082 commits

Author SHA1 Message Date
Ian Cordasco
88d9213962
Add release notes for 3.0.1 2016-07-25 19:43:27 -05:00
Ian Cordasco
b9658eaaae Merge branch 'bug/180' into 'master'
Handle repeated --quiet options again

*Description of changes*

Handle `-q`/`--quiet` again.

*Related to:*  #180

See merge request !89
2016-07-26 00:41:08 +00:00
Ian Cordasco
222292c4b2
Handle repeated --quiet options again
Fundamentally on Flake8 2.x using -q altered the format of the errors
(and the behaviour a little) so it makes the most sense to implement
this logic with formatters rather than messy logic spread throughout
the project.

The FilenameOnly formatter will keep track of filenames already reported
and only print the name once while Nothing will print nothing.

Closes #180
2016-07-25 19:38:19 -05:00
Ian Cordasco
667a01f8df Merge branch 'bug/180' into 'master'
Wire-up --statistics again

*Description of changes*

Make `--statistics` work again

*Related to:*  #180

See merge request !87
2016-07-25 19:57:36 +00:00
Ian Cordasco
427c4b53ef Merge branch 'bug/output-file' into 'master'
Set-up and stop our formatter

*Description of changes*

Make `--output-file` work consistently (especially without verbose logging)

*Related to:*  #180

See merge request !86
2016-07-25 19:57:13 +00:00
Ian Cordasco
4dc1d11a62
Wire-up --statistics again
I'm not sure where this code went or when, but it disappeared. Let's
add it back.

Related #180
2016-07-25 14:29:09 -05:00
Ian Cordasco
559e08a09f
Set-up and stop our formatter
Without calling start and stop, our output file is not used by our
Formatters and any formatting plugins.

Related #180
2016-07-25 14:11:53 -05:00
Ian Cordasco
232ef0ed31 Merge branch 'file-plugin-docs' into 'master'
Update documentation to separate parameter types

This is the documentation update separated from !80 which should be pretty uncontroversial. I already applied the comment on the documentation here.

See merge request !83
2016-07-25 18:11:28 +00:00
Ian Cordasco
fc035c4df2 Merge branch 'bug/177' into 'master'
Handle multiline strings with '# noqa'

*Description of changes*

I had overlooked a usecase of Flake8 where people use `# noqa` at the end of a multi-line string. This addresses that oversight

*Related to:*  #177

See merge request !85
2016-07-25 16:08:16 +00:00
Ian Cordasco
299e200cb9
Handle multiline strings with '# noqa'
In Flake8 2.x we allowed people to use # noqa at the end of a multiline
string to ignore errors inside the string (e.g., E501). Being blissfully
ignorant of this, I never accounted for it in Flake8 3. This fixes the
oversight and allows multiline statements to have the # noqa at the end.

Closes #177
2016-07-25 11:00:18 -05:00
Fabian Neundorf
3191c44cfc Update documentation to separate parameter types
It updates the documentation to separate which parameters are static and
which are changed on each line. Using the latter parameters on plugins which
are only run once per file isn't very sensible.
2016-07-25 15:45:44 +02:00
Ian Cordasco
217aa8185c Merge branch 'unbreak-builds' into 'master'
Force flake8 test to below 3.x

The current version (0.8) of `flake8-import-order` still uses `parser.config_options` and so all builds fail because it installs Flake8 3.x.

Now the repository of that plugin already accounted for that but as long as it isn't released it'll cause all new builds to fail. Alternatively I can repurpose this merge request to actually enforce a newer version of `flake8-import-order` which supports Flake8 3.x.

See merge request !84
2016-07-25 12:26:25 +00:00
Fabian Neundorf
777e7e3854 Force flake8 test to below 3.x
Because flake8-import-order does not support Flake8 3.x yet, we need to force
a Flake8 version that is supported.
2016-07-25 13:53:10 +02:00
Ian Cordasco
ff0bf5f0f9
Update release notes and version string for 3.0 2016-07-24 20:11:48 -05:00
Ian Cordasco
455066cd52
Merge branch 'run-functions' 2016-07-24 20:04:59 -05:00
Ian Cordasco
5f9c0bde23
Relocate integration style checker tests 2016-07-24 20:04:48 -05:00
Fabian Neundorf
373eb15573 Support functions as file plugins too
It is possible to write plugins which are only a function. At the moment they
are called on each line manually. This allows the function also to be called
on each file once. It works similar to creating the class and calling `run` on
it immediately. The plugin function needs to return a generator.

This is based on the original comment in the `FileChecker.run_ast_checks`
method, but slightly modified as the original comment would've called the
return of the function. But the function could return the reports directly.
2016-07-24 16:27:05 +02:00
Ian Cordasco
698079f87a Merge branch 'windows-bugs' into 'master'
Check for both os.path.sep and os.path.altsep

*Description of changes*

When normalizing paths, we want to handle the following cases:

- Someone is using a Windows-style path on Windows
- Someone is using a Unix style path on Unix
- Someone is using a Unix style path on Windows

os.path.sep will handle the native directory separator character while os.path.altsep (when set) will handle alternate separators. Further,  os.path.abspath does the right thing on Windows when handed a Unix-style path.

*Related to:*  #175

See merge request !81
2016-07-22 22:16:45 +00:00
Ian Cordasco
4a46412bf6
Check for alternate_separator only when truthy
In the case where alternate separator is None, we use '' which will
always be in any string. We want to skip that case.

Also we only run our tests on AppVeyor, not all of our testenvs.
2016-07-22 17:12:49 -05:00
Ian Cordasco
473106fee1
Check for both os.path.sep and os.path.altsep
When normalizing paths, we want to handle the following cases:

- Someone is using a Windows-style path on Windows
- Someone is using a Unix style path on Unix
- Someone is using a Unix style path on Windows

os.path.sep will handle the native directory separator character while
os.path.altsep (when set) will handle alternate separators. Further,
os.path.abspath does the right thing on Windows when handed a Unix-style
path.

Related to #175
2016-07-22 17:07:52 -05:00
Ian Cordasco
a8753b3ff9
Add AppVeyor config file
Closes #174
2016-07-22 08:26:41 -05:00
Ian Cordasco
c3ee4829ed Merge branch 'fix-typo-indect' into 'master'
Fix typo in documentation using `indect`

Found this typo while working through the source code.

See merge request !79
2016-07-21 16:28:10 +00:00
Fabian Neundorf
965d6f9509 Fix typo in documentation using indect
The documentation for the `FileProcessor` class used `indect_char` while the
class itself uses the more sensible name `indent_char`. This updates both the
docstring as well as the documentation.
2016-07-21 13:59:07 +02:00
Ian Cordasco
1dad1e3a95
Merge branch 'pr/78'
Closes #78
2016-07-20 19:29:32 -05:00
Ian Cordasco
a1fdb5a2b5
Fix up merge request 78
This simplifies the changes, reduces the scope of refactors apparently
for refactoring's sake and ensures that the internals are reasonable.

It also airs on the side of preserving information rather than
discarding or overwriting it.
2016-07-20 19:28:13 -05:00
Leonardo Rochael Almeida
7934f8dce2 Propagate the stdin_display_name to checker and processor
This way plugins like flake8-putty can have access to the correct filename.
2016-07-20 18:45:01 -03:00
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