001/*
002 * SonarQube
003 * Copyright (C) 2009-2017 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.sensor.issue;
021
022import java.util.List;
023import javax.annotation.CheckForNull;
024import org.sonar.api.batch.rule.Severity;
025import org.sonar.api.batch.sensor.Sensor;
026import org.sonar.api.rule.RuleKey;
027
028/**
029 * Represents an issue detected by a {@link Sensor}.
030 *
031 * @since 5.1
032 */
033public interface Issue {
034
035  interface Flow {
036    /**
037     * @return Ordered list of locations for the execution flow
038     */
039    List<IssueLocation> locations();
040  }
041
042  /**
043   * The {@link RuleKey} of this issue.
044   */
045  RuleKey ruleKey();
046
047  /**
048   * Effort to fix the issue. Used by technical debt model.
049   * @deprecated since 5.5 use {@link #gap()}
050   */
051  @CheckForNull
052  @Deprecated
053  Double effortToFix();
054
055  /**
056   * Gap used to compute the effort for fixing the issue.
057   * @since 5.5
058   */
059  @CheckForNull
060  Double gap();
061
062  /**
063   * Overridden severity.
064   */
065  @CheckForNull
066  Severity overriddenSeverity();
067
068  /**
069   * Primary locations for this issue.
070   * @since 5.2
071   */
072  IssueLocation primaryLocation();
073
074  /**
075   * List of flows for this issue. Can be empty.
076   * @since 5.2
077   */
078  List<Flow> flows();
079
080}