summaryrefslogtreecommitdiff
path: root/src/flake8/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Refactor to support the per-file-ignoresIan Stapleton Cordasco2018-10-271-0/+32
| | | | | | Most of the problems with our logic were due to not having the same logic as our exclude parameter. This refactors that out into a separate function so we can confidently achieve that.
* Add support for per-file ignores in configIan Stapleton Cordasco2018-10-251-0/+1
| | | | | | | | | This adds support for rules that ignore violation codes on a per-file basis. This takes a similar functional approach to https://github.com/snoack/flake8-per-file-ignores which allows for glob patterns like the `--exclude` option. Closes #156
* Use black to reformat Flake8Ian Stapleton Cordasco2018-10-201-28/+34
| | | | | Instead of just using Flake8 and pylint to keep Flake8 clean, let's also use black to make it less manual for clean-up.
* Allow our local plugin parsing to accept commasIan Stapleton Cordasco2017-08-091-2/+8
| | | | | By slightly modifying our utility function to parse comma separated lists we can parse local plugins similar to other configuration options.
* Support spaces as error/ignore code separatorsIan Cordasco2017-05-251-1/+2
| | | | Closes #329
* Filter out empty ignore/select codesIan Cordasco2017-05-201-1/+2
| | | | | | | When we parse out our comma separated lists, we should ignore empty strings to avoid them breaking users' expectations. Closes #330
* Don't apply excludes greedily to subdirsAnthony Sottile2017-03-161-1/+1
|
* Modify stdin retriever to detect coding pragmaIan Cordasco2017-02-201-4/+14
| | | | | | | | | | | | 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
* Diable multiprocessing behaviour on WindowsIan Cordasco2016-07-291-1/+11
| | | | | | | | 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.
* 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.
* 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 up merge request 78Ian Cordasco2016-07-201-10/+12
| | | | | | | | 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.
* Allow stdin and directly named files to be excluded from checkLeonardo Rochael Almeida2016-07-201-12/+14
| | | | | | | | | | | | | | 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()
* Add python and platform details to --versionIan Cordasco2016-06-281-0/+17
| | | | | | | | | | | 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-281-8/+15
| | | | | | | | | | | | | | | | | 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
* Search current directory if no paths are specifiedIan Cordasco2016-06-261-6/+12
| | | | | | This fixes a regression in behaviour from 2.x to 3. Closes #150
* Move flake8 into srcIan Cordasco2016-06-251-0/+279
This is an emerging best practice and there is little reason to not follow it