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

#250 - Added support for multi-lined config entries #281

Merged
merged 7 commits into from Sep 18, 2017

Conversation

Projects
None yet
4 participants
@shacharoo
Copy link
Member

shacharoo commented Sep 8, 2017

Thanks for submitting a PR!

Please make sure to check for the following items:

  • Add unit tests and integration tests where applicable.
    If you've added a error code or changed an error code behavior,
    you should probably add or change a test case file under tests/test_cases/ and add
    it to the list under tests/test_definitions.py.
    If you've added or changed a command line option,
    you should probably add or change a test in tests/test_integration.py.
  • Add a line to the release notes (docs/release_notes.rst) under "Current Development Version".
    Make sure to include the PR number after you open and get one.

Please don't get discouraged as it may take a while to get a review.

Solves #250 .

@shacharoo shacharoo requested a review from Nurdok Sep 8, 2017

@@ -7,9 +7,9 @@
from re import compile as re


try: # Python 3.x
try: # Python 2.x
from ConfigParser import RawConfigParser

This comment has been minimized.

@sigmavirus24

sigmavirus24 Sep 8, 2017

Member

Honestly, I would just use the backport from Python 3. The Python 2 version fo ConfigParser is awful.

This comment has been minimized.

@shacharoo

shacharoo Sep 8, 2017

Member

@Nurdok , what say you?

This comment has been minimized.

@Nurdok

Nurdok Sep 11, 2017

Member

Since we crossed to chasm of package dependencies, I think you should use whichever package is best for the job, even if it adds a dependency.

# Dealing with split-lined configurations. The part might begin
# with a whitespace and/or a comment marker.
part = part.strip()
if not part or part.startswith(('#', ';')):

This comment has been minimized.

@sigmavirus24

sigmavirus24 Sep 8, 2017

Member

For example, if you use the backport, this goes away.

@Nurdok
Copy link
Member

Nurdok left a comment

Use the backported pacakge as we discussed.

@@ -1 +1,2 @@
snowballstemmer==1.2.1
configparser==3.5.0

This comment has been minimized.

@Nurdok

Nurdok Sep 11, 2017

Member

You also need to add this to setup.py, only for Python 2.x.


select_string = ('D100,\n'
' #D103,\n'
' D204, D300')

This comment has been minimized.

@Nurdok

Nurdok Sep 11, 2017

Member

Also add a line that has in-line comment, such as:

D301,  # we want to select this
D302
setup.py Outdated
@@ -28,6 +28,7 @@
install_requires=[
'snowballstemmer',
'six',
'configparser;python_version<"3.3"',

This comment has been minimized.

@sigmavirus24

sigmavirus24 Sep 11, 2017

Member

This will break on old enough versions of pip and setuptools which, if I remember correctly, is anyone using Ubuntu between 14.04 and 16.04

This comment has been minimized.

@shacharoo

shacharoo Sep 11, 2017

Member

@Nurdok and I were just discussing it. I saw this and thought about doing it in the setup.py, but it's reeeeeeeeeeeeally gross. Have you encountered that issue before and have an example / boilerplate? 😜

This comment has been minimized.

@shacharoo

shacharoo added some commits Sep 17, 2017

setup.py Outdated

# Do not update the version manually - it is managed by `bumpversion`.
version = '2.0.1rc'


REQUIRES = [
'snowballstemmer',

This comment has been minimized.

@Nurdok

Nurdok Sep 18, 2017

Member

Indentation seems weird here.
Should be:

REQUIRES = [
    'snowballstemmer',
    'six',
]

This comment has been minimized.

@Nurdok

Nurdok Sep 18, 2017

Member

Also, why is REQUIRED capital cased? It's not a constant.

@@ -277,6 +277,29 @@ def foo():
assert 'file does not contain a pydocstyle section' not in err


def test_multiple_lined_config_file(env):
"""Blah."""

This comment has been minimized.

@Nurdok

Nurdok Sep 18, 2017

Member

Oops :)

@Nurdok

Nurdok approved these changes Sep 18, 2017

@Nurdok Nurdok merged commit 6c1cf99 into PyCQA:master Sep 18, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@shacharoo shacharoo deleted the shacharoo:Feature/support-multi-lined-configs branch Sep 18, 2017

@@ -17,6 +17,7 @@ New Features
* Added support for Python 3.6 (#270).
* Specifying an invalid error code prefix (e.g., ``--select=D9``) will print
a warning message to ``stderr`` (#253, #279).
* Configuration files now support multiple-lined entries (#250, #281).

This comment has been minimized.

@peterjc

peterjc Oct 11, 2017

I would suggest "multiple line entries" here (not lined).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment