File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
src/main/scala/codacy/dockerApi Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,22 @@ abstract class DockerEngine(Tool: Tool) {
15
15
def initTimeout (duration : FiniteDuration ) = {
16
16
implicit val ct : ExecutionContext = sys.dispatcher
17
17
sys.scheduler.scheduleOnce(duration){
18
- Runtime .getRuntime().halt(1 )
18
+ Runtime .getRuntime().halt(2 )
19
19
}
20
20
}
21
21
22
22
lazy val timeout = Option (System .getProperty(" timeout" )).flatMap{ case rawDuration =>
23
23
Try (Duration (rawDuration)).toOption.collect{ case d: FiniteDuration => d }
24
24
}.getOrElse(30 .minutes)
25
25
26
+ lazy val isDebug = Option (System .getProperty(" debug" )).flatMap{ case rawDuration =>
27
+ Try (rawDuration.toBoolean).toOption
28
+ }.getOrElse(false )
29
+
30
+ def log (message: String ): Unit = if (isDebug){
31
+ Console .err.print(s " [DockerEngine] $message" )
32
+ }
33
+
26
34
def main (args : Array [String ]): Unit = {
27
35
initTimeout(timeout)
28
36
@@ -37,6 +45,7 @@ abstract class DockerEngine(Tool: Tool) {
37
45
sourcePath.resolve(path.value)
38
46
}))
39
47
48
+ log(" tool started" )
40
49
Tool (
41
50
path = sourcePath,
42
51
conf = maybePatterns,
@@ -45,6 +54,7 @@ abstract class DockerEngine(Tool: Tool) {
45
54
}
46
55
} match {
47
56
case Success (results) =>
57
+ log(" receiving results" )
48
58
results.foreach {
49
59
case issue : Issue =>
50
60
val relativeIssue = issue.copy(filename = SourcePath (relativize(issue.filename.value)))
@@ -53,7 +63,7 @@ abstract class DockerEngine(Tool: Tool) {
53
63
val relativeIssue = error.copy(filename = SourcePath (relativize(error.filename.value)))
54
64
logResult(relativeIssue)
55
65
}
56
-
66
+ log( " tool finished " )
57
67
case Failure (error) =>
58
68
error.printStackTrace(Console .err)
59
69
System .exit(1 )
You can’t perform that action at this time.
0 commit comments