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.*;
023    import org.sonar.api.PropertyType;
024    import org.sonar.plugins.cpd.decorators.DuplicationDensityDecorator;
025    import org.sonar.plugins.cpd.decorators.SumDuplicationsDecorator;
026    import org.sonar.plugins.cpd.index.IndexFactory;
027    
028    import java.util.Arrays;
029    import java.util.List;
030    
031    @Properties({
032      @Property(
033        key = CoreProperties.CPD_ENGINE,
034        defaultValue = CoreProperties.CPD_ENGINE_DEFAULT_VALUE,
035        name = "Copy&Paste detection engine",
036        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')." +
037          " 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." +
038          " Moreover this Sonar CPD engine is not supported by all Sonar language plugins and when this support is not available," +
039          " the PMD CPD engine is automatically selected.",
040        project = true,
041        module = true,
042        global = true,
043        category = CoreProperties.CATEGORY_DUPLICATIONS,
044        type = PropertyType.SINGLE_SELECT_LIST,
045        options = {"sonar", "pmd"}),
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        type = PropertyType.BOOLEAN),
058      @Property(
059        key = CoreProperties.CPD_MINIMUM_TOKENS_PROPERTY,
060        defaultValue = CoreProperties.CPD_MINIMUM_TOKENS_DEFAULT_VALUE + "",
061        name = "Minimum tokens",
062        description = "Deprecated property used only by the PMD CPD engine." +
063          " The number of duplicate tokens above which a block is considered as a duplication.",
064        project = true,
065        module = true,
066        global = true,
067        category = CoreProperties.CATEGORY_DUPLICATIONS,
068        type = PropertyType.INTEGER),
069      @Property(
070        key = CoreProperties.CPD_IGNORE_LITERALS_PROPERTY,
071        defaultValue = CoreProperties.CPD_IGNORE_LITERALS_DEFAULT_VALUE + "",
072        name = "Ignore literals",
073        description = "Deprecated property used only by the PMD CPD engine." +
074          " If true, PMD-CPD ignores literal value differences when evaluating a duplicate block." +
075          " This means that foo=\"first string\"; and foo=\"second string\"; will be seen as equivalent.",
076        project = true,
077        module = true,
078        global = true,
079        category = CoreProperties.CATEGORY_DUPLICATIONS,
080        type = PropertyType.BOOLEAN),
081      @Property(
082        key = CoreProperties.CPD_IGNORE_IDENTIFIERS_PROPERTY,
083        defaultValue = CoreProperties.CPD_IGNORE_IDENTIFIERS_DEFAULT_VALUE + "",
084        name = "Ignore identifiers",
085        description = "Deprecated property used only by the PMD CPD engine." +
086          " Similar to 'Ignore literals' but for identifiers; i.e., variable names, methods names, and so forth.",
087        project = true,
088        module = true,
089        global = true,
090        category = CoreProperties.CATEGORY_DUPLICATIONS,
091        type = PropertyType.BOOLEAN)
092    })
093    public final class CpdPlugin extends SonarPlugin {
094    
095      public List getExtensions() {
096        return Arrays.asList(CpdSensor.class, SumDuplicationsDecorator.class, DuplicationDensityDecorator.class,
097          IndexFactory.class,
098          SonarEngine.class,
099          PmdEngine.class,
100          SonarBridgeEngine.class);
101      }
102    
103    }