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 */ 020 package org.sonar.plugins.cpd; 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.cpd.decorators.DuplicationDensityDecorator; 027 import org.sonar.plugins.cpd.decorators.SumDuplicationsDecorator; 028 import org.sonar.plugins.cpd.index.IndexFactory; 029 030 import java.util.Arrays; 031 import java.util.List; 032 033 @Properties({ 034 @Property( 035 key = CoreProperties.CPD_ENGINE, 036 defaultValue = CoreProperties.CPD_ENGINE_DEFAULT_VALUE, 037 name = "Copy&Paste detection engine", 038 description = "Sonar embeds its own CPD engine since Sonar 2.11, but it's still possible to use the old PMD CPD engine (value 'pmd')." + 039 " Some Sonar users might want to keep on working with PMD CPD engine for instance to prevent any impact on measures during an upgrade of Sonar." + 040 " Moreover this Sonar CPD engine is not supported by all Sonar language plugins and when this support is not available," + 041 " the PMD CPD engine is automatically selected.", 042 project = true, 043 module = true, 044 global = true, 045 category = CoreProperties.CATEGORY_DUPLICATIONS), 046 @Property( 047 key = CoreProperties.CPD_CROSS_RPOJECT, 048 defaultValue = CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "", 049 name = "Cross project duplicaton detection", 050 description = "Sonar supports the detection of cross project duplications." + 051 " Activating this property will slightly increase each Sonar analysis time." + 052 " This mode can't be used along with the PMD CPD engine.", 053 project = true, 054 module = true, 055 global = true, 056 category = CoreProperties.CATEGORY_DUPLICATIONS), 057 @Property( 058 key = CoreProperties.CPD_MINIMUM_TOKENS_PROPERTY, 059 defaultValue = CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE + "", 060 name = "Minimum tokens", 061 description = "Deprecated property used only by the PMD CPD engine." + 062 " The number of duplicate tokens above which a block is considered as a duplication.", 063 project = true, 064 module = true, 065 global = true, 066 category = CoreProperties.CATEGORY_DUPLICATIONS), 067 @Property( 068 key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY, 069 defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "", 070 name = "Ignore literals", 071 description = "Deprecated property used only by the PMD CPD engine." + 072 " If true, PMD-CPD ignores literal value differences when evaluating a duplicate block." + 073 " This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.", 074 project = true, 075 module = true, 076 global = true, 077 category = CoreProperties.CATEGORY_DUPLICATIONS), 078 @Property( 079 key = CoreProperties.CPD_IGNORE_IDENTIFIERS_PROPERTY, 080 defaultValue = CoreProperties.CPD_IGNORE_IDENTIFIERS_DEFAULT_VALUE + "", 081 name = "Ignore identifiers", 082 description = "Deprecated property used only by the PMD CPD engine." + 083 " Similar to 'Ignore literals' but for identifiers; i.e., variable names, methods names, and so forth.", 084 project = true, 085 module = true, 086 global = true, 087 category = CoreProperties.CATEGORY_DUPLICATIONS) 088 }) 089 public class CpdPlugin extends SonarPlugin { 090 091 public List getExtensions() { 092 return Arrays.asList(CpdSensor.class, SumDuplicationsDecorator.class, DuplicationDensityDecorator.class, 093 IndexFactory.class, 094 SonarEngine.class, 095 PmdEngine.class, 096 SonarBridgeEngine.class); 097 } 098 099 }