Skip to content

multiple line comma-separated values in INIs handled incorrectly #339

@bartekbrak

Description

@bartekbrak

setup.cfg could also fit within 79 chars, but it is hard when you have many paths to, let's say, exclude:

[pep8]
exclude = long/path/numero1,long/path/numero2,long/path/numero2,long/path/numero3,long/path/numero4,long/path/numero5,long/path/numero6

Most INI parsers allow this:

[pep8]
exclude = long/path/numero1,
    long/path/numero2,
    long/path/numero2,
    long/path/numero3,
    long/path/numero4,
    long/path/numero5,
    long/path/numero6

Not yours:

... 
print options.exclude
['/home/user/project_name/long/path/numero1', '/home/user/project_name/\nlong/path/numero2', ...]

Simple fix:

diff --git a/pep8.py b/pep8.py.org
index dca355b..2823f5b 100644
--- a/pep8.py
+++ b/pep8.py.org
@@ -1143,7 +1143,7 @@ def normalize_paths(value, parent=os.curdir):
     paths = []
     for path in value.split(','):
         if '/' in path:
-            path = os.path.abspath(os.path.join(parent, path.strip()))
+            path = os.path.abspath(os.path.join(parent, path))
         paths.append(path.rstrip('/'))
     return paths

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions