public boolean analysisCancelled() { return context.isCancelled(); }
public boolean analysisCancelled() { return context.isCancelled(); }
public void scanFiles() { for (InputFile pythonFile : inputFiles) { if (context.isCancelled()) { return; } scanFile(pythonFile); } }
private static void checkCancelled(SensorContext context) { if (context.isCancelled()) { throw new CancellationException("Analysis cancelled"); } }
private static void checkCancelled(SensorContext context) { if (context.isCancelled()) { throw new CancellationException("Analysis cancelled"); } }
public void scanFiles() { for (InputFile pythonFile : inputFiles) { if (context.isCancelled()) { return; } try { scanFile(pythonFile); } catch (Exception e) { LOG.warn("Unable to analyze file '{}'. Error: {}", pythonFile.toString(), e); } } }
public void scanFiles() { for (InputFile pythonFile : inputFiles) { if (context.isCancelled()) { return; } scanFile(pythonFile); } if (!isSonarLint(context)) { (new PythonCoverageSensor()).execute(context); } }
@Override public void execute(SensorContext context) { List<InputFile> inputFiles = new ArrayList<>(); fileSystem.inputFiles(mainFilesPredicate).forEach(inputFiles::add); if (inputFiles.isEmpty()) { return; } boolean isSonarLintContext = context.runtime().getProduct() == SonarProduct.SONARLINT; ProgressReport progressReport = new ProgressReport("Report about progress of XML analyzer", TimeUnit.SECONDS.toMillis(10)); progressReport.start(inputFiles.stream().map(InputFile::toString).collect(Collectors.toList())); boolean cancelled = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { cancelled = true; break; } scanFile(context, inputFile, isSonarLintContext); progressReport.nextFile(); } } finally { if (!cancelled) { progressReport.stop(); } else { progressReport.cancel(); } } }
try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { cancelled = true; break;
public void analyseFiles(SensorContext context, Iterable<InputFile> inputFiles, ProgressReport progressReport) { boolean success = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { throw new CancellationException( "Analysis interrupted because the SensorContext is in cancelled state"); } analyse(context, inputFile); progressReport.nextFile(); } success = true; } catch (CancellationException e) { // do not propagate the exception LOGGER.debug(e.toString()); } finally { stopProgressReport(progressReport, success); } }
@VisibleForTesting protected void analyseFiles( SensorContext context, List<TreeVisitor> treeVisitors, Iterable<InputFile> inputFiles, ProductDependentExecutor executor, ProgressReport progressReport ) { boolean success = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { throw new CancellationException("Analysis interrupted because the SensorContext is in cancelled state"); } analyse(context, inputFile, executor, treeVisitors); progressReport.nextFile(); } success = true; } catch (CancellationException e) { // do not propagate the exception LOG.debug(e.toString()); } finally { stopProgressReport(progressReport, success); } }
@VisibleForTesting protected void analyseFiles( SensorContext context, List<TreeVisitor> treeVisitors, Iterable<InputFile> inputFiles, ProductDependentExecutor executor, ProgressReport progressReport ) { boolean success = false; try { for (InputFile inputFile : inputFiles) { if (context.isCancelled()) { throw new CancellationException("Analysis interrupted because the SensorContext is in cancelled state"); } analyse(context, inputFile, executor, treeVisitors); progressReport.nextFile(); } success = true; } catch (CancellationException e) { // do not propagate the exception LOG.debug(e.toString()); } finally { stopProgressReport(progressReport, success); } }
if (sensorContext.isCancelled()) { return;