summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Wire-up --statistics againbug/180Ian Cordasco2016-07-253-0/+31
| | | | | | | I'm not sure where this code went or when, but it disappeared. Let's add it back. Related #180
* Handle multiline strings with '# noqa'Ian Cordasco2016-07-252-6/+8
| | | | | | | | | 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
* Update release notes and version string for 3.03.0.0Ian Cordasco2016-07-241-1/+1
|
* Support functions as file plugins tooFabian Neundorf2016-07-241-5/+7
| | | | | | | | | | | 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.
* Check for alternate_separator only when truthyIan Cordasco2016-07-221-1/+2
| | | | | | | 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.
* Check for both os.path.sep and os.path.altsepIan Cordasco2016-07-221-4/+7
| | | | | | | | | | | | | | | 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
* Fix typo in documentation using `indect`Fabian Neundorf2016-07-211-1/+1
| | | | | | 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.
* Fix up merge request 78Ian Cordasco2016-07-204-42/+43
| | | | | | | | 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.
* Propagate the stdin_display_name to checker and processorLeonardo Rochael Almeida2016-07-204-14/+15
| | | | This way plugins like flake8-putty can have access to the correct filename.
* Allow stdin and directly named files to be excluded from checkLeonardo Rochael Almeida2016-07-202-17/+24
| | | | | | | | | | | | | | 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()
* Merge branch 'legacy-api-tests' into 'master' Ian Cordasco2016-07-191-2/+3
|\ | | | | | | | | | | | | | | | | | | | | Add Legacy API unit tests *Description of changes* Add unit tests around the legacy API. *Related to:* n/a See merge request !76
| * Add a bunch more legacy API testsIan Cordasco2016-07-191-2/+3
| |
* | Fix git config parsingSabbir Muhit2016-07-181-1/+1
|/ | | | | 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
* Add OptionManager#parse_known_argsIan Cordasco2016-07-162-4/+38
| | | | | | | | | | | | | 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
* Use raw strings for docstringIan Cordasco2016-07-141-1/+1
|
* Document Legacy APIIan Cordasco2016-07-141-1/+13
|
* Fix up docstrings and __all__ in api.legacyIan Cordasco2016-07-141-2/+17
| | | | | | 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.
* Run the individual methods in Application#initializeIan Cordasco2016-07-142-1/+12
| | | | | | | | | | | | 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.
* Use statistics in the legacy report classIan Cordasco2016-07-121-1/+6
|
* Add statistics collection to StyleGuideIan Cordasco2016-07-121-0/+3
|
* Add actual tests around statistics moduleadd-statisticsIan Cordasco2016-07-121-23/+40
| | | | | | 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.
* Add the statistics moduleIan Cordasco2016-07-111-0/+101
|
* Handle errors reported in empty filesIan Cordasco2016-07-092-3/+10
| | | | | | | | 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
* Update setuptools integration for setup.cfgbug/163Ian Cordasco2016-07-092-5/+33
| | | | | | | | | | 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
* Handle kwargs passed to get_style_guidebackwards-compat-apiIan Cordasco2016-07-071-0/+10
|
* Fill in most of the legacy APIIan Cordasco2016-07-074-59/+153
| | | | | This does not handle setting custom options via the parameters to get_style_guide.
* Add the skeleton for the LegacyStyleGuideIan Cordasco2016-06-301-0/+47
|
* Update defaultsIan Cordasco2016-06-301-2/+2
| | | | McCabe reports C90* not C* and Flake8 2 used to exclude .eggs and *.egg
* Remove exc_info for logging.exceptionIan Cordasco2016-06-291-1/+1
| | | | It's redundant and the docs say explicitly that it's ignored.
* Revert "Prefer `.flake8` if present for options."Ian Cordasco2016-06-281-3/+1
| | | | | | The intended behaviour already existed. This reverts commit db9d4ad8b4cc2aab1ef8349dc969faa8f589e9cc.
* Iterate over the checkers fewer timesIan Cordasco2016-06-281-4/+17
|
* Bump version for next beta releaseIan Cordasco2016-06-281-1/+1
|
* Fix some logging and logging levelsIan Cordasco2016-06-282-5/+5
|
* Add python and platform details to --versionIan Cordasco2016-06-282-2/+21
| | | | | | | | | | | On Flake8 2.x we added the information about the implementation, version, and operating system to the --version output to make helping users easier. In short they can pretty simply just give us the output from flake8 --version And we can get a lot of the information that we need.
* Handle optional parameters that were never supportedIan Cordasco2016-06-283-12/+32
| | | | | | | | | | | | | | | | | Previously, pycodestyle never introspected the argument names for classes except to require that ``tree`` be an argument it could pass. For Flake8 3.0, we lifted that restriction, but old plugins seem to have cargo-culted their __init__ signature to be def __init__(self, tree, builtins=None): For some yet unknown reason. This was causing an AttributeError. By updating flake8.utils.parameters_for to return a dictionary that indicates whether the parameter is required or not, we can side-step this by simply ignoring the parameter if it has a default value and we cannot provide it. Closes #151
* Enable plugins automatically during registrationIan Cordasco2016-06-283-2/+31
| | | | | | | | Previously the --select was only ever populated to E,F,W,C and so plugins would not be reported when not off-by-default. This adds a tiny shim so that we enable plugins that are not off-by-default and :x :x
* Parse hyphenated config names alsoIan Cordasco2016-06-282-2/+4
| | | | | | | | | | | | | | | Previously Flake8 parsed both max-line-length = 110 And max_line_length = 110 From the config file without issue. When we updated our logic, I forgot to test for that and we lost that behaviour temporarily. Closes #152
* Handle EarlyQuits and KeyboardInterruptsIan Cordasco2016-06-261-0/+4
|
* Search current directory if no paths are specifiedIan Cordasco2016-06-263-6/+26
| | | | | | This fixes a regression in behaviour from 2.x to 3. Closes #150
* Prefer `.flake8` if present for options.Tom Prince2016-06-251-1/+3
| | | | | | If somebody explicitly has a `.flake8` file, presumably they intend to put flake8 configuration in it, so prefer it to the generic `setup.cfg` and `tox.ini` from pycodestyle.
* Merge branch 'origin/proposed/3.0' into master3.0.0b1Ian Cordasco2016-06-251-0/+1
|
* Move flake8 into srcIan Cordasco2016-06-2529-0/+4358
This is an emerging best practice and there is little reason to not follow it