Editing Cs-doclet
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
== Abstract == | == Abstract == | ||
Cs-doclet is a [http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/ JAVADOC doclet] that generates the metadata files for [http://checkstyle.sourceforge.net/ CheckStyle] and [http://eclipse-cs.sourceforge.net/ eclipse-cs] from annotations and | Cs-doclet is a [http://docs.oracle.com/javase/8/docs/technotes/guides/javadoc/ JAVADOC doclet] that generates the metadata files for [http://checkstyle.sourceforge.net/ CheckStyle] and [http://eclipse-cs.sourceforge.net/ eclipse-cs] from annotations and 'doc tags' in the source code of your checks and filters. | ||
== Intended audience == | == Intended audience == | ||
Line 118: | Line 116: | ||
The generated "src/com/pany/cs/checks/messages.properties" file looks like this: | The generated "src/com/pany/cs/checks/messages.properties" file looks like this: | ||
# This file was generated by the CS doclet; see http://cs- | # This file was generated by the CS doclet; see http://cs-contrib.unkrig.de | ||
# Custom check messages, in alphabetical order. | # Custom check messages, in alphabetical order. | ||
Line 231: | Line 229: | ||
'''File "src/com/pany/cs/checks/checkstyle-metadata.properties":''' | '''File "src/com/pany/cs/checks/checkstyle-metadata.properties":''' | ||
# This file was generated by the CS doclet; see http://cs- | # This file was generated by the CS doclet; see http://cs-contrib.unkrig.de. | ||
# Rule groups: | # Rule groups: | ||
Line 252: | Line 250: | ||
<checkstyle-metadata> | <checkstyle-metadata> | ||
<!-- This file was generated by the CS doclet; see http://cs- | <!-- This file was generated by the CS doclet; see http://cs-contrib.unkrig.de --> | ||
<!-- ColorCheck --> | <!-- ColorCheck --> | ||
Line 277: | Line 275: | ||
</checkstyle-metadata> | </checkstyle-metadata> | ||
== | == MediaWiki markup documentation == | ||
Typically, you will also want to publish human-readable documentation for your checks and filters, which is more or less identical with the text in the eclipse-cs metadata files. This is also possible with the "- | Typically, you will also want to publish human-readable documentation for your checks and filters, which is more or less identical with the text in the eclipse-cs metadata files. This is also possible with the "-mediawiki-dir" command line option: | ||
$ javadoc \ | $ javadoc \ | ||
> -doclet de.unkrig.doclet.cs.CsDoclet \ | > -doclet de.unkrig.doclet.cs.CsDoclet \ | ||
> -docletpath "path/to/cs-doclet.jar;bin;path/to/checkstyle-6.1-all.jar;path/to/net.sf.eclipsecs.core-6.1.jar" \ | > -docletpath "path/to/cs-doclet.jar;bin;path/to/checkstyle-6.1-all.jar;path/to/net.sf.eclipsecs.core-6.1.jar" \ | ||
> - | > -checkstyle-metadata.properties-dir src \ | ||
> -checkstyle-metadata.xml-dir src \ | |||
> -messages.properties-dir src \ | |||
> <span style="color:red">-mediawiki-dir mediawiki</span> \ | |||
> -sourcepath src \ | > -sourcepath src \ | ||
> -classpath ../net.sf.checkstyle-6.1/checkstyle-6.1/checkstyle-6.1-all.jar \ | > -classpath ../net.sf.checkstyle-6.1/checkstyle-6.1/checkstyle-6.1-all.jar \ | ||
Line 292: | Line 293: | ||
$ | $ | ||
This will generate a | This will generate: | ||
'''File "mediawiki/com.pany ColorCheck.mw":''' | |||
<!-- This file was generated by the CS doclet; see http://cs-contrib.unkrig.de --> | |||
<span style="color:red">A completely useless check which merely prints a (localizable) message each time it encounters an annotation.</span> | |||
== Properties == | |||
Default values appear <u>underlined</u>. | |||
<dl> | |||
<dt><span style="color:red">color</span> = "<i><span style="color:red">String</span></i>" (optional; default value is "<span style="color:red">Yellow</span>") | |||
<dd><span style="color:red">A completely useless check parameter.</span> | |||
</dl> | |||
Upload this text to a MediaWiki repository, and you'll see: | |||
[[File:screenshot_mediawiki.jpg]] | |||
And you're done! | And you're done! | ||
Line 299: | Line 317: | ||
Before, you had to write one Java file and four more or less redundant metadata files per check; now you merely have to throw in a few annotations and doc comments and generate all four metadata files from the source code | Before, you had to write one Java file and four more or less redundant metadata files per check; now you merely have to throw in a few annotations and doc comments and generate all four metadata files from the source code | ||