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
06d1636
commit 134c05d
Showing
3 changed files
with
40 additions
and
3 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,7 +21,8 @@ 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' | ||
|
@@ -65,7 +66,8 @@ def create_arguments(filename, file, config_file, | |
horizontal_rule: str='*', | ||
horizontal_rule_spaces: bool=False, | ||
horizontal_rule_repeat: int=3, | ||
max_line_length: int=None): | ||
max_line_length: int=None, | ||
check_valid_links: bool=None): | ||
""" | ||
:param bullets: | ||
Character to use for bullets in lists. Can be "-", "*" or "+". | ||
|
@@ -108,6 +110,9 @@ def create_arguments(filename, file, config_file, | |
The number of times the horizontal rule character will be repeated. | ||
:param max_line_length: | ||
The maximum line length allowed. | ||
:param check_valid_links: | ||
Checks if links to headings and files in markdown point to | ||
existing things. | ||
""" | ||
remark_configs_settings = { | ||
'bullet': bullets, # - or * | ||
|
@@ -136,13 +141,16 @@ def create_arguments(filename, file, config_file, | |
# 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 check_valid_links: | ||
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