#22 Require arbirary Tags on a type

open
Check (274)
5
2012-10-10
2002-01-20
Lars Kühne
No

Checkstyle currently requires an @author tag on any
type. This behaviour is hardcoded. It would be nice if
the user could instead provide a list of tags,
including a regexp for the argument.

For example, the Apache people might want to enforce
that @author tags contain an email adress and that a
@version tag is available and contains the CVS Id
keyword by specifying something like (not sure that I
got regexp syntax right):

tag.author=^<a href=\&quot;mailto:.+@.+\&quot;>.+</a>$
tag.version=^\$Id.*\$$

Discussion

  • Logged In: YES
    user_id=746148

    I would say that this is already implemented by JavadocType
    check.

     
  • Lars Kühne
    Lars Kühne
    2004-03-09

    Logged In: YES
    user_id=401384

    No, it's not covered by JavadocType (although the examples
    presented in the request are a bit weak)

    The emphasis is on "arbitrary". What I meant is that I would
    like to be able to enforce a private tag that is not
    hardcoded in checkstyle (like "@threadsafe yes" or maybe
    some xdoclet tags).

    For example if we ever fix the duplicate documentation bug
    we would probably want to enforce in "ant
    checkstyle.checkstyle" that it has a @parentmodule tag, that
    the parentmodule is either "TreeWalker" or "Checker", that
    there is at least one @exampleusage tag, exactly one
    @rationale tag, ... you get the idea.

     
  • Logged In: YES
    user_id=746148

    Ok. It looks like this is almost the same as rfe 478950
    (Support for custom javadoc tags) (Am I right?)

    Do yo have any suggestion on how we should configure
    check for this? (something better then two associated lists)

     
  • Daniel Grenner
    Daniel Grenner
    2004-03-09

    Logged In: YES
    user_id=883334

    The WriteTag check submitted as part of patch 902110 does
    most of this check, since it allows custom tags as well as a
    custom regexp for the tag. It can output messages either if
    the expression is missing or if it does exist.

    The token support should probably be extended if it should be
    able to handle all JavaDoc cases, since currently it only works
    for interfaces, classes, and methods. That would be a minor
    modification to the patch.

    An example is:
    <module name="WriteTag">
    <property name="tag" value="@author"/>
    <property name="tagFormat" value="\\S"/>
    </module>