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

Allow linting Rego in Markdown files #611

Open
anderseknert opened this issue Mar 27, 2024 · 2 comments
Open

Allow linting Rego in Markdown files #611

anderseknert opened this issue Mar 27, 2024 · 2 comments
Labels

Comments

@anderseknert
Copy link
Member

anderseknert commented Mar 27, 2024

It would be neat if it was possible to point Regal at Markdown files and have it lint any code blocks with rego set as the language identifier. This should probably be opt-in when Regal is pointed at a directory, but regal lint doc.md should just work.

We'll need to consider that example Rego in markdown files are often just snippets, so we can't assume things like a package declaration. This should be similar to rq in that regard, so we can probably borrow some logic from that project.

Similarly, we'll want to disable any aggregate rules in this context, as those don't make any sense when dealing with snippets.

Later, we might want to allow different configuration options for this, as opa fmt formatting and tabs in particular sadly doesn't look great in most markdown docs (displayed as 8 spaces). But that can be dealt with in follow-up issues.

@srenatus
Copy link
Member

This is a cool idea. Having a quick look for prior art, this is the only thing I came across: https://github.com/eslint/eslint-plugin-markdown -- it's for JS, but it validates the idea ✔️

@anderseknert
Copy link
Member Author

Thanks! Yeah, and it'd be a good way to ensure we're not unintentionally breaking our own rules in our own docs. Not sure how we'd best handle linting the "Avoid" blocks, but that's a problem for later 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: TODO
Development

No branches or pull requests

2 participants