Skip to content

Commit 0c334d9

Browse files
committed
MarkdownBear: Set max_line_length default to None
The introduction of max_line_length with a default of 80 was a breaking change as previously line length was not constrained. This constraint required the use of remark-lint, which caused MarkdownBear to remove all content from files if remark-lint could not be found in NODE_PATH. The default is now again to not check line length, and not use remark-lint unless the .coafile explicitly requests a max_line_length. Fixes coala#1581
1 parent 72bc27f commit 0c334d9

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

bears/markdown/MarkdownBear.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def create_arguments(filename, file, config_file,
6565
horizontal_rule: str='*',
6666
horizontal_rule_spaces: bool=False,
6767
horizontal_rule_repeat: int=3,
68-
max_line_length: int=80):
68+
max_line_length: int=None):
6969
"""
7070
:param bullets:
7171
Character to use for bullets in lists. Can be "-", "*" or "+".
@@ -127,16 +127,23 @@ def create_arguments(filename, file, config_file,
127127
'ruleSpaces': horizontal_rule_spaces, # Bool
128128
'ruleRepetition': horizontal_rule_repeat, # int
129129
}
130-
remark_configs_plugins = {
131-
'maximumLineLength': max_line_length # int
132-
}
130+
remark_configs_plugins = {}
131+
132+
if max_line_length:
133+
remark_configs_plugins['maximumLineLength'] = max_line_length
133134

134135
config_json = json.dumps(remark_configs_settings)
135136
# Remove { and } as remark adds them on its own
136137
settings = config_json[1:-1]
137-
config_json = json.dumps(remark_configs_plugins)
138-
plugins = 'lint=' + config_json[1:-1]
139-
return '--no-color', '--quiet', '--setting', settings, '--use', plugins
138+
139+
args = ['--no-color', '--quiet', '--setting', settings]
140+
141+
if remark_configs_plugins:
142+
config_json = json.dumps(remark_configs_plugins)
143+
plugins = 'lint=' + config_json[1:-1]
144+
args += ['--use', plugins]
145+
146+
return args
140147

141148
def process_output(self, output, filename, file):
142149
stdout, stderr = output

0 commit comments

Comments
 (0)