001/* 002 * SonarQube, open source software quality management tool. 003 * Copyright (C) 2008-2014 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * SonarQube 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 * SonarQube 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 License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020package org.sonar.api.batch.sensor; 021 022import com.google.common.annotations.Beta; 023import org.sonar.api.batch.fs.InputFile; 024 025/** 026 * Describe what a {@link Sensor} is doing. Information may be used by the platform 027 * to log interesting information or perform some optimization. 028 * See {@link Sensor#describe(SensorDescriptor)} 029 * @since 5.1 030 */ 031@Beta 032public interface SensorDescriptor { 033 034 /** 035 * Displayable name of the {@link Sensor}. Will be displayed in logs. 036 */ 037 SensorDescriptor name(String sensorName); 038 039 /** 040 * Language this {@link Sensor} work on. Used by the platform to skip execution of the {@link Sensor} when 041 * no file for given languages are present in the project. 042 * Default is to execute sensor for all languages. 043 */ 044 SensorDescriptor onlyOnLanguage(String languageKey); 045 046 /** 047 * List languages this {@link Sensor} work on. Used by the platform to skip execution of the {@link Sensor} when 048 * no file for given languages are present in the project. 049 * Default is to execute sensor for all languages. 050 */ 051 SensorDescriptor onlyOnLanguages(String... languageKeys); 052 053 /** 054 * {@link InputFile.Type} this {@link Sensor} work on. Used by the platform to skip execution of the {@link Sensor} when 055 * no file for given type are present in the project. 056 * Default is to execute sensor whatever are the available file types. 057 */ 058 SensorDescriptor onlyOnFileType(InputFile.Type type); 059 060 /** 061 * Rule repository this {@link Sensor} create issues for. Used by the platform to skip execution of the {@link Sensor} when 062 * no rule is activated for the given repository. 063 */ 064 SensorDescriptor createIssuesForRuleRepository(String... repositoryKey); 065 066 /** 067 * List rule repositories this {@link Sensor} create issues for. Used by the platform to skip execution of the {@link Sensor} when 068 * no rule is activated for the given repositories. 069 */ 070 SensorDescriptor createIssuesForRuleRepositories(String... repositoryKeys); 071 072 /** 073 * Property this {@link Sensor} depends on. Used by the platform to skip execution of the {@link Sensor} when 074 * property is not set. 075 */ 076 SensorDescriptor requireProperty(String... propertyKey); 077 078 /** 079 * List properties this {@link Sensor} depends on. Used by the platform to skip execution of the {@link Sensor} when 080 * property is not set. 081 */ 082 SensorDescriptor requireProperties(String... propertyKeys); 083 084 /** 085 * Should this sensor be disabled in preview mode. Default is to run all sensors in preview mode. 086 */ 087 SensorDescriptor disabledInPreview(); 088 089}