Exemplo n.º 1
0
        private Hotspot ConvertToHotspot(SonarQubeHotspot sonarQubeHotspot)
        {
            var localFilePath = absoluteFilePathLocator.Locate(sonarQubeHotspot.FilePath);
            var priority      = GetPriority(sonarQubeHotspot.Rule.VulnerabilityProbability);

            var sqRule = sonarQubeHotspot.Rule;
            var rule   = new HotspotRule(
                sqRule.RuleKey,
                sqRule.RuleName,
                sqRule.SecurityCategory,
                priority,
                sqRule.RiskDescription,
                sqRule.VulnerabilityDescription,
                sqRule.FixRecommendations
                );

            var hotspot = new Hotspot(
                hotspotKey: sonarQubeHotspot.HotspotKey,
                filePath: localFilePath,
                serverFilePath: sonarQubeHotspot.FilePath,
                message: sonarQubeHotspot.Message,
                startLine: sonarQubeHotspot.TextRange.StartLine,
                endLine: sonarQubeHotspot.TextRange.EndLine,
                startLineOffset: sonarQubeHotspot.TextRange.StartOffset,
                endLineOffset: sonarQubeHotspot.TextRange.EndOffset,
                lineHash: sonarQubeHotspot.LineHash,
                rule: rule,
                createTimestamp: sonarQubeHotspot.CreationTimestamp,
                lastUpdateTimestamp: sonarQubeHotspot.LastUpdateTimestamp,
                flows: null);

            return(hotspot);
        }
Exemplo n.º 2
0
        public void Ctor_PropertiesSet()
        {
            IHotspotRule rule = new HotspotRule("key", "name", "sec cat", HotspotPriority.Medium, "risk", "vuln", "fix");

            rule.RuleKey.Should().Be("key");
            rule.RuleName.Should().Be("name");
            rule.SecurityCategory.Should().Be("sec cat");
            rule.Priority.Should().Be(HotspotPriority.Medium);
            rule.RiskDescription.Should().Be("risk");
            rule.VulnerabilityDescription.Should().Be("vuln");
            rule.FixRecommendations.Should().Be("fix");
        }