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