Page MenuHomePhabricator

[LINTER] Add a markdown linter
ClosedPublic

Authored by Fabien on Sep 9 2020, 20:37.

Details

Reviewers
jasonbcox
Group Reviewers
Restricted Project
Commits
rABCe1124ea61c0d: [LINTER] Add a markdown linter
Summary

This linter is fairly limited for now, and will only check for dead
local links (links within the project scope).

Test Plan
arc lint --everything

Revert one of the markdown changes from this diff:

arc lint

Check the linter raises an error.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
linter_dead_links_md
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 12694
Build 25481: Build Diffbuild-clang-tidy · build-clang-10 · build-diff · build-without-wallet
Build 25480: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Sep 9 2020, 20:37
jasonbcox requested changes to this revision.Sep 9 2020, 21:23
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
arcanist/linter/MarkdownLinter.php
53 ↗(On Diff #23418)

This looks incredibly fragile and difficult to improve in the future. Some suggestions:

  • Make the pattern match *all* markdown links. The exceptions being baked into the pattern make it incredibly difficult to decipher.
  • Discard links you don't care about post-pattern-match (such as those starting with anchors #)
  • Ignore ALL links that specify any protocol (://). While http(s) is common, they aren't the only ones.
This revision now requires changes to proceed.Sep 9 2020, 21:23

Address feedback and improve robustness:

  • Simplify the base regex pattern
  • Add support for link titles
  • Check for valid syntax in URLs and email addresses
This revision is now accepted and ready to land.Sep 10 2020, 17:01
This revision was landed with ongoing or failed builds.Sep 10 2020, 20:26
This revision was automatically updated to reflect the committed changes.