iwarapter / sonar-puppet

SonarQube plugin for Puppet code.
Other
26 stars 10 forks source link

Automatically validate samples in documentation #262

Closed iwarapter closed 8 years ago

iwarapter commented 8 years ago

Samples in the rule documentation should be automatically validated to ensure they are all valid puppet code.

iwarapter commented 8 years ago

@racodond @petems to help validate the puppet samples we have in our rule documentation i have written some tests which essentially extract it and 'puppet --validate' the code, im just cleaning it up a little but you can have a sneak peak here: https://github.com/iwarapter/sonar-puppet/tree/feature/add_sample_testing this is to help with the issues we had in #260

racodond commented 8 years ago

@iwarapter Good move! Regarding the tests, instead of writing one test by rule, wouldn't you be able to browse all html rule description files automatically?

iwarapter commented 8 years ago

@racodond i was originally doing that but we have a few rules which have samples that won't pass see EmptyLineEndOfFile for example and also quote a few of the descriptions don't have actual puppet code either which made it a little messy. Will keep having a play.

racodond commented 8 years ago

Why not adding a 'fake' CSS class to the

 we don't want to be checked?

iwarapter commented 8 years ago

Yeah i have added a skipautotest="" to the sections we want to skip, need to make sure the tests handle there being no samples etc.

iwarapter commented 8 years ago

The other benefit of having the tests seperated is they can be forked when running as todo all of them together in series takes a couple of mins.

racodond commented 8 years ago

See https://github.com/iwarapter/sonar-puppet/pull/264