rubocop / rubocop-md

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

Rubocop 3rd party templating #30

Open Earlopain opened 10 months ago

Earlopain commented 10 months ago

using rubocops 3rd party template support that got added in 1.45.

Oh, haven't seen this; awesome! Yeah, we should migrate to this new API.

Originally posted by @palkan in https://github.com/rubocop/rubocop-md/issues/28#issuecomment-1851778687


Not ready at all but I'll put this up now anyways so you can see what I'm up to. For now I have updated the preprocess tests to pass with the new api.

The really nice part of this is that you provide multiple code ranges, so there's no way that two codeblocks interact with eachother, like in #26. A whole bunch of busywork is not needed anymore, like keeping track of the config_store. The ProcessedSource has everything you need. In addition the rubocop cache should just work, though I don't know for certain. There's a test for that, so let's just see if that passes.

TODO:

Earlopain commented 7 months ago

I've actually spend some time on continuing this PR. Learned about some rubocop internals which made that process much easier.

All tests are passing but there are still some things I want to do. They aren't explicitly handled in tests currently but I'll change that (in hopefully fewer months than this took).

@palkan if you got any feedback, I think this is at a good point for that now. Alternatively, I can leave it as is currently, and work on the other things in a separate PR.