Skip to content

Make custom rule name consistent #1545

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

Open
jegannathanmaniganadan opened this issue Jul 17, 2020 · 1 comment
Open

Make custom rule name consistent #1545

jegannathanmaniganadan opened this issue Jul 17, 2020 · 1 comment

Comments

@jegannathanmaniganadan
Copy link
Contributor

jegannathanmaniganadan commented Jul 17, 2020

Apologies if I am repeating something or if this has been discussed already. This is mostly an re-iteration of #1140 (comment)

As of now, custom rule names are inconsistent across various places.

  • At first, there are no indication about function name in the ScriptRuleDocumention.md . But PSSA is completely depends on $MyInvocation.InvocationName for rule/violation name
  • I can not really have a customized rule name, it should be the name of the PS function. That gives me a weird naming of rules like Measure-Something. On the other I can ship the violation with whatever name I like which has no value and can break things.
  • While suppressing a custom rule, I will have to provide <ModuleName>\<RuleName>. That would end up something like, FooBar\Measure-Something
    • I really do not like this convention as I do not want the developer to be aware of the module name or the function name.
  • It gets worst further, While filtering a rule, I can not follow the same convention, it has to be the name whatever the function name.
Invoke-ScriptAnalyzer -IncludeRule Measure-Something -ExcludeRule Measure-SomethingElse

@rjmholt
Copy link
Contributor

rjmholt commented Jul 20, 2020

This is essentially planned for PSSA 2; rules, whether implemented by .NET classes or PS functions, should define an attribute to declare a name, with the namespace being the assembly or module name (the namespace is also customisable/overrideable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants