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 REQUEST] Recommend rule friendly name #2027

Closed
ghost opened this issue Aug 6, 2020 · 5 comments · Fixed by #2031
Closed

[RULE REQUEST] Recommend rule friendly name #2027

ghost opened this issue Aug 6, 2020 · 5 comments · Fixed by #2031

Comments

@ghost
Copy link

ghost commented Aug 6, 2020

Rule metadata

  • SARIF2025

  • ProvideRuleFriendlyName

  • note

  • Full description

    Each analysis rule should provide a "friendly name" in its 'name' property, in addition to the stable, opaque identifier in its 'id' property. This helps users see at a glance the purpose of the analysis rule. For uniformity of experience across all tools that produce SARIF, the friendly name should be a single Pascal identifier, for example, 'ProvideRuleFriendlyName'.

  • User-facing strings:

    • FriendlyNameMissing

      {0}: The rule '{1}' does not provide a "friendly name" in its 'name' property. The friendly name should be a single Pascal identifier, for example, 'ProvideRuleFriendlyName', that helps users see at a glance the purpose of the analysis rule.

    • FriendlyNameNotAPascalIdentifier

      {0}: '{1}' is not a Pascal identifier. For uniformity of experience across all tools that produce SARIF, the friendly name should be a single Pascal identifier, for example, 'ProvideRuleFriendlyName'.

@eddynaka
Copy link
Collaborator

@lgolding , how do you imagine that we could validate if the string is in pascal or not?

@ghost
Copy link
Author

ghost commented Aug 10, 2020

@eddynaka One or more repetitions of a capital letter followed by one or more lower-case letters.

^(\p{Lu}\p{Ll}+)+$

And I suppose we should allow digits in the lower-case part, so

^(\p{Lu}[\p{Ll}\p{Nd}]+)+$

@eddynaka
Copy link
Collaborator

eddynaka commented Aug 10, 2020

For the message FriendlyNameMissing, are we going to point to the rule, right? If yes, aren't we missing the tag '{0}'?

@ghost
Copy link
Author

ghost commented Aug 10, 2020

Yes, we need the {0}.

@ghost
Copy link
Author

ghost commented Aug 31, 2020

Breaking: I realized that this should be combined with the existing SARIF2012.ProvideHelpUris to form the less granular rule SARIF2012.ProvideRuleProperties. This will cover friendly name, help URI, and whatever other rule properties we require in future.

@eddynaka is doing this now.

@michaelcfanning FYI

@ghost ghost closed this as completed in #2031 Aug 31, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant