New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MarkdownBear: Add validate-links
plugin
#1919
Conversation
CC @Makman2 |
bears/markdown/MarkdownBear.py
Outdated
|
||
args += ['--use', 'validate-links'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we have an option for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orientate on our InvalidLinksBear
regarding setting names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Makman2 Our InvalidLinkBear
has no such setting. I've also checked the UrlBear
on which the former bear depends.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah if you enable InvalidLinkBear
you definitely want to check invalid links :) In this case this should be optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No No, I meant I've checked the InvalidLinkBear
for a similar setting name. Is the PR good ?
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'coala-devel@googlegroups.com'} | ||
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|$)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this maybe a separate commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
@@ -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 = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rename should be a separate commit
65183c5
to
95e0af0
Compare
95e0af0
to
c1ef443
Compare
bears/markdown/MarkdownBear.py
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm that kinda sounds weird :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed
bears/markdown/MarkdownBear.py
Outdated
@@ -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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use False
instead of None
, we don't need a tri-state for this field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really need filename
, as the linter has use_stdin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, use_stdin
doesn't work with validate-links
use_stdin
though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah write that into the commit message please :D
(the reason why you remove use_stdin
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -50,7 +50,7 @@ | |||
|
|||
|
|||
@generate_skip_decorator(MarkdownBear) | |||
class MarkdownBearMaxLineLengthMessageTest(unittest.TestCase): | |||
class MarkdownBearTest(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for me it's obvious, anyway put the reason into the commit message :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -30,7 +30,7 @@ class MarkdownBear: | |||
|
|||
_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|$)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reason that inside the commit message :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I would rephrase the shortlog to something like Improve result message
or so, as this is the effective reason :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
bears/markdown/MarkdownBear.py
Outdated
|
||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should also rename this to remark_configs
, so it's easier to distinct from remark_lint_configs
?
Up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more commit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, added a commit stating the same
please rebase and address @Makman2 issues :) |
c1ef443
to
fd503ca
Compare
Updated @Makman2 |
bears/markdown/MarkdownBear.py
Outdated
@@ -65,7 +65,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=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just check_links
? Strictly: As only checking valid links won't yield any results, as those are valid, right? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
For the rename commits: Please put the reason of the name-change into the commit body |
fd503ca
to
28be3bb
Compare
Add `validate-links` plugin and since the `validate-links` plugin is incompatible with stdin input, `use_stdin=True` was removed. Closes coala#924
Rename test classname from `MarkdownBearMaxLineLengthMessageTest` to `MarkdownBearTest` because there were a few generic additions to the tests.
Rename `remark_configs_plugins` to `remark_lint_configs` because the latter is more appropriate and future addition of plugins may conflict with the former name.
Improves the result message by modifying the regex and ignoring the non-crucial output obtained from the linter.
Rename to `remark_configs` so it becomes easier to distinguish from `remark_lint_configs`.
28be3bb
to
d6100ce
Compare
@rultor merge |
Closes #924
For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!
Checklist
them.
individually. It is not sufficient to have "fixup commits" on your PR,
our bot will still report the issues for the previous commit.) You will
likely receive a lot of bot comments and build failures if coala does not
pass on every single commit!
After you submit your pull request, DO NOT click the 'Update Branch' button.
When asked for a rebase, consult coala.io/rebase
instead.
Please consider helping us by reviewing other peoples pull requests as well:
cobot mark wip <URL>
to get it outof the review queue.
The more you review, the more your score will grow at coala.io and we will
review your PRs faster!