pmdtester 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +2 -2
- data/.github/workflows/manual-integration-tests.yml +2 -2
- data/.rubocop.yml +3 -0
- data/History.md +12 -0
- data/README.rdoc +1 -0
- data/lib/pmdtester/builders/pmd_report_builder.rb +16 -6
- data/lib/pmdtester/builders/project_builder.rb +15 -17
- data/lib/pmdtester/pmd_violation.rb +0 -3
- data/lib/pmdtester.rb +1 -1
- data/pmdtester.gemspec +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09f77b85a868975ac9f52380870bff0daf2d9467f15fe5e8ff02d68399a865a2'
|
4
|
+
data.tar.gz: c5a650a352d4fcab5efaf7588bc3774a37a8ddb845031453288527877ad12892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45f72e96a6dd7132dd8f207c75c11a7403e6acca9cfa5a345e628d7bc4122f3d4fbc044bca385a63e1360309b452651525a59e3f0afcd5924af5342b92d835a
|
7
|
+
data.tar.gz: 595759d8592b99b0264332528df6257ec35ebce98f206c92b08fca7d89935a70f8223cc5d206e5f0e91f48a5b31ca355b4a37c301c53b3877362b9b84a5d8746
|
data/.github/workflows/build.yml
CHANGED
@@ -20,8 +20,8 @@ jobs:
|
|
20
20
|
continue-on-error: false
|
21
21
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
22
22
|
steps:
|
23
|
-
- uses: actions/checkout@
|
24
|
-
- uses: actions/cache@
|
23
|
+
- uses: actions/checkout@v3
|
24
|
+
- uses: actions/cache@v3
|
25
25
|
with:
|
26
26
|
path: |
|
27
27
|
~/.m2/repository
|
data/.rubocop.yml
CHANGED
data/History.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# 1.5.2 / 2022-10-20
|
2
|
+
|
3
|
+
## Enhancements
|
4
|
+
|
5
|
+
* [#114](https://github.com/pmd/pmd-regression-tester/pull/114): Support new PMD 7 CLI interface
|
6
|
+
|
7
|
+
# 1.5.1 / 2022-05-12
|
8
|
+
|
9
|
+
## Fixed Issues
|
10
|
+
|
11
|
+
* [#106](https://github.com/pmd/pmd-regression-tester/issues/106): git clone/checkout fails when using commit sha1 as tag
|
12
|
+
|
1
13
|
# 1.5.0 / 2022-05-06
|
2
14
|
|
3
15
|
## Enhancements
|
data/README.rdoc
CHANGED
@@ -155,3 +155,4 @@ The tool creates the following folders:
|
|
155
155
|
* Push the tag. Github Actions will build and publish the new gem
|
156
156
|
* A github release is automatically created, verify it on https://github.com/pmd/pmd-regression-tester/releases
|
157
157
|
* To make pmd's main CI use the new version (in [pmd/pmd](https://github.com/pmd/pmd/)), go to the root directory and run `bundle lock --update`. Commit these changes.
|
158
|
+
* Rename milestone to version, close it and create a new "Next" milestone: https://github.com/pmd/pmd-regression-tester/milestones
|
@@ -96,11 +96,10 @@ module PmdTester
|
|
96
96
|
|
97
97
|
def generate_pmd_report(project)
|
98
98
|
error_recovery_options = @error_recovery ? 'PMD_JAVA_OPTS="-Dpmd.error_recovery -ea" ' : ''
|
99
|
-
|
100
|
-
fail_on_violation = should_use_long_cli_options ? '--fail-on-violation false' : '-failOnViolation false'
|
99
|
+
fail_on_violation = should_use_long_cli_options? ? '--fail-on-violation false' : '-failOnViolation false'
|
101
100
|
auxclasspath_option = create_auxclasspath_option(project)
|
102
101
|
pmd_cmd = "#{error_recovery_options}" \
|
103
|
-
"#{
|
102
|
+
"#{determine_run_path} -d #{project.local_source_path} -f xml " \
|
104
103
|
"-R #{project.get_config_path(@pmd_branch_name)} " \
|
105
104
|
"-r #{project.get_pmd_report_path(@pmd_branch_name)} " \
|
106
105
|
"#{fail_on_violation} -t #{@threads} " \
|
@@ -149,7 +148,7 @@ module PmdTester
|
|
149
148
|
|
150
149
|
PmdReportDetail.create(execution_time: execution_time, timestamp: end_time,
|
151
150
|
exit_code: exit_code, report_info_path: project.get_report_info_path(@pmd_branch_name))
|
152
|
-
logger.info "#{project.name}'s PMD report was generated successfully"
|
151
|
+
logger.info "#{project.name}'s PMD report was generated successfully (exit code: #{exit_code})"
|
153
152
|
end
|
154
153
|
|
155
154
|
@pmd_branch_details.execution_time = sum_time
|
@@ -200,7 +199,7 @@ module PmdTester
|
|
200
199
|
!Cmd.execute_successfully('git status --porcelain').empty?
|
201
200
|
end
|
202
201
|
|
203
|
-
def should_use_long_cli_options
|
202
|
+
def should_use_long_cli_options?
|
204
203
|
logger.debug "PMD Version: #{@pmd_version}"
|
205
204
|
Semver.compare(@pmd_version, '6.41.0') >= 0
|
206
205
|
end
|
@@ -208,7 +207,7 @@ module PmdTester
|
|
208
207
|
def create_auxclasspath_option(project)
|
209
208
|
auxclasspath_option = ''
|
210
209
|
unless project.auxclasspath.empty?
|
211
|
-
auxclasspath_option = should_use_long_cli_options ? '--aux-classpath ' : '-auxclasspath '
|
210
|
+
auxclasspath_option = should_use_long_cli_options? ? '--aux-classpath ' : '-auxclasspath '
|
212
211
|
auxclasspath_option += project.auxclasspath
|
213
212
|
end
|
214
213
|
auxclasspath_option
|
@@ -217,5 +216,16 @@ module PmdTester
|
|
217
216
|
def pmd7?
|
218
217
|
Semver.compare(@pmd_version, '7.0.0-SNAPSHOT') >= 0
|
219
218
|
end
|
219
|
+
|
220
|
+
def determine_run_path
|
221
|
+
run_path = "#{saved_distro_path(@pmd_branch_details.branch_last_sha)}/bin"
|
222
|
+
run_path = if File.exist?("#{run_path}/pmd")
|
223
|
+
# New PMD 7 CLI script (pmd/pmd#4059)
|
224
|
+
"#{run_path}/pmd check"
|
225
|
+
else
|
226
|
+
"#{run_path}/run.sh pmd"
|
227
|
+
end
|
228
|
+
run_path
|
229
|
+
end
|
220
230
|
end
|
221
231
|
end
|
@@ -19,22 +19,28 @@ module PmdTester
|
|
19
19
|
logger.info "Start cloning #{project.name} repository"
|
20
20
|
path = project.clone_root_path
|
21
21
|
|
22
|
+
raise "Unsupported project type '#{project.type}' - only git is supported" unless project.type == 'git'
|
23
|
+
|
22
24
|
if File.exist?(path)
|
23
25
|
logger.warn "Skipping clone, project path #{path} already exists"
|
24
26
|
else
|
25
|
-
|
26
|
-
|
27
|
-
# git:
|
28
|
-
# Don't download whole history
|
29
|
-
# Note we don't use --single-branch, because the repo is downloaded
|
30
|
-
# once but may be used with several tags.
|
31
|
-
clone_cmd = "git clone --no-single-branch --depth 1 #{project.connection} #{path}"
|
32
|
-
|
27
|
+
# Don't download whole history. This just fetches HEAD, the correct ref is fetched below.
|
28
|
+
clone_cmd = "git clone --single-branch --depth 1 #{project.connection} #{path}"
|
33
29
|
Cmd.execute_successfully(clone_cmd)
|
34
30
|
end
|
35
31
|
|
36
32
|
Dir.chdir(path) do
|
37
|
-
|
33
|
+
# this works with tags, branch names and (full-length) hashes
|
34
|
+
# first move to a different (temporary) branch, in case we are already on the branch that we want to update
|
35
|
+
Cmd.execute_successfully('git checkout -b fetched/temp')
|
36
|
+
# fetches any new commits. Could also be a tag.
|
37
|
+
Cmd.execute_successfully("git fetch --depth 1 origin #{project.tag}")
|
38
|
+
# update the branch to work on based on the new fetch. Creates a new branch if it doesn't exist already
|
39
|
+
Cmd.execute_successfully("git branch --force fetched/#{project.tag} FETCH_HEAD")
|
40
|
+
# checkout the updated branch
|
41
|
+
Cmd.execute_successfully("git checkout fetched/#{project.tag}")
|
42
|
+
# remove the temporary branch
|
43
|
+
Cmd.execute_successfully('git branch -D fetched/temp')
|
38
44
|
end
|
39
45
|
logger.info "Cloning #{project.name} completed"
|
40
46
|
end
|
@@ -93,13 +99,5 @@ module PmdTester
|
|
93
99
|
end
|
94
100
|
stdout
|
95
101
|
end
|
96
|
-
|
97
|
-
def execute_reset_cmd(type, tag)
|
98
|
-
raise "Unsupported project type '#{type}' - only git is supported" unless type == 'git'
|
99
|
-
|
100
|
-
reset_cmd = "git checkout #{tag}; git reset --hard #{tag}"
|
101
|
-
|
102
|
-
Cmd.execute_successfully(reset_cmd)
|
103
|
-
end
|
104
102
|
end
|
105
103
|
end
|
@@ -30,8 +30,6 @@ module PmdTester
|
|
30
30
|
attr_reader :fname, :info_url, :line, :old_line, :old_message, :rule_name, :ruleset_name, :language
|
31
31
|
attr_accessor :message
|
32
32
|
|
33
|
-
# rubocop:disable Metrics/ParameterLists
|
34
|
-
# Disable it: how is replacing a long parameter list with a single hash helping?
|
35
33
|
def initialize(branch:, fname:, info_url:, bline:, rule_name:, ruleset_name:)
|
36
34
|
@branch = branch
|
37
35
|
@fname = fname
|
@@ -49,7 +47,6 @@ module PmdTester
|
|
49
47
|
@old_message = nil
|
50
48
|
@old_line = nil
|
51
49
|
end
|
52
|
-
# rubocop:enable Metrics/ParameterLists
|
53
50
|
|
54
51
|
def line_move?(other)
|
55
52
|
message.eql?(other.message) && (line - other.line).abs <= 5
|
data/lib/pmdtester.rb
CHANGED
@@ -33,7 +33,7 @@ require_relative 'pmdtester/parsers/projects_parser'
|
|
33
33
|
# and unexpected behaviors will not be introduced to PMD project
|
34
34
|
# after fixing an issue and new rules can work as expected.
|
35
35
|
module PmdTester
|
36
|
-
VERSION = '1.5.
|
36
|
+
VERSION = '1.5.2'
|
37
37
|
BASE = 'base'
|
38
38
|
PATCH = 'patch'
|
39
39
|
PR_NUM_ENV_VAR = 'PMD_CI_PULL_REQUEST_NUMBER' # see PmdBranchDetail
|
data/pmdtester.gemspec
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake hoe:spec`.
|
2
2
|
|
3
3
|
# -*- encoding: utf-8 -*-
|
4
|
-
# stub: pmdtester 1.5.
|
4
|
+
# stub: pmdtester 1.5.2 ruby lib
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "pmdtester".freeze
|
8
|
-
s.version = "1.5.
|
8
|
+
s.version = "1.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
11
11
|
s.metadata = { "bug_tracker_uri" => "https://github.com/pmd/pmd-regression-tester/issues", "homepage_uri" => "https://pmd.github.io", "source_code_uri" => "https://github.com/pmd/pmd-regression-tester" } if s.respond_to? :metadata=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Andreas Dangel".freeze, "Binguo Bao".freeze, "Cl\u00E9ment Fournier".freeze]
|
14
|
-
s.date = "2022-
|
14
|
+
s.date = "2022-10-20"
|
15
15
|
s.description = "A regression testing tool ensure that new problems and unexpected behaviors will not be introduced to PMD project after fixing an issue , and new rules can work as expected.".freeze
|
16
16
|
s.email = ["andreas.dangel@pmd-code.org".freeze, "djydewang@gmail.com".freeze, "clement.fournier76@gmail.com".freeze]
|
17
17
|
s.executables = ["pmdtester".freeze]
|
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.add_development_dependency(%q<rubocop>.freeze, ["~> 0.93"])
|
43
43
|
s.add_development_dependency(%q<test-unit>.freeze, ["~> 3.5"])
|
44
44
|
s.add_development_dependency(%q<rdoc>.freeze, ["~> 6.4"])
|
45
|
-
s.add_development_dependency(%q<hoe>.freeze, ["~> 3.
|
45
|
+
s.add_development_dependency(%q<hoe>.freeze, ["~> 3.25"])
|
46
46
|
else
|
47
47
|
s.add_dependency(%q<nokogiri>.freeze, ["~> 1.13"])
|
48
48
|
s.add_dependency(%q<slop>.freeze, ["~> 4.6"])
|
@@ -57,7 +57,7 @@ Gem::Specification.new do |s|
|
|
57
57
|
s.add_dependency(%q<rubocop>.freeze, ["~> 0.93"])
|
58
58
|
s.add_dependency(%q<test-unit>.freeze, ["~> 3.5"])
|
59
59
|
s.add_dependency(%q<rdoc>.freeze, ["~> 6.4"])
|
60
|
-
s.add_dependency(%q<hoe>.freeze, ["~> 3.
|
60
|
+
s.add_dependency(%q<hoe>.freeze, ["~> 3.25"])
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pmdtester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Dangel
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-10-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -200,14 +200,14 @@ dependencies:
|
|
200
200
|
requirements:
|
201
201
|
- - "~>"
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: '3.
|
203
|
+
version: '3.25'
|
204
204
|
type: :development
|
205
205
|
prerelease: false
|
206
206
|
version_requirements: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
208
|
- - "~>"
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version: '3.
|
210
|
+
version: '3.25'
|
211
211
|
description: A regression testing tool ensure that new problems and unexpected behaviors
|
212
212
|
will not be introduced to PMD project after fixing an issue , and new rules can
|
213
213
|
work as expected.
|