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

More robust /-command parsing #86

Merged
merged 4 commits into from Feb 20, 2020

Conversation

njsmith
Copy link
Member

@njsmith njsmith commented Feb 20, 2020

  • It turns out that lines starting with / happen randomly, e.g.
    because of people pasting absolute paths into comment boxes. So now we
    should ignore them instead of raising NotImplementedError like we used
    to.

  • Switched to using a markdown parser to process text before searching
    for /-commands, so we ignore /-commands inside blockquotes, fenced
    code blocks, HTML comments, etc.

    This is probably silly overkill, but I had fun writing it, so hey.

We used to have a 'raise NotImplementedError' here, and as soon as
this was deployed we hit that error, from an issue that contained some
Python warning messages, which start with an absolute path, and the
path starts with a /. Whoops. I don't think there's any better way to
handle these except to just ignore them.
This is probably overkill, but:

- It means we won't parse commands embedded in e.g. code blocks or
  blockquotes, which seems like it would be surprising (and make it
  hard to talk about commands without invoking them)
- It's only a few lines of code
- I had fun

Unfortunately, the mistletoe markdown parser doesn't know about HTML
comments, so it *will* still process invisible commands embedded
inside <!-- -->. That seems like a bug, but I'm not sure how to fix
it...
@codecov
Copy link

codecov bot commented Feb 20, 2020

Codecov Report

Merging #86 into master will increase coverage by 0.12%.
The diff coverage is 95%.

@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
+ Coverage   94.47%   94.59%   +0.12%     
==========================================
  Files          11       11              
  Lines         597      611      +14     
  Branches       45       52       +7     
==========================================
+ Hits          564      578      +14     
  Misses         24       24              
  Partials        9        9
Impacted Files Coverage Δ
tests/test_gh.py 100% <ø> (ø) ⬆️
snekomatic/gh.py 93.21% <95%> (+0.45%) ⬆️

@njsmith njsmith merged commit 96551d3 into python-trio:master Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant