RSPEC database has a "Analysis Scope" field which specifies whether the rule applies to main source, test sources or both. However this is not consistently used by analyzers (partially for historical reason) and it is not visible in the rule description.
First step is for that particular information to be available in the rule metadata.
This field should be added to the rule schema (rule-metadata-schema.json). Its name should be "scope" and its value should be a string with 3 possible values "Main", "Tests" and "All".
For backward compatibility if the field is absent in the RSPEC, the default value should be "Main".
This field will eventually be used by:
- Analyzers to automatically run the rules on the appropriate scope
- rules.sonarsource.com to display the scope as part as the rule description
- SQ to display the scope as part as the rule description