summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Set version to 3.0.43.0.4Ian Cordasco2016-08-071-1/+1
|
* Handle SyntaxErrors when tokenizing a fileIan Cordasco2016-08-062-8/+5
| | | | Closes #205
* Merge branch 'release-notes/3.0.4' into 'master' Ian Cordasco2016-08-051-1/+1
|\ | | | | | | | | | | | | | | | | 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
| * Set version to 3.0.4 and start release notesIan Cordasco2016-08-051-1/+1
| |
* | Merge branch 'bug/179' into 'master' Ian Cordasco2016-08-055-25/+56
|\ \ | |/ |/| | | | | | | | | | | | | | | | | 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
| * Set-up default attributes for FlakesCheckerbug/179Ian Cordasco2016-08-031-0/+3
| |
| * Serialize Checkers PluginTypeManager to a dictIan Cordasco2016-08-034-25/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Clean up usage of InvalidSyntax exceptionIan Cordasco2016-08-052-4/+9
| |
* | Do not treat AttributeError as if it were an IOErrorWouter Bolsterlee2016-08-051-7/+2
| | | | | | | | | | ...and avoid .strerror altogether since py3 does not have it. See #203.
* | Use str(exc) instead of exc.messageWouter Bolsterlee2016-08-051-1/+1
|/ | | | | ...since on py3 tokenize.TokenError does not have a 'message' attribute. See #203.
* Bump version for v3.0.33.0.3Ian Cordasco2016-07-301-1/+1
| | | | Update release date as well
* Reset Application.formatter attribute in init_reportIan Cordasco2016-07-301-0/+1
| | | | | | | For our Legacy API users, StyleGuide.init_report should reset the formatter attribute before calling Application.make_formatter(). Closes #200
* Re-allow for relative paths for excludeIan Cordasco2016-07-292-5/+10
| | | | | | | | | | | | | | | | | 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
* Open our output file in append mode alwaysIan Cordasco2016-07-291-1/+1
| | | | | | | This avoid overwriting portions of our log output when using Flake8 in verbose mode. Closes #193
* Report errors when run via setuptools.Alex Wood2016-07-291-0/+5
| | | | Closes #199
* Diable multiprocessing behaviour on WindowsIan Cordasco2016-07-292-2/+13
| | | | | | | | 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.
* Allow plugins that are on by default to be ignoredIan Cordasco2016-07-282-4/+10
| | | | | | | | | | | | | | 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
* Raise exception when entry_point not callableMarc Abramowitz2016-07-281-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Sort reports by line and columnFabian Neundorf2016-07-281-1/+1
| | | | | | | 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
* Match noqa for users with explanationsbug/178Ian Cordasco2016-07-281-1/+1
| | | | | | | | This makes the regular expression a bit more complex, and potentially slower, but it will fix the issue where users had noqa comments with colons followed by explanations. Closes #178
* Handle AttributeErrors during parameter aggregationIan Cordasco2016-07-272-5/+41
| | | | | | | | | Plugins do not have their parameters checked in advance, so when we try to aggregate parameters for a plugin, there's a chance it may request an attribute of the FileProcessor that simply does not exist. We catch this and re-raise it but we should also capture it in the checker manager and handle it appropriately there as well.
* Merge branch 'fix-mp-win-3.0' into 'master' Ian Cordasco2016-07-271-8/+11
|\ | | | | | | | | | | | | | | | | | | | | Fix multiprocessing on Windows *Related to:* #184 I'm still running into #179 with this fix but all processes start now at least. BTW the current design is pretty bad regarding memory footprint and bootstrap time as you have to pickle the manager object for *every* subprocess. So this does not only fix multiprocessing on Windows. It improves the multiprocessing design on other platforms, too. See merge request !97
| * Fix multiprocessing on Windowsschlamar2016-07-271-8/+11
| |
* | Merge branch '_job_count_rettype' into 'master' Ian Cordasco2016-07-271-1/+1
|\ \ | |/ |/| | | | | | | | | _job_count always returns an int Trivial change, but `_job_count` always returns an `int`. See merge request !95
| * _job_count always returns an intFichteFoll2016-07-271-1/+1
| |
* | Ensure we're only on Python 2.7Ian Cordasco2016-07-261-1/+1
| | | | | | | | | | As FichteFoll pointed out on IRC, this line could include Python 3s less than 3.2 as well.
* | Update version and release notes for 3.0.23.0.2Ian Cordasco2016-07-261-1/+1
| |
* | Fix handling of logical lines with noqaIan Cordasco2016-07-263-22/+26
| | | | | | | | | | | | | | | | | | | | | | When attempting to centralize all inline NoQA handling in the StyleGuide we inadvertently broke plugins relying on it in combination with checker state. For example, the check for E402 relies both on NoQA and the state to determine if it has seen a non-import line. Placing NoQA on the sole line that is not an import is more elegant than placing it on each of the following import lines. Closes #186
* | Fix zero-indexed column numberingIan Cordasco2016-07-262-2/+6
|/ | | | | We accidentally changed column numbering from one-indexed to zero-indexed.
* Fix project config file discoveryIan Cordasco2016-07-261-8/+5
| | | | | | | | | Flake8 3.0 was stopping once it found the current directory but the historical behaviour (that we didn't intend to break) searched past that (towards root) until it found one of the project/local config file names that could be read. Closes #181
* Update NOQA regular expressionIan Cordasco2016-07-261-1/+1
| | | | | | This allows for other text after `# noqa`. Related to #180
* Merge branch 'bug/180' into 'master' Ian Cordasco2016-07-263-2/+34
|\ | | | | | | | | | | | | | | | | | | | | Handle repeated --quiet options again *Description of changes* Handle `-q`/`--quiet` again. *Related to:* #180 See merge request !89
| * Handle repeated --quiet options againIan Cordasco2016-07-253-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge branch 'bug/180' into 'master' Ian Cordasco2016-07-253-0/+31
|\ \ | |/ | | | | | | | | | | | | | | | | | | Wire-up --statistics again *Description of changes* Make `--statistics` work again *Related to:* #180 See merge request !87
| * 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
* | Set-up and stop our formatterbug/output-fileIan Cordasco2016-07-251-0/+2
|/ | | | | | | Without calling start and stop, our output file is not used by our Formatters and any formatting plugins. 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
|