简体   繁体   中英

How to create customized ruleset using the codenarc plugin?

I am currently using the codenarc plugin , and I wanted to customize the codenarc ruleset property for it to check the proper indentation of my codes.

Have anyone tried this?

Please help.

Thanks!

CodeNarc does not (currently) include any rules for checking/enforcing code indentation. Though you are welcome to contribute one!

You can see a list of all rules at: http://codenarc.sourceforge.net/codenarc-rule-index.html

The formatting rules are described at: http://codenarc.sourceforge.net/codenarc-rules-formatting.html

Chris

Use the Indentation rule. This is included in rulesets/formatting.xml . This will check the indentation (spaces only; not tabs) for class, field and method declarations, and statements. The default is 4 spaces per indentation level, This is configurable via the spacesPerIndentLevel property. See this page for details.

With the rule enabled violations are reported like this, in the default HTML report: Example report showing violations of the 'Indentation' rule .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM