forked from coala/coala-bears
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MarkdownBear: Add
validate-links
plugin
Closes coala#924
- Loading branch information
1 parent
404db94
commit 65183c5
Showing
3 changed files
with
37 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,16 @@ class MarkdownBear: | |
|
||
LANGUAGES = {'Markdown'} | ||
REQUIREMENTS = {NpmRequirement('remark-cli', '2'), | ||
NpmRequirement('remark-lint', '5')} | ||
NpmRequirement('remark-lint', '5'), | ||
NpmRequirement('remark-validate-links', '5')} | ||
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
CAN_FIX = {'Formatting'} | ||
|
||
_output_regex = re.compile( | ||
r'\s*(?P<line>\d+):(?P<column>\d+)' | ||
r'\s*(?P<severity>warning)\s*(?P<message>.*)') | ||
r'\s*(?P<severity>warning)\s*(?P<message>.+?)(?: .*|\n|$)') | ||
|
||
@staticmethod | ||
@deprecate_settings(bullets='markdown_bullets', | ||
|
@@ -127,22 +128,23 @@ def create_arguments(filename, file, config_file, | |
'ruleSpaces': horizontal_rule_spaces, # Bool | ||
'ruleRepetition': horizontal_rule_repeat, # int | ||
} | ||
remark_configs_plugins = {} | ||
remark_lint_configs = {} | ||
|
||
if max_line_length: | ||
remark_configs_plugins['maximumLineLength'] = max_line_length | ||
remark_lint_configs['maximumLineLength'] = max_line_length | ||
|
||
config_json = json.dumps(remark_configs_settings) | ||
# Remove { and } as remark adds them on its own | ||
settings = config_json[1:-1] | ||
|
||
args = ['--no-color', '--quiet', '--setting', settings] | ||
args = [filename, '--no-color', '--quiet', '--setting', settings] | ||
|
||
if remark_configs_plugins: | ||
config_json = json.dumps(remark_configs_plugins) | ||
plugins = 'lint=' + config_json[1:-1] | ||
args += ['--use', plugins] | ||
if remark_lint_configs: | ||
config_json = json.dumps(remark_lint_configs) | ||
lint = 'lint=' + config_json[1:-1] | ||
args += ['--use', lint] | ||
|
||
args += ['--use', 'validate-links'] | ||
return args | ||
|
||
def process_output(self, output, filename, file): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters