#136 Warn about duplicate modules that don't make sense

release_3.0
closed
nobody
1
2012-10-10
2003-01-25
Christian Hujer
No

I suggest to add warnings if a module is used twice in
the configfile and it makes no sense that this module
is used twice.

For instance, imagine:
<!-- ... -->
<module name="Checker">
<!-- ... -->
<module name="TreeWalker">
<!-- ... -->
<module name="ConstantName" />
<!-- ... -->
<module name="ConstantName">
<property name="format"
value="^(A-Z*|revision)$" />
</module>
<!-- ... -->
</module>
<!-- ... -->
</module>
<!-- ... -->

It makes no sense for module ConstantName to be used
twice. The first module reference will take precedence
over the second one.
This might be confusing for some users not already
experienced with the new xml based config file format.

So I suggest that modules know wether they may be used
just once or several times and warn if they are used
more than once.

Thanks, bye

Discussion

  • Lars Kühne
    Lars Kühne
    2003-01-26

    Logged In: YES
    user_id=401384

    I agree that this would prevent configuration errors, and
    implementing this is easy now but might restrict our future
    ability to add other cool features:

    For example I have a feature in mind (no rfe filed yet)
    where the user can add file filters to individual checks. In
    your case it's not so easy to figure out whether using the
    module twice "makes sense".

    Example: Only the files in the public api may have a revision:

    <module name="ConstantName" filter="/api/.java">
    <property name="format"
    value="^(A-Z
    |revision)$" />
    </module>
    <module name="ConstantName" filter="
    /core/*.java"/>

    As soon as the filter feature is introduced it will be
    pretty hard to find out whether the two modules make sense
    together or not, it depends on the overlap of the filter
    expressions.

    I'd suggest we wait with the implementation until more users
    report the same usabilty problems.

     
  • Oliver Burn
    Oliver Burn
    2003-02-02

    Logged In: YES
    user_id=218824

    I do not think it is possible to reliably detect if a module
    can be declared multiple times. I understand the problem
    this presents as it makes is harder to get the config file
    right.