cwallenpoole
cwallenpoole

Reputation: 82078

Is there a way to get Sonar to verify that a file exists?

Something which is a consistent problem in projects I've been working on is a lack of a README (of any form). I'd like to have Sonar verify that either a README file exists in a project root or that a docs/ folder exists which has at least one file in it.

I haven't seen these options as a Sonar rule.

I am more than willing to write an extension (I have before for other custom rules), but it seems like I would have to have the same check called for every file in the project instead of just once on the project root.

Is there an existing rule to check for a certain file/folder? If not, is there a way to write an extension to only check for that file/folder once?

Upvotes: 0

Views: 1270

Answers (1)

G. Ann - SonarSource Team
G. Ann - SonarSource Team

Reputation: 22824

As noted by David, the Puppet Plugin provides a rule for README.md, but you appear to have a number of files you want to check. IMO, this is an excellent candidate for custom coding, but I would recommend implementing a Rule Template, rather than a straight rule. That way you write the rule once and simply configure the variations in the GUI.

Upvotes: 1

Related Questions