summaryrefslogtreecommitdiff
path: root/src/flake8/options/manager.py
Commit message (Collapse)AuthorAgeFilesLines
* audit .format(...) callsAnthony Sottile2021-03-301-1/+1
|
* com2annAnthony Sottile2021-03-301-78/+73
|
* clean up TYPE_CHECKING importsAnthony Sottile2021-03-301-2/+4
|
* clean up string_typesAnthony Sottile2021-03-301-6/+4
|
* automatic: pyupgrade --py36-plusAnthony Sottile2021-03-301-10/+19
|
* fix a few small spelling issuesAnthony Sottile2020-09-201-1/+1
| | | | found via `pre-commit try-repo https://github.com/codespell-project/codespell --all-files`
* Fix type='str' optparse optionsAnthony Sottile2020-04-241-0/+2
|
* Fix the type= warning to contain the option nameAnthony Sottile2020-01-161-1/+2
|
* optmanager: Inherit options from parent argument parsersEric N. Vander Weele2019-10-251-3/+13
| | | | | | Allow for including options from parent `argparse.ArgumentParser` objects in preparation of splitting out the handling of preliminary options from the `OptionManager`.
* Type annotate flake8.options.managerAnthony Sottile2019-09-071-89/+124
|
* Set configuration file-provided values via ArgumentParser.set_defaults()Eric N. Vander Weele2019-08-311-1/+3
| | | | | | | | | | | | | | When calling `ArgumentParser.parse_args()` with the `namespace` argument, command-line options are just added to the namespace without going through any of the argument parsing and type conversion logic (e.g., the `type` keyword argument of `ArgumentParser.add_argument()`). In other words, it is assumed that a namespace is well-formed from a previous invocation of `ArgumentParser.parse_args()`. The `values` parameter is intended to be values already-provided from configuration files. To take advantage of the logic defined by `ArgumentParser.add_argument()`, utilize `ArgumentParser.set_defaults()` instead.
* Add typing to `OptionManager.parse_args()`Eric N. Vander Weele2019-08-311-3/+11
| | | | | Note that the `assert` is necessary to "cast" `self.parser` since it is specified as a `Union`.
* Add typing to `OptionManager.parse_known_args()`Eric N. Vander Weele2019-08-301-3/+8
| | | | | Note that type casting is necessary given that `self.parser` is annotated as a `Union`.
* Remove unused parameter from `OptionManager.parse_known_args()`Eric N. Vander Weele2019-08-301-2/+2
| | | | | The `values` parameter is not utilized anywhere and can be safely removed.
* Put plugin options into separate argparse groupsAnthony Sottile2019-08-191-2/+15
|
* move from optparse to argparseAnthony Sottile2019-08-171-109/+187
|
* Normalize option values additionally by typeEric N. Vander Weele2019-07-281-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Now that the contract has narrowed for `utils.normalize_paths()` and `utils.parse_comma_separated_list()`, `Option.normalize()` must handle when the option value is either a singular value or a sequence (i.e., `list`) of values. The paths where `Option.normalize()` is called are: 1. options/config.py: `MergedConfigParser.parse_*_config()` There are 3 paths wehre eventually `_normalize_value()` is called. 2. options/manager.py: `OptionManager.parse_args()` For (1), values are coming from the `configparser` module. For (2), values are coming from `optparse.OptionParser`. Rudimentary investigation seems to implicate that `optparse.OptionParser.parse_args()` always returns values in a `list` because it accumulates values. However, for `configparser`, the values are a string due to the key-value nature of the INI format. Given that `Option.normalize()` is the convergence point where normalization of an option occurs, it is acceptable for the method to also handle the parsing comma-separated values and path normalization by the option value's type.
* mypy now passesAnthony Sottile2019-05-191-9/+12
|
* Add support for optparse's 'float' and 'complex' types.ymdatta2018-10-281-0/+4
| | | | | | | This helps normalize_from_setuptools, to handle all optparse's standard-option-types. Fixes #452
* Use black to reformat Flake8Ian Stapleton Cordasco2018-10-201-57/+89
| | | | | Instead of just using Flake8 and pylint to keep Flake8 clean, let's also use black to make it less manual for clean-up.
* Update our plugin registration for debuggingIan Stapleton Cordasco2017-08-081-5/+12
| | | | | This allows us to report whether or not a plugin is local when users provide `flake8 --bug-report` output.
* Fix docstring violationsIan Cordasco2017-05-121-3/+2
|
* Force --version to be reproducibleRaphael Das Gupta2017-01-211-1/+1
| | | | | | | | By ordering the plugins, --version becomes reproducible so that it continuously prints the same output (provided the plugins have not changed). Closes #297
* Add --bug-report flag to help bug reportersIan Cordasco2016-08-071-2/+3
| | | | | | | When invoked it will print out JSON that has all of the debugging information needed by the maintainers to diagnose or reproduce a bug. Closes #207
* Re-allow for relative paths for excludeIan Cordasco2016-07-291-2/+2
| | | | | | | | | | | | | | | | | 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
* Add OptionManager#parse_known_argsIan Cordasco2016-07-161-3/+37
| | | | | | | | | | | | | 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
* Update setuptools integration for setup.cfgbug/163Ian Cordasco2016-07-091-0/+13
| | | | | | | | | | 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
* Add python and platform details to --versionIan Cordasco2016-06-281-2/+4
| | | | | | | | | | | 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.
* Enable plugins automatically during registrationIan Cordasco2016-06-281-2/+13
| | | | | | | | 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-281-1/+3
| | | | | | | | | | | | | | | 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
* Move flake8 into srcIan Cordasco2016-06-251-0/+256
This is an emerging best practice and there is little reason to not follow it