@Test void should_execute_pmd_on_source_files_and_test_files() { DefaultInputFile srcFile = file("src/Class.java", Type.MAIN); DefaultInputFile tstFile = file("test/ClassTest.java", Type.TEST); setupPmdRuleSet(PmdConstants.REPOSITORY_KEY, "simple.xml"); setupPmdRuleSet(PmdConstants.TEST_REPOSITORY_KEY, "junit.xml"); fileSystem.add(srcFile); fileSystem.add(tstFile); Report report = pmdExecutor.execute(); assertThat(report).isNotNull(); verify(pmdConfiguration).dumpXmlReport(report); settings.removeProperty(PmdConstants.JAVA_SOURCE_VERSION); report = pmdExecutor.execute(); assertThat(report).isNotNull(); verify(pmdConfiguration).dumpXmlReport(report); }
public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } PmdExecutor(FileSystem fileSystem, ActiveRules rulesProfile,
                       PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Configuration settings); }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } PmdExecutor(FileSystem fileSystem, ActiveRules rulesProfile,
                       PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Configuration settings); Report execute(); }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } PmdExecutor(FileSystem fileSystem, ActiveRules rulesProfile,
                       PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Configuration settings); Report execute();  }