Skip to content
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

Merged
merged 5 commits into from Jul 18, 2017
Merged

Conversation

@yash-nisar
Copy link
Member

@yash-nisar yash-nisar commented Jul 14, 2017

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

  • I read the commit guidelines and I've followed
    them.
  • I ran coala over my code locally. (All commits have to pass
    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:

The more you review, the more your score will grow at coala.io and we will
review your PRs faster!

@yash-nisar
Copy link
Member Author

@yash-nisar yash-nisar commented Jul 14, 2017


args += ['--use', 'validate-links']

This comment has been minimized.

@sils

sils Jul 15, 2017
Member

shouldn't we have an option for this?

This comment has been minimized.

@Makman2

Makman2 Jul 15, 2017
Member

orientate on our InvalidLinksBear regarding setting names 👍

This comment has been minimized.

@yash-nisar

yash-nisar Jul 16, 2017
Author Member

@Makman2 Our InvalidLinkBear has no such setting. I've also checked the UrlBear on which the former bear depends. 😉

This comment has been minimized.

@Makman2

Makman2 Jul 16, 2017
Member

Yeah if you enable InvalidLinkBear you definitely want to check invalid links :) In this case this should be optional 👍 Internet accesses aren't always desired by people that want to lint their code 👍

This comment has been minimized.

@yash-nisar

yash-nisar Jul 17, 2017
Author Member

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|$)')

This comment has been minimized.

@Makman2

Makman2 Jul 15, 2017
Member

is this maybe a separate commit?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 16, 2017
Author Member

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 = {}

This comment has been minimized.

@Makman2

Makman2 Jul 15, 2017
Member

the rename should be a separate commit

@yash-nisar yash-nisar force-pushed the yash-nisar:md-validate-links branch from 65183c5 to 95e0af0 Jul 16, 2017
@gitmate-bot gitmate-bot added size/M and removed size/S labels Jul 16, 2017
@yash-nisar
Copy link
Member Author

@yash-nisar yash-nisar commented Jul 16, 2017

@Makman2 @sils How does it look now ?

@yash-nisar yash-nisar force-pushed the yash-nisar:md-validate-links branch from 95e0af0 to c1ef443 Jul 16, 2017
@@ -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.

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

Hmm that kinda sounds weird :D

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Changed 👍

@@ -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):

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

Use False instead of None, we don't need a tri-state for this field.

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

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]

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

do you really need filename, as the linter has use_stdin?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Yes, use_stdin doesn't work with validate-links 😄 I've removed the use_stdin though 👍

This comment has been minimized.

@Makman2

Makman2 Jul 18, 2017
Member

Ah write that into the commit message please :D
(the reason why you remove use_stdin)

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍

@@ -50,7 +50,7 @@


@generate_skip_decorator(MarkdownBear)
class MarkdownBearMaxLineLengthMessageTest(unittest.TestCase):
class MarkdownBearTest(unittest.TestCase):

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

for me it's obvious, anyway put the reason into the commit message :)

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

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|$)')

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

Please reason that inside the commit message :)

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

Actually I would rephrase the shortlog to something like Improve result message or so, as this is the effective reason :)

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍


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)

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

Maybe we should also rename this to remark_configs, so it's easier to distinct from remark_lint_configs?

Up to you 👍

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

One more commit ?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done, added a commit stating the same 👍

@AsnelChristian
Copy link
Member

@AsnelChristian AsnelChristian commented Jul 18, 2017

please rebase and address @Makman2 issues :)

@yash-nisar yash-nisar force-pushed the yash-nisar:md-validate-links branch from c1ef443 to fd503ca Jul 18, 2017
@yash-nisar
Copy link
Member Author

@yash-nisar yash-nisar commented Jul 18, 2017

Updated @Makman2

@@ -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):

This comment has been minimized.

@Makman2

Makman2 Jul 18, 2017
Member

maybe just check_links? Strictly: As only checking valid links won't yield any results, as those are valid, right? ;)

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍

@Makman2
Copy link
Member

@Makman2 Makman2 commented Jul 18, 2017

For the rename commits: Please put the reason of the name-change into the commit body 👍

@yash-nisar yash-nisar force-pushed the yash-nisar:md-validate-links branch from fd503ca to 28be3bb Jul 18, 2017
yash-nisar added 2 commits Jul 14, 2017
Add `validate-links` plugin and since the `validate-links`
plugin is incompatible with stdin input, `use_stdin=True`
was removed.

Closes #924
Rename test classname from `MarkdownBearMaxLineLengthMessageTest`
to `MarkdownBearTest` because there were a few generic additions
to the tests.
yash-nisar added 3 commits Jul 16, 2017
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`.
@yash-nisar yash-nisar force-pushed the yash-nisar:md-validate-links branch from 28be3bb to d6100ce Jul 18, 2017
@Makman2
Copy link
Member

@Makman2 Makman2 commented Jul 18, 2017

@Makman2
Copy link
Member

@Makman2 Makman2 commented Jul 18, 2017

@rultor merge

@rultor
Copy link

@rultor rultor commented Jul 18, 2017

@rultor merge

@Makman2 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit d6100ce into coala:master Jul 18, 2017
6 of 8 checks passed
6 of 8 checks passed
ci/circleci CircleCI is running your tests
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
codecov/project 100% (target 100%)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
review/gitmate/commit No issues with this one - go ahead! :)
Details
review/gitmate/manual This commit was acknowledged.
Details
review/gitmate/pr All is well! :) (0 problems solved)
Details
@rultor
Copy link

@rultor rultor commented Jul 18, 2017

@rultor merge

@Makman2 Done! FYI, the full log is here (took me 2min)

@yash-nisar yash-nisar deleted the yash-nisar:md-validate-links branch Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

7 participants
You can’t perform that action at this time.