001/* 002 * Sonar, open source software quality management tool. 003 * Copyright (C) 2008-2012 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 */ 020package org.sonar.plugins.squid; 021 022import com.google.common.collect.ImmutableList; 023import org.sonar.api.CoreProperties; 024import org.sonar.api.Extension; 025import org.sonar.api.Properties; 026import org.sonar.api.Property; 027import org.sonar.api.PropertyType; 028import org.sonar.api.SonarPlugin; 029import org.sonar.plugins.squid.decorators.ChidamberKemererDistributionBuilder; 030import org.sonar.plugins.squid.decorators.ClassesDecorator; 031import org.sonar.plugins.squid.decorators.FileComplexityDistributionDecorator; 032import org.sonar.plugins.squid.decorators.FunctionComplexityDistributionBuilder; 033import org.sonar.plugins.squid.decorators.FunctionsDecorator; 034 035import java.util.List; 036 037@Properties({ 038 @Property(key = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_PROPERTY, 039 defaultValue = SquidPluginProperties.SQUID_ANALYSE_ACCESSORS_DEFAULT_VALUE + "", 040 name = "Separate accessors", 041 description = "Flag whether Squid should separate accessors (getters/setters) from methods. " + 042 "In that case, accessors are not counted in metrics such as complexity or API documentation.", 043 project = true, 044 global = true, 045 category = CoreProperties.CATEGORY_JAVA, 046 type = PropertyType.BOOLEAN), 047 @Property(key = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION, 048 defaultValue = SquidPluginProperties.FIELDS_TO_EXCLUDE_FROM_LCOM4_COMPUTATION_DEFAULT_VALUE, 049 name = "List of fields to exclude from LCOM4 computation", 050 description = "Some fields should not be taken into account when computing LCOM4 measure as they " + 051 "unexpectedly and artificially decrease the LCOM4 measure. " 052 + "The best example is a logger used by all methods of a class. " + 053 "All field names to exclude from LCOM4 computation must be separated by a comma.", 054 project = true, 055 global = true, 056 category = CoreProperties.CATEGORY_JAVA), 057 @Property( 058 key = CoreProperties.DESIGN_SKIP_DESIGN_PROPERTY, 059 defaultValue = "" + CoreProperties.DESIGN_SKIP_DESIGN_DEFAULT_VALUE, 060 name = "Skip design analysis", 061 project = true, 062 global = true, 063 category = CoreProperties.CATEGORY_JAVA, 064 type = PropertyType.BOOLEAN) 065}) 066public final class SquidPlugin extends SonarPlugin { 067 068 public List<Class<? extends Extension>> getExtensions() { 069 return ImmutableList.of( 070 SquidSensor.class, 071 SquidRuleRepository.class, 072 JavaSourceImporter.class, 073 FileComplexityDistributionDecorator.class, 074 FunctionComplexityDistributionBuilder.class, 075 ClassesDecorator.class, 076 ChidamberKemererDistributionBuilder.class, 077 FunctionsDecorator.class); 078 } 079 080}