001    /*
002     * Sonar, open source software quality management tool.
003     * Copyright (C) 2008-2011 SonarSource
004     * mailto:contact AT sonarsource DOT com
005     *
006     * Sonar is free software; you can redistribute it and/or
007     * modify it under the terms of the GNU Lesser General Public
008     * License as published by the Free Software Foundation; either
009     * version 3 of the License, or (at your option) any later version.
010     *
011     * Sonar is distributed in the hope that it will be useful,
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014     * Lesser General Public License for more details.
015     *
016     * You should have received a copy of the GNU Lesser General Public
017     * License along with Sonar; if not, write to the Free Software
018     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
019     */
020    package org.sonar.plugins.squid;
021    
022    import org.sonar.api.CoreProperties;
023    import org.sonar.api.Properties;
024    import org.sonar.api.Property;
025    import org.sonar.api.SonarPlugin;
026    import org.sonar.plugins.squid.decorators.*;
027    
028    import java.util.Arrays;
029    import java.util.List;
030    
031    @Properties({
032        @Property(key = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_PROPERTY,
033            defaultValue = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE
034                + "",
035            name = "Separate accessors",
036            description = "Flag whether Squid should separate accessors (getters/setters) from methods. " +
037                "In that case, accessors are not counted in metrics such as complexity or API documentation.",
038            project = true,
039            global = true,
040            category = CoreProperties.CATEGORY_JAVA),
041        @Property(key = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION,
042            defaultValue = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE,
043            name = "List of fields to exclude from LCOM4 computation",
044            description = "Some fields should not be taken into account when computing LCOM4 measure as they " +
045                "unexpectedly and artificially decrease the LCOM4 measure. "
046                + "The best example is a logger used by all methods of a class. " +
047                "All field names to exclude from LCOM4 computation must be separated by a comma.",
048            project = true,
049            global = true,
050            category = CoreProperties.CATEGORY_JAVA),
051        @Property(
052            key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY,
053            defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE,
054            name = "Skip design analysis",
055            project = true,
056            global = true,
057            category = CoreProperties.CATEGORY_JAVA)
058    })
059    public final class SquidPlugin extends SonarPlugin {
060    
061      public List getExtensions() {
062        return Arrays.asList(SquidSensor.class, SquidRuleRepository.class, JavaSourceImporter.class,
063            ClassComplexityDistributionBuilder.class, FunctionComplexityDistributionBuilder.class, ClassesDecorator.class,
064            ChidamberKemererDistributionBuilder.class, FunctionsDecorator.class);
065      }
066    
067    }