Skip to content

Commit f3f9308

Browse files
committed
Merge pull request #111 from adangel:progressbar
Disable progress bar for PMD 7 #111
2 parents 7017965 + 8dd9a62 commit f3f9308

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

History.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
## Enhancements
66

7+
* [#108](https://github.com/pmd/pmd-regression-tester/issues/108): Disable progress bar for PMD 7
8+
79
## Fixed Issues
810

911
* [#107](https://github.com/pmd/pmd-regression-tester/issues/107): Deprecated command line options is used: `-auxclasspath`

lib/pmdtester/builders/pmd_report_builder.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ def generate_pmd_report(project)
104104
"-R #{project.get_config_path(@pmd_branch_name)} " \
105105
"-r #{project.get_pmd_report_path(@pmd_branch_name)} " \
106106
"#{fail_on_violation} -t #{@threads} " \
107-
"#{auxclasspath_option}"
107+
"#{auxclasspath_option}" \
108+
"#{pmd7? ? ' --no-progress' : ''}"
108109
start_time = Time.now
109110
if File.exist?(project.get_pmd_report_path(@pmd_branch_name))
110111
logger.warn "#{@pmd_branch_name}: Skipping PMD run - report " \
@@ -210,5 +211,9 @@ def create_auxclasspath_option(project)
210211
end
211212
auxclasspath_option
212213
end
214+
215+
def pmd7?
216+
Semver.compare(@pmd_version, '7.0.0-SNAPSHOT') >= 0
217+
end
213218
end
214219
end

test/test_pmd_report_builder.rb

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,29 @@ def test_build_long_cli_options
147147
.build
148148
end
149149

150+
def test_build_pmd7
151+
@pmd_version = '7.0.0-SNAPSHOT'
152+
project_list = 'test/resources/pmd_report_builder/project-list.xml'
153+
projects = PmdTester::ProjectsParser.new.parse(project_list)
154+
assert_equal(1, projects.size)
155+
argv = %w[-r target/repositories/pmd -b master -p pmd_releases/6.1.0
156+
-c config/design.xml --debug --error-recovery -l]
157+
argv.push project_list
158+
options = PmdTester::Options.new(argv)
159+
160+
projects[0].auxclasspath = 'extra:dirs'
161+
record_expectations('sha1abc', 'sha1abc', true)
162+
record_expectations_after_build
163+
record_expectations_project_build('sha1abc', true, true, true)
164+
165+
PmdTester::PmdReportBuilder
166+
.new(projects, options, options.base_config, options.base_branch)
167+
.build
168+
end
169+
150170
private
151171

152-
def record_expectations_project_build(sha1, error = false, long_cli_options = false)
172+
def record_expectations_project_build(sha1, error = false, long_cli_options = false, no_progress_bar = false)
153173
PmdTester::ProjectBuilder.any_instance.stubs(:clone_projects).once
154174
PmdTester::ProjectBuilder.any_instance.stubs(:build_projects).once
155175
PmdTester::SimpleProgressLogger.any_instance.stubs(:start).once
@@ -165,7 +185,8 @@ def record_expectations_project_build(sha1, error = false, long_cli_options = fa
165185
'-R target/reports/master/checkstyle/config.xml ' \
166186
'-r target/reports/master/checkstyle/pmd_report.xml ' \
167187
"#{fail_on_violation} -t 1 " \
168-
"#{auxclasspath}").once
188+
"#{auxclasspath}" \
189+
"#{no_progress_bar ? ' --no-progress' : ''}").once
169190
PmdTester::PmdReportDetail.any_instance.stubs(:save).once
170191
end
171192

0 commit comments

Comments
 (0)