Interface NewIssue


  • public interface NewIssue
    Represents an issue detected by a Sensor.
    Since:
    5.1
    • Method Detail

      • gap

        NewIssue gap​(@Nullable
                     java.lang.Double gap)
        Gap used for the computation of the effort.
        Since:
        5.5
      • overrideImpact

        NewIssue overrideImpact​(SoftwareQuality softwareQuality,
                                Severity severity)
        Override severity of an impact defined by the rule. The impact for the SoftwareQuality must have already been defined by the rule.
        Since:
        10.1
      • addLocation

        NewIssue addLocation​(NewIssueLocation secondaryLocation)
        Add a secondary location for this issue. Several secondary locations can be registered.
        Since:
        5.2
      • setQuickFixAvailable

        NewIssue setQuickFixAvailable​(boolean quickFixAvailable)
        Register if a QuickFix would be available on SonarLint for this issue.
        Since:
        9.2
      • addFlow

        NewIssue addFlow​(java.lang.Iterable<NewIssueLocation> flowLocations)
        Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue. It should be a path that backtracks the issue from its primary location to the start of the flow. Several flows can be registered. The type of the flow will be undefined.
        Since:
        5.2
      • addFlow

        NewIssue addFlow​(java.lang.Iterable<NewIssueLocation> flowLocations,
                         NewIssue.FlowType flowType,
                         @Nullable
                         java.lang.String flowDescription)
        Register a flow for this issue. A flow is an ordered list of issue locations that help to understand the issue. It should be a path that backtracks the issue from its primary location to the start of the flow. Several flows can be registered.
        Parameters:
        flowType - specifies type of flow that is being added. For details see FlowType.
        flowDescription - optional description associated with a flow.
        Since:
        9.11
      • newLocation

        NewIssueLocation newLocation()
        Create a new location for this issue. First registered location is considered as primary location.
        Since:
        5.2
      • newQuickFix

        NewQuickFix newQuickFix()
        Create a new quick fix. Use addQuickFix(NewQuickFix) to finish registering the new quick fix.
        Returns:
        a new uninitialized instance of a quick fix for this issue
        Since:
        9.13
      • addQuickFix

        NewIssue addQuickFix​(NewQuickFix newQuickFix)
        Add a new quick fix to this issue. While products should do their best to display quick fixes in the order they are contributed, sometimes due to external factors the quick fixes might be displayed in a different order.
        Parameters:
        newQuickFix - the quick fix to add
        Returns:
        this object
        Since:
        9.13
      • save

        void save()
        Save the issue. If rule key is unknown or rule not enabled in the current quality profile then a warning is logged but no exception is thrown.
      • setRuleDescriptionContextKey

        NewIssue setRuleDescriptionContextKey​(@Nullable
                                              java.lang.String ruleDescriptionContextKey)
        Set the optional rule description section context key. The key needs to match the one present in Context.getKey().
        Since:
        9.8
      • setCodeVariants

        NewIssue setCodeVariants​(@Nullable
                                 java.lang.Iterable<java.lang.String> codeVariants)
        Registers a list of code variants for this issue. In C and C++, it is commonplace to have multiple code variants. Two source codes are defined here as variants of each other if there is any difference in their preprocessed source code.
        Since:
        9.17