rubocop / rubocop-md

RuboCop for Markdown code snippets
MIT License
71 stars 14 forks source link

No offense for code with unclosed backtick #26

Closed Earlopain closed 9 months ago

Earlopain commented 9 months ago

Examining a file which just contains the character ` is a Lint/Syntax offense for rubocop, but the same thing in a ruby codeblock passes.

This isn't just a hypothetical problem, I have come across code like the following where the backtick was inserted in place of a space for some reason. This produces no offense:

a =`do_something

Subsequent codeblocks are not/wrongly being linted, this in a following codeblock produces no offense as well:

do_something("foo")
do_something_else('bar')
palkan commented 9 months ago

Do you have WarnInvalid set to true? (It's the default value) https://github.com/rubocop/rubocop-md#configuration

Could you please provide a full Markdown snippet and your RuboCop Markdown configuration?

Earlopain commented 9 months ago

Yes, of course. I've uploaded the sample code as an attachment since I don't know how to properly escape the syntax here:

require:
  - rubocop-md

AllCops:
  NewCops: enable

test.md

Earlopain commented 9 months ago

Looking at the processed source it's pretty clear what's going on. I was trying to give this a shot myself but don't know how to resolve this unfortunatly.

image

palkan commented 9 months ago

Thanks for helping with investigation. Fixed and released in 1.2.2.

Earlopain commented 9 months ago

Thanks!