3636import org .sonar .api .config .Settings ;
3737import org .sonar .api .measures .CoreMetrics ;
3838import org .sonar .api .measures .Measure ;
39- import org .sonar .api .utils .ParsingUtils ;
4039import org .sonar .api .utils .StaxParser ;
4140import org .sonar .plugins .python .PythonReportSensor ;
4241
@@ -46,7 +45,6 @@ public class PythonXUnitSensor extends PythonReportSensor {
4645 public static final String REPORT_PATH_KEY = "sonar.python.xunit.reportPath" ;
4746 public static final String DEFAULT_REPORT_PATH = "xunit-reports/xunit-result-*.xml" ;
4847 public static final String SKIP_DETAILS = "sonar.python.xunit.skipDetails" ;
49- private static final double PERCENT_BASE = 100d ;
5048
5149 public PythonXUnitSensor (Settings conf , FileSystem fileSystem ) {
5250 super (conf , fileSystem );
@@ -97,10 +95,6 @@ private static void simpleMode(final SensorContext context, List<File> reports)
9795 }
9896
9997 if (testsCount > 0 ) {
100- double testsPassed = testsCount - testsErrors - testsFailures ;
101- double successDensity = testsPassed * PERCENT_BASE / testsCount ;
102- context .saveMeasure (CoreMetrics .TEST_SUCCESS_DENSITY , ParsingUtils .scaleValue (successDensity ));
103-
10498 context .saveMeasure (CoreMetrics .TESTS , testsCount );
10599 context .saveMeasure (CoreMetrics .SKIPPED_TESTS , testsSkipped );
106100 context .saveMeasure (CoreMetrics .TEST_ERRORS , testsErrors );
@@ -133,13 +127,6 @@ private void processReportDetailed(SensorContext context, Collection<TestSuite>
133127 context .saveMeasure (inputFile , CoreMetrics .TEST_ERRORS , (double ) fileReport .getErrors ());
134128 context .saveMeasure (inputFile , CoreMetrics .TEST_FAILURES , (double ) fileReport .getFailures ());
135129 context .saveMeasure (inputFile , CoreMetrics .TEST_EXECUTION_TIME , (double ) fileReport .getTime ());
136-
137- double testsRun = (double )fileReport .getTests () - fileReport .getSkipped ();
138- if (testsRun > 0 ) {
139- double passedTests = (double )fileReport .getTests () - fileReport .getErrors () - fileReport .getFailures () - fileReport .getSkipped ();
140- double successDensity = passedTests * PERCENT_BASE / testsRun ;
141- context .saveMeasure (inputFile , CoreMetrics .TEST_SUCCESS_DENSITY , ParsingUtils .scaleValue (successDensity ));
142- }
143130 context .saveMeasure (inputFile , new Measure (CoreMetrics .TEST_DATA , fileReport .getDetails ()));
144131 }
145132 }
@@ -171,10 +158,10 @@ private Collection<TestSuite> lookupResources(Collection<TestSuite> testReports)
171158 for (TestSuite report : testReports ) {
172159 String fileKey = report .getKey ();
173160
174- LOG .debug ("Trying to find a SonarQube resource for '{}' ... " , fileKey );
161+ LOG .debug ("Trying to find a SonarQube resource for '{}'" , fileKey );
175162 InputFile inputFile = findResource (fileKey );
176163 if (inputFile != null ) {
177- LOG .debug ("... found! The resource is '{}'" , inputFile );
164+ LOG .debug ("The resource was found '{}'" , inputFile );
178165
179166 TestSuite summaryReport = locatedReports .get (inputFile .absolutePath ());
180167 if (summaryReport != null ) {
@@ -184,7 +171,7 @@ private Collection<TestSuite> lookupResources(Collection<TestSuite> testReports)
184171 locatedReports .put (inputFile .absolutePath (), report );
185172 }
186173 } else {
187- LOG .debug ( "... cannot find the resource for '{}', drilling down to the details of this test wont be possible" , fileKey );
174+ LOG .warn ( "The resource for '{}' is not found , drilling down to the details of this test won't be possible" , fileKey );
188175 }
189176 }
190177
0 commit comments