Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07e6f19

Browse files
Tunings for large repos (#13)
* Keep stdout/stderr untouched, interception turned out to be more problematic* Set a reasonable heap size improved behaviour in bigger repos
1 parent4dc16a6 commit07e6f19

File tree

4 files changed

+8
-62
lines changed

4 files changed

+8
-62
lines changed

‎pmd.groovy

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
importgroovy.json.JsonSlurper
44
importgroovy.util.FileNameFinder
55

6-
76
classConfig {
87
def args
98
def appContext
@@ -79,13 +78,13 @@ class Config {
7978
}
8079
}
8180

82-
defisValid(json) {
83-
try {
84-
newJsonSlurper().parseText(json)
85-
returntrue
86-
}catch(Exception e) {
87-
returnfalse
88-
}
81+
defexecute(command) {
82+
ProcessBuilder builder=newProcessBuilder(command.split(''))
83+
builder.environment().put("HEAPSIZE","256m")
84+
Process process= builder.start()
85+
process.consumeProcessOutput(System.out,System.err)
86+
process.waitFor()
87+
System.exit(process.exitValue())
8988
}
9089

9190
/* ********** MAIN ***********/
@@ -95,26 +94,4 @@ if (config.noFiles()) {
9594
System.exit(0)
9695
}
9796

98-
def command="/usr/src/app/lib/pmd/bin/run.sh pmd -filelist${config.filesListPath()} -f codeclimate -R${config.ruleSet()} -failOnViolation false"
99-
100-
ProcessBuilder builder=newProcessBuilder(command.split(''))
101-
Process process= builder.start()
102-
103-
InputStream stdout= process.getInputStream()
104-
BufferedReader reader=newBufferedReader(newInputStreamReader(stdout))
105-
while ((line= reader.readLine())!=null) {
106-
if(isValid(line)) {
107-
System.out.println(line)
108-
}else {
109-
System.err.println(line)
110-
System.exit(-1)
111-
}
112-
}
113-
114-
process.waitForProcessOutput()
115-
116-
if (process.exitValue()!=0) {
117-
System.exit(-1)
118-
}
119-
120-
System.exit(0)
97+
execute("/usr/src/app/lib/pmd/bin/run.sh pmd -filelist${config.filesListPath()} -f codeclimate -R${config.ruleSet()} -failOnViolation false")

‎test.groovy

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ def abortOnBadConfig() {
4040
assert proc.exitValue()!=0
4141
}
4242

43-
defhandleBadOutput() {
44-
def (proc, out, err)= execute("/usr/src/app/pmd.groovy --codeFolder=/code/test --configFile=/code/test/config.problematic_rules.json")
45-
46-
assert!err.toString().isEmpty()
47-
assert proc.exitValue()!=0
48-
}
49-
5043
defengineCheckList() {
5144
def engine=newJsonSlurper().parse(newFile("engine.json"),"UTF-8")
5245
assert engine.name
@@ -81,4 +74,3 @@ dockerfileCheckList()
8174
sanityCheck()
8275
checkConfigBackwardCompatibility()
8376
abortOnBadConfig()
84-
handleBadOutput()

‎test/config.problematic_rules.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎test/problematic_rules.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp