Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choice type parameters raise AssertionError for config files #561

Closed
xZise opened this issue Jul 24, 2016 · 0 comments
Closed

Choice type parameters raise AssertionError for config files #561

xZise opened this issue Jul 24, 2016 · 0 comments

Comments

@xZise
Copy link

xZise commented Jul 24, 2016

When using Flake8 2.6.2 together with pycodestyle 2.0.0 and zheller/flake8-quotes 0.7.0 I get the following AssertionError if quotes or inline-quotes are defined as parameter:

$ flake8 setup.py 
Traceback (most recent call last):
  File "/home/xzise/.pyenv/versions/3.5.2/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/home/xzise/.pyenv/versions/3.5.2/lib/python3.5/site-packages/flake8/main.py", line 28, in main
    flake8_style = get_style_guide(parse_argv=True)
  File "/home/xzise/.pyenv/versions/3.5.2/lib/python3.5/site-packages/flake8/engine.py", line 234, in get_style_guide
    styleguide = StyleGuide(**kwargs)
  File "/home/xzise/.pyenv/versions/3.5.2/lib/python3.5/site-packages/flake8/engine.py", line 154, in __init__
    self._styleguide = kwargs.pop('styleguide', NoQAStyleGuide(**kwargs))
  File "/home/xzise/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pycodestyle.py", line 1833, in __init__
    arglist, parse_argv, config_file, parser)
  File "/home/xzise/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pycodestyle.py", line 2120, in process_options
    options = read_config(options, args, arglist, parser)
  File "/home/xzise/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pycodestyle.py", line 2076, in read_config
    assert opt_type in ('store_true', 'store_false')
AssertionError

This is because the option's type is choice and that isn't actually handled. It should be handled the same as string as it is handled the same by optparse.

So instead of elif opt_type == 'string': it could just do elif opt_type in ('string', 'choice'):. This will also verify that the choice is actually correct so no additional changes would be required.

sigmavirus24 added a commit to sigmavirus24/pep8 that referenced this issue Jul 25, 2016
There's no need to explicitly check for a string type when parsing the
configuration file. When it's neither an integer or a boolean, the only
value it can logically be is string-like.

Closes PyCQAgh-561
pointlessone added a commit to pointlessone/pep8 that referenced this issue Dec 29, 2016
2.2.0 (2016-11-14)
------------------

Bugs:

* Fixed E305 regression caused by PyCQA#400;
  PyCQA#593

2.1.0 (2016-11-04)
------------------

Changes:

* Report E302 for blank lines before an "async def";
  PyCQA#556
* Update our list of tested and supported Python versions which are 2.6,
  2.7, 3.2, 3.3, 3.4 and 3.5 as well as the nightly Python build and
  PyPy.
* Report E742 and E743 for functions and classes badly named 'l', 'O',
  or 'I'.
* Report E741 on 'global' and 'nonlocal' statements, as well as
  prohibited single-letter variables.
* Deprecated use of `[pep8]` section name in favor of `[pycodestyle]`;
  PyCQA#591

Bugs:

* Fix opt_type AssertionError when using Flake8 2.6.2 and pycodestyle;
  PyCQA#561
* Require two blank lines after toplevel def, class;
  PyCQA#536
* Remove accidentally quadratic computation based on the number of
  colons. This will make pycodestyle faster in some cases;
  PyCQA#314

2.0.0 (2016-05-31)
------------------

Changes:

* Added tox test support for Python 3.5 and pypy3
* Added check E275 for whitespace on `from ... import ...` lines;
  PyCQA#489 / PyCQA#491
* Added W503 to the list of codes ignored by default ignore list;
  PyCQA#498
* Removed use of project level `.pep8` configuration file;
  PyCQA#364

Bugs:

* Fixed bug with treating `~` operator as binary; PyCQA#383
  / PyCQA#384
* Identify binary operators as unary; PyCQA#484 /
  PyCQA#485

1.7.0 (2016-01-12)
------------------

Changes:

* Reverted the fix in PyCQA#368, "options passed on command
  line are only ones accepted" feature. This has many unintended
  consequences in pep8 and flake8 and needs to be reworked when I have
  more time.
* Added support for Python 3.5. (Issue PyCQA#420 &
  PyCQA#459)
* Added support for multi-line config_file option parsing. (Issue
  PyCQA#429)
* Improved parameter parsing. (Issues PyCQA#420 &
  PyCQA#456)

Bugs:

* Fixed BytesWarning on Python 3. (Issue PyCQA#459)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant