Skip to content

Commit

Permalink
MarkdownBear: Verify the config_file
Browse files Browse the repository at this point in the history
If the config_file is provided, all other options are ignored.

Closes #925
  • Loading branch information
Nosferatul committed Nov 14, 2016
1 parent 3b73a58 commit c532de2
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions bears/markdown/MarkdownBear.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import json

from coalib.bearlib.abstractions.Linter import linter
from coalib.bearlib.abstractions.Linter import
_create_linter.LinterBase.generate_config
from coalib.bears.requirements.NpmRequirement import NpmRequirement


@linter(executable='remark',
use_stdin=True,
output_format='corrected',
result_message='The text does not comply to the set style.')

@staticmethod
def generate_config(filename, file):
return filename


class MarkdownBear:
"""
Check and correct Markdown style violations automatically.
Expand Down Expand Up @@ -101,7 +109,10 @@ def create_arguments(filename, file, config_file,
"ruleRepetition": markdown_horizontal_rule_repeat, # int
}

config_json = json.dumps(remark_configs)
# Remove { and } as remark adds them on its own
settings = config_json[1:-1]
return '--no-color', '--quiet', '--setting', settings
if config_file:
return '--no-color', '--quiet', '--setting', config_file
else:
config_json = json.dumps(remark_configs)
# Remove { and } as remark adds them on its own
settings = config_json[1:-1]
return '--no-color', '--quiet', '--setting', settings

0 comments on commit c532de2

Please sign in to comment.