You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Simone Tripodi <si...@apache.org> on 2012/03/03 14:36:39 UTC

Re: svn commit: r1296621 - in /commons/sandbox/graph/trunk: ./ src/main/java/org/apache/commons/graph/ src/main/java/org/apache/commons/graph/spanning/

Thomas,

checkstyle is not needed because we are using the one brought by the
plugin (the maven one), you can safety drop it.
thanks,
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Sat, Mar 3, 2012 at 2:26 PM,  <tn...@apache.org> wrote:
> Author: tn
> Date: Sat Mar  3 13:26:08 2012
> New Revision: 1296621
>
> URL: http://svn.apache.org/viewvc?rev=1296621&view=rev
> Log:
> added initial checkstyle.xml, removed duplicate getWeight interface method, javadoc cleanup
>
> Added:
>    commons/sandbox/graph/trunk/checkstyle.xml   (with props)
> Modified:
>    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java
>    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/GraphException.java
>    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/MutableGraph.java
>    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java
>    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedEdge.java
>    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedPath.java
>    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java
>
> Added: commons/sandbox/graph/trunk/checkstyle.xml
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/checkstyle.xml?rev=1296621&view=auto
> ==============================================================================
> --- commons/sandbox/graph/trunk/checkstyle.xml (added)
> +++ commons/sandbox/graph/trunk/checkstyle.xml Sat Mar  3 13:26:08 2012
> @@ -0,0 +1,157 @@
> +<?xml version="1.0"?>
> +
> +<!--
> +   Licensed to the Apache Software Foundation (ASF) under one or more
> +  contributor license agreements.  See the NOTICE file distributed with
> +  this work for additional information regarding copyright ownership.
> +  The ASF licenses this file to You under the Apache License, Version 2.0
> +  (the "License"); you may not use this file except in compliance with
> +  the License.  You may obtain a copy of the License at
> +
> +       http://www.apache.org/licenses/LICENSE-2.0
> +
> +   Unless required by applicable law or agreed to in writing, software
> +   distributed under the License is distributed on an "AS IS" BASIS,
> +   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> +   See the License for the specific language governing permissions and
> +   limitations under the License.
> +  -->
> +
> +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
> +
> +<!-- commons graph customization of default checkstyle behavior -->
> +<module name="Checker">
> +  <property name="localeLanguage" value="en"/>
> +  <property name="severity" value="warning"/>
> +
> +  <module name="TreeWalker">
> +
> +    <property name="cacheFile" value="target/checkstyle-cachefile"/>
> +
> +    <!-- Operator must be at end of wrapped line -->
> +    <module name="OperatorWrap">
> +      <property name="option" value="eol"/>
> +    </module>
> +
> +    <!-- No if/else/do/for/while without braces -->
> +    <module name="NeedBraces"/>
> +
> +    <!-- Interfaces must be types (not just constants) -->
> +    <module name="InterfaceIsType"/>
> +
> +    <!-- Must have class / interface header comments including scm version -->
> +<!--     <module name="JavadocType"> -->
> +<!--         <property name="versionFormat" value="\$Id.*\$"/> -->
> +<!--     </module> -->
> +
> +     <!-- Require method javadocs, allow undeclared RTE -->
> +    <module name="JavadocMethod">
> +      <property name="allowUndeclaredRTE" value="true"/>
> +    </module>
> +
> +    <!-- Require field javadoc -->
> +    <module name="JavadocVariable"/>
> +
> +    <!-- No public fields -->
> +    <module name="VisibilityModifier">
> +       <property name="protectedAllowed" value="true"/>
> +    </module>
> +
> +    <!-- Require hash code override when equals is -->
> +    <module name="EqualsHashCode"/>
> +
> +    <!-- Disallow unnecessary instantiation of Boolean, String -->
> +    <module name="IllegalInstantiation">
> +      <property name="classes" value="java.lang.Boolean, java.lang.String"/>
> +    </module>
> +
> +    <!-- Required for SuppressionCommentFilter below -->
> +    <module name="FileContentsHolder"/>
> +
> +    <!--  Import should be explicit, really needed and only from pure java packages -->
> +    <module name="AvoidStarImport" />
> +    <module name="UnusedImports" />
> +    <module name="IllegalImport" />
> +
> +    <!-- Utility class should not be instantiated, they must have a private constructor -->
> +    <module name="HideUtilityClassConstructor" />
> +
> +    <!-- Switch statements should be complete and with independent cases -->
> +    <module name="FallThrough" />
> +    <module name="MissingSwitchDefault" />
> +
> +    <!-- Constant names should obey the traditional all uppercase naming convention -->
> +    <module name="ConstantName" />
> +
> +    <!-- Method parameters and local variables should not hide fields, except in constructors and setters -->
> +    <module name="HiddenField">
> +        <property name="ignoreConstructorParameter" value="true" />
> +        <property name="ignoreSetter" value="true" />
> +    </module>
> +
> +    <!-- No trailing whitespace -->
> +    <module name="Regexp">
> +      <property name="format" value="[ \t]+$"/>
> +      <property name="illegalPattern" value="true"/>
> +      <property name="message" value="Trailing whitespace"/>
> +    </module>
> +
> +    <!-- No System.out.println() statements -->
> +    <module name="Regexp">
> +      <!-- no sysouts -->
> +      <property name="format" value="System\.out\.println"/>
> +      <property name="illegalPattern" value="true"/>
> +    </module>
> +
> +    <!-- Authors should be in pom.xml file -->
> +    <module name="Regexp">
> +      <property name="format" value="@author"/>
> +      <property name="illegalPattern" value="true"/>
> +      <property name="message" value="developers names should be in pom file"/>
> +    </module>
> +
> +    <!-- Use a consistent way to put modifiers -->
> +    <module name="RedundantModifier" />
> +    <module name="ModifierOrder" />
> +
> +    <!-- Use a consistent way to put declarations -->
> +    <module name="DeclarationOrder" />
> +
> +    <!-- Don't add up parentheses when they are not required -->
> +    <module name="UnnecessaryParentheses" />
> +
> +    <!--  Don't use too widespread catch (Exception, Throwable, RuntimeException)  -->
> +    <module name="IllegalCatch" />
> +
> +    <!-- Don't use = or != for string comparisons -->
> +    <module name="StringLiteralEquality" />
> +
> +   <!-- Don't declare multiple variables in the same statement -->
> +    <module name="MultipleVariableDeclarations" />
> +
> +    <!-- String literals more than one character long should not be repeated several times -->
> +    <!-- the "unchecked" string is also accepted to allow @SuppressWarnings("unchecked") -->
> +    <module name="MultipleStringLiterals" >
> +      <property name="ignoreStringsRegexp" value='^(("")|(".")|("unchecked"))$'/>
> +    </module>
> +
> +    <!-- <module name="TodoComment" /> -->
> +
> +  </module>
> +
> +  <!-- Verify that EVERY source file has the appropriate license -->
> +<!--   <module name="Header"> -->
> +<!--     <property name="headerFile" value="license-header.txt"/> -->
> +<!--   </module> -->
> +
> +  <!-- No tabs allowed! -->
> +  <module name="FileTabCharacter"/>
> +
> +  <!-- Require files to end with newline characters -->
> +  <module name="NewlineAtEndOfFile"/>
> +
> +  <!-- Require package javadoc -->
> +  <module name="JavadocPackage"/>
> +
> +</module>
> +
>
> Propchange: commons/sandbox/graph/trunk/checkstyle.xml
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: commons/sandbox/graph/trunk/checkstyle.xml
> ------------------------------------------------------------------------------
>    svn:keywords = Id Revision HeadURL
>
> Propchange: commons/sandbox/graph/trunk/checkstyle.xml
> ------------------------------------------------------------------------------
>    svn:mime-type = text/xml
>
> Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java?rev=1296621&r1=1296620&r2=1296621&view=diff
> ==============================================================================
> --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java (original)
> +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java Sat Mar  3 13:26:08 2012
> @@ -91,6 +91,7 @@ public interface Graph<V extends Vertex,
>      * <b>NOTE</b>: implementors have to take in consideration throwing a {@link GraphException}
>      * if an error occurs while performing that operation.
>      *
> +     * @param v the {@link Vertex} which connected vertices have to be returned.
>      * @return all vertices which touch this vertex.
>      */
>     Iterable<V> getConnectedVertices( V v );
> @@ -113,27 +114,29 @@ public interface Graph<V extends Vertex,
>      * <b>NOTE</b>: implementors have to take in consideration throwing a {@link GraphException}
>      * if an error occurs while performing that operation.
>      *
> +     * @param e the input {@link Edge}
>      * @return the set of {@link Vertex} on this Edge.
>      */
>     VertexPair<V> getVertices( E e );
> -
> -
> +
>     /**
>      * Returns true if the vertex is contained into the graph
>      *
>      * <b>NOTE</b>: implementors have to take in consideration throwing a {@link GraphException}
>      * if an error occurs while performing that operation.
>      *
> +     * @param v the {@link Vertex} to be checked
>      * @return Returns true if the vertex is contained into the graph, false otherwise
>      */
>     boolean containsVertex( V v );
> -
> +
>     /**
>      * Returns true if the edge is contained into the graph
>      *
>      * <b>NOTE</b>: implementors have to take in consideration throwing a {@link GraphException}
>      * if an error occurs while performing that operation.
>      *
> +     * @param e the {@link Edge} to be checked
>      * @return Returns true if the edge is contained into the graph, false otherwise
>      */
>     boolean containsEdge( E e );
>
> Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/GraphException.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/GraphException.java?rev=1296621&r1=1296620&r2=1296621&view=diff
> ==============================================================================
> --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/GraphException.java (original)
> +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/GraphException.java Sat Mar  3 13:26:08 2012
> @@ -27,7 +27,7 @@ import static java.lang.String.format;
>  public class GraphException
>     extends RuntimeException
>  {
> -
> +    /** The serial version UID. */
>     private static final long serialVersionUID = 6356965258279945475L;
>
>     /**
>
> Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/MutableGraph.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/MutableGraph.java?rev=1296621&r1=1296620&r2=1296621&view=diff
> ==============================================================================
> --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/MutableGraph.java (original)
> +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/MutableGraph.java Sat Mar  3 13:26:08 2012
> @@ -55,7 +55,9 @@ public interface MutableGraph<V extends
>      * <b>NOTE</b>: implementors have to take in consideration throwing a {@link GraphException}
>      * if an error occurs while performing that operation.
>      *
> +     * @param head the head {@link Vertex}
>      * @param e the {@link Edge} has to be added in this {@code MutableGraph} instance.
> +     * @param tail the tail {@link Vertex}
>      */
>     void addEdge( V head, E e, V tail );
>
>
> Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java?rev=1296621&r1=1296620&r2=1296621&view=diff
> ==============================================================================
> --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java (original)
> +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java Sat Mar  3 13:26:08 2012
> @@ -30,9 +30,9 @@ import static java.lang.String.format;
>  */
>  public final class VertexPair<V extends Vertex>
>  {
> -
> +    /** The head vertex. */
>     private final V head;
> -
> +    /** The tail vertex. */
>     private final V tail;
>
>     /**
>
> Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedEdge.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedEdge.java?rev=1296621&r1=1296620&r2=1296621&view=diff
> ==============================================================================
> --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedEdge.java (original)
> +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedEdge.java Sat Mar  3 13:26:08 2012
> @@ -22,7 +22,7 @@ package org.apache.commons.graph;
>  /**
>  * A WeightedEdge is an {@link Edge} that is assigned a weight to represent, for example,
>  * costs, lengths or capacities, etc. depending on the problem.
> - *
> + *
>  * @param <W> the weight type
>  */
>  public interface WeightedEdge<W>
>
> Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedPath.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedPath.java?rev=1296621&r1=1296620&r2=1296621&view=diff
> ==============================================================================
> --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedPath.java (original)
> +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/WeightedPath.java Sat Mar  3 13:26:08 2012
> @@ -30,6 +30,4 @@ public interface WeightedPath<V extends
>     extends Path<V, WE>, Weighted<W>
>  {
>
> -    W getWeight();
> -
>  }
>
> Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java
> URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java?rev=1296621&r1=1296620&r2=1296621&view=diff
> ==============================================================================
> --- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java (original)
> +++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/SpanningTreeSourceSelector.java Sat Mar  3 13:26:08 2012
> @@ -67,6 +67,7 @@ public interface SpanningTreeSourceSelec
>      *   return edges[] E
>      * </pre>
>      *
> +     * @param <WO> the type of weight operations
>      * @param weightOperations the weight operations
>      * @return the calculated spanning tree
>      */
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


How to configure the eclipse checkstyle plugin for use in commons projects (was: Re: svn commit: r1296621 - in /commons/sandbox/graph/trunk: ./ src/main/java/org/apache/commons/graph/ src/main/java/org/apache/commons/graph/spanning/)

Posted by Benedikt Ritter <be...@systemoutprintln.de>.
Am 03.03.2012 14:52, schrieb Simone Tripodi:
>> I think it is good to have control over what is actually checked by
>> checkstyle. Having a customised version is quite common practice also in
>> other commons components.
>>
>
> I would have preferred you would have discussed first before changing
> configurations. Control and customizations, if needed, can be included
> in the checkstyle suppressions file. Please revert pom configuration,
> if applied, and discuss first in a separated thread.
>
>> The one I checked in is from commons math, where I disabled some checks
>> for now (e.g. @version, license header).
>
> The math style is not the one we've been using, if the configuration
> has to be imported, then it has to be from Maven, wich is the one
> we've been using.
>

Sorry, this may be kind of a newbe question, but I'm still looking for a 
away configure the eclipse checkstyle plugin to use the right checks.
Can you give me some advice with that? I've already tried to import the 
maven_check.xml from the maven-checkstyle-plugin.jar but that does not 
seem to workout, because there are unresolved place holders.
So my question is, where can I get/how can I generate a valid 
checkstyle.xml for a commons project, that takes the suppressions into 
account?

TIA,
Benedikt

> http://people.apache.org/~simonetripodi/
> http://simonetripodi.livejournal.com/
> http://twitter.com/simonetripodi
> http://www.99soft.org/
>
>
>
> On Sat, Mar 3, 2012 at 2:42 PM, Thomas Neidhart
> <th...@gmail.com>  wrote:
>> On 03/03/2012 02:36 PM, Simone Tripodi wrote:
>>> Thomas,
>>>
>>> checkstyle is not needed because we are using the one brought by the
>>> plugin (the maven one), you can safety drop it.
>>
>> I think it is good to have control over what is actually checked by
>> checkstyle. Having a customised version is quite common practice also in
>> other commons components.
>>
>> The one I checked in is from commons math, where I disabled some checks
>> for now (e.g. @version, license header).
>>
>> Thomas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1296621 - in /commons/sandbox/graph/trunk: ./ src/main/java/org/apache/commons/graph/ src/main/java/org/apache/commons/graph/spanning/

Posted by Simone Tripodi <si...@apache.org>.
> I think it is good to have control over what is actually checked by
> checkstyle. Having a customised version is quite common practice also in
> other commons components.
>

I would have preferred you would have discussed first before changing
configurations. Control and customizations, if needed, can be included
in the checkstyle suppressions file. Please revert pom configuration,
if applied, and discuss first in a separated thread.

> The one I checked in is from commons math, where I disabled some checks
> for now (e.g. @version, license header).

The math style is not the one we've been using, if the configuration
has to be imported, then it has to be from Maven, wich is the one
we've been using.

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Sat, Mar 3, 2012 at 2:42 PM, Thomas Neidhart
<th...@gmail.com> wrote:
> On 03/03/2012 02:36 PM, Simone Tripodi wrote:
>> Thomas,
>>
>> checkstyle is not needed because we are using the one brought by the
>> plugin (the maven one), you can safety drop it.
>
> I think it is good to have control over what is actually checked by
> checkstyle. Having a customised version is quite common practice also in
> other commons components.
>
> The one I checked in is from commons math, where I disabled some checks
> for now (e.g. @version, license header).
>
> Thomas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1296621 - in /commons/sandbox/graph/trunk: ./ src/main/java/org/apache/commons/graph/ src/main/java/org/apache/commons/graph/spanning/

Posted by Thomas Neidhart <th...@gmail.com>.
On 03/03/2012 02:36 PM, Simone Tripodi wrote:
> Thomas,
> 
> checkstyle is not needed because we are using the one brought by the
> plugin (the maven one), you can safety drop it.

I think it is good to have control over what is actually checked by
checkstyle. Having a customised version is quite common practice also in
other commons components.

The one I checked in is from commons math, where I disabled some checks
for now (e.g. @version, license header).

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org