001/* 002 * SonarQube 003 * Copyright (C) 2009-2018 SonarSource SA 004 * mailto:info AT sonarsource DOT com 005 * 006 * This program 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 * This program 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; 021 022import org.sonar.api.ExtensionPoint; 023import org.sonar.api.resources.Project; 024 025/** 026 * <p> 027 * A Sensor is invoked once during the analysis of a project. The sensor can parse a flat file, connect to a web server... Sensor are 028 * generally used to add measure at the lowest level of the resource tree. A sensor can access and save measures on the whole tree of 029 * resources. 030 * 031 * 032 * <p> 033 * For example the Cobertura Sensor parses Cobertura report and saves the first-level of measures on resources. 034 * 035 * 036 * <p> 037 * A particular attention should be given to resource exclusion. Sonar already manages exclusions at file level : if you try to save a 038 * measure on a resource that is excluded in the settings, then Sonar will not save the measure. When handling a plugin or an external tool, 039 * you should make sure that exclusions are passed if you are going to get back consolidated data. 040 * 041 * 042 * @since 1.10 043 * @deprecated since 5.6 use org.sonar.api.batch.sensor.Sensor 044 */ 045@Deprecated 046@ScannerSide 047@ExtensionPoint 048public interface Sensor extends CheckProject { 049 050 /** 051 * Sensors that depend upon Squid must declare the following method : 052 * 053 * <pre> 054 * @DependsUpon 055 * public String dependsUponSquidAnalysis() { 056 * return Sensor.FLAG_SQUID_ANALYSIS; 057 * } 058 * </pre> 059 */ 060 String FLAG_SQUID_ANALYSIS = "squid"; 061 062 /** 063 * The method that is going to be run when the sensor is called 064 * 065 * @param module the module the sensor runs on 066 * @param context the context 067 */ 068 void analyse(Project module, SensorContext context); 069 070}