Commit graph

379 commits

Author SHA1 Message Date
Ian Stapleton Cordasco
a3a2539a23
Fix-up new I202 violations 2017-11-26 11:25:06 -06:00
Carl Meyer
dd1e9d1cb7 Use default comma-separated regex for local-plugin paths. 2017-10-25 08:57:46 -07:00
Carl Meyer
423980164b Add paths option in local-plugins config file. 2017-10-24 19:58:18 -07:00
Ian Stapleton Cordasco
8acf55e0f8
Prepare for v3.5.0 release on 2017-10-23 2017-10-21 07:25:12 -05:00
Anthony Sottile
bbe8d6d6c6 Catch UnicodeDecodeError while parsing config files 2017-10-09 09:52:37 -07:00
Ian Stapleton Cordasco
222f0a8115
Allow our local plugin parsing to accept commas
By slightly modifying our utility function to parse comma separated
lists we can parse local plugins similar to other configuration options.
2017-08-09 19:35:01 -05:00
Ian Stapleton Cordasco
156f90369f
Update our plugin registration for debugging
This allows us to report whether or not a plugin is local when users
provide `flake8 --bug-report` output.
2017-08-08 08:54:40 -05:00
Ian Stapleton Cordasco
d5dfd1180d Merge branch 'issue/362' into 'master'
Lint only *.py files with --diff option

Closes #362

See merge request !206
2017-08-08 12:40:27 +00:00
Josef Skladanka
bf25fef7eb Lint only *.py files with --diff option
When using the `--diff` option flake8 only lints *.py files or files
defined by the `--filename` filter.

Fixes #362
2017-08-08 06:27:54 +02:00
Carl Meyer
54a8a551b3 Fix finding of local config files. 2017-08-07 17:57:25 -07:00
Ian Stapleton Cordasco
3169b6072b Merge branch 'local-plugins' into 'master'
Add support for local (in-repo, non-setuptools) plugins.

Closes #357

See merge request !197
2017-08-07 11:19:30 +00:00
Ian Stapleton Cordasco
1f0e6a6ffa Merge branch 'hook_conf' into 'master'
Tell user how to configure VCS hooks

See merge request !198
2017-08-07 10:56:37 +00:00
Peter Cock
12660a6fb7 Remove trailing new line; insert raises 2017-08-07 11:39:18 +01:00
Carl Meyer
18c0b14b5c Append [local] to version of local plugins. 2017-08-06 20:57:04 -07:00
Carl Meyer
2cadc060d3 Don't load local plugins from user config. 2017-08-06 20:47:02 -07:00
Carl Meyer
f82aab5820 Minor argument changes. 2017-08-06 20:46:46 -07:00
Ian Stapleton Cordasco
778ddf3ce1
Prepare master branch for development of 3.5.0 2017-08-06 14:02:58 -05:00
Peter Cock
9457d84cfd Tell user how to configure VCS hooks.
Also fills out the hg install hook docstring.

This would close GitLab issue #335.
2017-08-04 11:47:50 +01:00
Carl Meyer
06a5e19769 Handle argv being None. 2017-08-03 11:05:33 -07:00
Carl Meyer
4e58068657 Add support for local (in-repo, non-setuptools) plugins.
Closes #357
2017-08-03 00:25:37 -07:00
Ian Stapleton Cordasco
ec996ffd85
Allow spaces in # noqa lists
To match our new configuration file format and its allowance for spaces
in the list

Closes #356
2017-07-28 19:31:32 -05:00
Ian Stapleton Cordasco
411edfa6f9
Bump version to 3.4.1 and add release notes 2017-07-28 06:15:49 -05:00
Ian Stapleton Cordasco
a44a09f87a
Remediate one wafer thing decision logic bug
Previously we were hitting the catch-all return that decided the error
was selected. Instead, let's add specific logic since we now know how we
would hit that and we actually don't want it to be selected.

Closes #354
2017-07-28 06:10:12 -05:00
Ian Stapleton Cordasco
0239f15dcc
Release v3.4.0 2017-07-27 18:57:29 -05:00
Ian Stapleton Cordasco
a0dabc1d42
Merge branch 'fix-quiet' 2017-07-27 18:44:39 -05:00
Shinya Kawaguchi
55e85b4b50
Fix quiet/verbose config problem 2017-07-27 18:44:08 -05:00
Ayman Nedjmeddine
43e2648ac3 Removed unused imported module os form flake8.main.git._HOOK_TEMPLATE 2017-07-27 10:59:49 +00:00
Ian Cordasco
ff07ca3ed9
Add some better comments for decision logic 2017-06-04 15:07:10 -05:00
Ian Cordasco
86e1fb6e64
Pull decision making out of decision_for
Also, this further highlights why naming methods is so hard. I can't
think of a better name for 'more_specific_decision_for' that isn't
wildly long and unnecessarily verbose.
2017-06-04 14:50:20 -05:00
Ian Cordasco
92c367dee4
Rename style_guide.Error to style_guide.Violation
Move all Violation related methods from the StyleGuide to our Violation
class.
2017-06-04 07:57:28 -05:00
Ian Cordasco
65107a5624
Rename methods on the new DecisionEngine
Rename `decision_for` to `more_specific_decision_for` and
`should_report_error` to `decision_for`.
2017-06-03 19:20:46 -05:00
Ian Cordasco
7fef0af0f5
Refactor decision logic into its own object
In dealing with the decision logic in the StyleGuide recently I
recognized that the logic really doesn't belong strictly on the
StyleGuide. A separate object makes perfect sense especially from the
perspective of testability. This is a minor refactor intended solely to
facilitate further testing and perhaps making the logic easier to
understand for others.
2017-06-01 20:36:37 -05:00
Ian Cordasco
feec0754bd
Add debugging utility for FileChecker 2017-06-01 20:06:34 -05:00
Ian Cordasco
fec980a856 Merge branch 'bug/318' into 'master'
Further improve our handling of --select and --ignore

Closes #318

See merge request !187
2017-05-28 01:41:13 +00:00
Ian Cordasco
aefa79535f
Simplify conditoinal in decision logic
Add test to cover branch of decision logic we were not previously
exercising
2017-05-27 20:34:04 -05:00
Ian Cordasco
2baaf00e83
Further refine our logic handling selection
There was a *very* subtle bug in how we handle blanket select statements
with error codes that are in our DEFAULT_IGNORE. In the specific case,
users were specifying ``--select E`` and E126 was not being properly
reported. This unveiled further logic bugs as we refined this.

Closes #318
2017-05-27 19:22:38 -05:00
Jon Dufresne
db4f71288e Prefer iter(dict) instead of dict.keys()
They are equivalent for iterating so remove the additional function
call.

Pattern identified as outdated by Lennart Regebro's PyCon 2017 talk
"Prehistoric Patterns in Python"

https://www.youtube.com/watch?v=V5-JH23Vk0I
2017-05-27 11:54:06 -07:00
Ian Cordasco
a42299d008
Support spaces as error/ignore code separators
Closes #329
2017-05-25 20:07:48 -05:00
Ian Cordasco
25566468a2
Filter out empty ignore/select codes
When we parse out our comma separated lists, we should ignore empty
strings to avoid them breaking users' expectations.

Closes #330
2017-05-20 20:26:27 -05:00
Jon Dufresne
541bac6a82 Clean up some uses of set, list, and dict
* Use set literals instead of set([...])
* Avoid list(sorted(...)) as sorted returns a list
* Replace dict() with dict literal
2017-05-13 07:14:41 -07:00
Ian Cordasco
c62de6acc3
Make formatting plugin logic easier to test
By splitting out the logic to retrieve and return the formatting class
for an application, we can test it more easily and increase our test
coverage of this critical logic.

Refs #320
2017-05-13 08:00:43 -05:00
Ian Cordasco
15ddc3aa2e
Handle missing default formatter
In the event that we cannot load our plugins, we shouldn't raise a
cryptic KeyError from our formatter.

Closes #320
2017-05-13 06:52:08 -05:00
Ian Cordasco
32f4b65b6b
Fix docstring violations 2017-05-12 20:34:15 -05:00
Anthony Sottile
0559e0b43c Don't apply excludes greedily to subdirs 2017-03-16 13:44:33 -07:00
Ian Cordasco
733a4f053b Merge branch 'bug/306' into 'master'
Modify stdin retriever to detect coding pragma

Closes #306

See merge request !177
2017-03-01 12:40:31 +00:00
Ian Cordasco
879d3fc0d7
Modify stdin retriever to detect coding pragma
When we read in a file on Python 3, we use the tokenize module to detect
the coding pragma at the top of the file. We then use that to decode the
rest of the file. However, when we were receiving stdin, we would not do
that.

This updates ``stdin_get_value`` in a backwards compatible way to check
for that coding pragma and then fall back to UTF-8 if necessary.

Closes #306
2017-02-20 07:38:28 -06:00
Ian Cordasco
a98ec12bc6 Merge branch 'legacy_api_custom_formatter' into 'master'
Make init_report in legacy_api correctly replace all references to old formatter.

See merge request !161
2017-02-08 12:40:43 +00:00
Ian Cordasco
218a0b6980
Release v3.3.0
Closes #300
2017-02-06 13:46:51 -06:00
Ian Cordasco
49fcbf468d
Do not run git-hook checks when there are no files
Apparently there are some cases where the git hook will not find files
to run the checks against (e.g., when amending a commit message). In
those cases, it's best not to attempt to run any checks and to allow the
hook to exit successfully.

Closes #303
2017-01-27 15:57:23 -06:00
Ian Cordasco
7ca05a9ca1
Avoid calling rstrip on None
When we receive a SyntaxError, it is not guaranteed to have a token that
includes the physical line causing the issue. If it does not, we now
will avoid trying to determine the number of rows and columns that are
actually there and default to what the error tells us.

Closes #279
2017-01-27 15:22:49 -06:00