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

Rule: unused-rule #358

Open
anderseknert opened this issue Sep 30, 2023 · 0 comments
Open

Rule: unused-rule #358

anderseknert opened this issue Sep 30, 2023 · 0 comments

Comments

@anderseknert
Copy link
Member

With at least one entrypoint annotation being made the norm in #154, this unlocks some new project level analytics capabilities. The one I think would be most useful is this:

  • For each entrypoint rule or package, programmatically run somethine like opa deps on each entrypoint.
  • Aggregate the dependencies reported from each invocation, and the rule "names" from each input policy.
  • If there are any rules in policy which aren't in the aggregated dependencies, report it as unused.

We'll need to make an exception for dynamic "general refs" rules here, and possibly some other dynamic constructs, but that's a drop in the ocean most policy projects. Some issues in how deps are calculated — there's a few open issues about this in OPA — could act as blockers here, but all the more reason to have these fixed upstream if so.

Some opa deps equivalence isn't likely be possible to pull of using only Rego and the AST, so this feels like a candidate for a second Go rule following the opa fmt one.

@anderseknert anderseknert moved this to TODO in Regal Oct 11, 2023
@anderseknert anderseknert changed the title Unused rule Rule: unused-rule Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: TODO
Development

No branches or pull requests

1 participant