Skip to content
Snippets Groups Projects
Commit 73316eb7 authored by Shachar Ohana's avatar Shachar Ohana
Browse files

#250 - Added support for multi-lined config entries

parent 7654dde4
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7,9 +7,9 @@ from collections import Set, namedtuple
from re import compile as re
 
 
try: # Python 3.x
try: # Python 2.x
from ConfigParser import RawConfigParser
except ImportError: # Python 2.x
except ImportError: # Python 3.x
from configparser import RawConfigParser
 
 
Loading
Loading
@@ -453,6 +453,12 @@ class ConfigurationParser(object):
 
try:
for part in code_parts:
# 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(('#', ';')):
continue
codes_to_add = {code for code in codes
if code.startswith(part)}
if not codes_to_add:
Loading
Loading
Loading
Loading
@@ -277,6 +277,29 @@ def test_sectionless_config_file(env):
assert 'file does not contain a pydocstyle section' not in err
 
 
def test_multiple_lined_config_file(env):
"""Blah."""
with env.open('example.py', 'wt') as example:
example.write(textwrap.dedent("""\
class Foo(object):
"Doc string"
def foo():
pass
"""))
select_string = ('D100,\n'
' #D103,\n'
' D204, D300')
env.write_config(select=select_string)
out, err, code = env.invoke()
assert code == 1
assert 'D100' in out
assert 'D204' in out
assert 'D300' in out
assert 'D103' not in out
def test_config_path(env):
"""Test that options are correctly loaded from a specific config file.
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment