Skip to content

Commit 0724269

Browse files
author
Hariharan Ramanathan
committed
Implementing codacy suggestions
1 parent b252d4e commit 0724269

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/main/scala/de/upb/cs/swt/delphi/cli/DelphiCLI.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package de.upb.cs.swt.delphi.cli
1818

19+
import com.softwaremill.sttp._
1920
import de.upb.cs.swt.delphi.cli.commands._
2021

2122
/**
@@ -38,8 +39,6 @@ object DelphiCLI {
3839
cliParser.parse(args, Config()) match {
3940
case Some(c) =>
4041

41-
import com.softwaremill.sttp._
42-
import scala.concurrent.duration._
4342

4443
implicit val config: Config = c
4544
implicit val backend: SttpBackend[Id, Nothing] = HttpURLConnectionBackend()

src/main/scala/de/upb/cs/swt/delphi/cli/commands/RetrieveCommand.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package de.upb.cs.swt.delphi.cli.commands
1919
import com.softwaremill.sttp.{Id, SttpBackend}
2020
import de.upb.cs.swt.delphi.cli._
2121
import de.upb.cs.swt.delphi.cli.artifacts.RetrieveResult
22+
import de.upb.cs.swt.delphi.cli.artifacts.SearchResultJson._
2223
import spray.json._
2324

2425
import scala.io.Source
@@ -55,7 +56,6 @@ object RetrieveCommand extends Command {
5556
reportResult.apply(s)
5657
}
5758
if (!config.raw || !config.csv.equals("")) {
58-
import artifacts.SearchResultJson._
5959

6060
//TODO: Direct convertTo[List[RetrieveResult]] not working ???
6161

src/main/scala/de/upb/cs/swt/delphi/cli/commands/SearchCommand.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2018 The Delphi Team.
1+
// Copyright (C) 2018 The Delphi Team.
22
// See the LICENCE file distributed with this work for additional
33
// information regarding copyright ownership.
44
//
@@ -20,16 +20,17 @@ import java.util.concurrent.TimeUnit
2020

2121
import com.softwaremill.sttp._
2222
import com.softwaremill.sttp.sprayJson._
23+
import de.upb.cs.swt.delphi.cli.Config
2324
import de.upb.cs.swt.delphi.cli.artifacts.SearchResult
24-
import de.upb.cs.swt.delphi.cli.{Config, artifacts}
25+
import de.upb.cs.swt.delphi.cli.artifacts.SearchResultJson._
2526
import spray.json._
2627

2728
import scala.concurrent.duration._
2829

2930
object SearchCommand extends Command with DefaultJsonProtocol{
3031

3132
val searchTimeout = 10.seconds
32-
val TIMEOUT_CODE = 408
33+
val timeoutCode = 408
3334

3435
/**
3536
* Executes the command implementation
@@ -61,15 +62,14 @@ object SearchCommand extends Command with DefaultJsonProtocol{
6162
val end = System.nanoTime()
6263
val took = (end - start).nanos
6364

64-
if (res.code == TIMEOUT_CODE) {
65+
if (res.code == timeoutCode) {
6566

6667
error.apply(s"The query timed out after ${took.toSeconds} seconds. " +
6768
"To set a longer timeout, use the --timeout option.")
6869
}
6970
val resStr = res.body match {
7071
case Left(v) =>
7172
error.apply(s"Search request failed \n $v")
72-
println(v)
7373
None
7474
case Right(v) =>
7575
Some(v)
@@ -83,7 +83,6 @@ object SearchCommand extends Command with DefaultJsonProtocol{
8383
reportResult.apply(res)
8484
}
8585
if (!(config.raw || res.equals("")) || !config.csv.equals("")) {
86-
import artifacts.SearchResultJson._
8786
val jsonArr = res.parseJson.asInstanceOf[JsArray].elements
8887
val retrieveResults = jsonArr.map(r => r.convertTo[SearchResult]).toList
8988
onProperSearchResults(retrieveResults)

0 commit comments

Comments
 (0)