-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving Command-Parsing in OPAL with Scallop-Library #226
base: develop
Are you sure you want to change the base?
Conversation
DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/CallGraph.scala
Outdated
Show resolved
Hide resolved
...OPING_OPAL/tools/src/main/scala/org/opalj/support/parser/AnalysisCommandExternalParser.scala
Outdated
Show resolved
Hide resolved
...OPING_OPAL/tools/src/main/scala/org/opalj/support/parser/AnalysisCommandExternalParser.scala
Outdated
Show resolved
Hide resolved
...OPING_OPAL/tools/src/main/scala/org/opalj/support/parser/AnalysisCommandExternalParser.scala
Outdated
Show resolved
Hide resolved
...OPING_OPAL/tools/src/main/scala/org/opalj/support/parser/AnalysisCommandExternalParser.scala
Outdated
Show resolved
Hide resolved
DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/Purity.scala
Outdated
Show resolved
Hide resolved
DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/Purity.scala
Outdated
Show resolved
Hide resolved
DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/Purity.scala
Outdated
Show resolved
Hide resolved
DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/Purity.scala
Outdated
Show resolved
Hide resolved
DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/Purity.scala
Outdated
Show resolved
Hide resolved
# Conflicts: # DEVELOPING_OPAL/tools/src/main/scala/org/opalj/support/info/Purity.scala
Note that there is a compile error in the continuous integration that needs to be fixed |
val begin = Calendar.getInstance() | ||
Console.println(begin.getTime) | ||
|
||
time { | ||
if (purityConf.multiProjects.get) { | ||
for (subp <- purityConf.classPathFiles.get.head.listFiles().filter(_.isDirectory)) { | ||
for (subp <- purityConf.classPathFiles.get.flatMap(_.listFiles).filter(_.isDirectory)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a flatMap, make this two iterations (see https://docs.scala-lang.org/tour/for-comprehensions.html for an example)
object AnalysisCommandParser { | ||
def parse(runnerName: Option[String], analysisLevel: Option[String]): Option[FPCFLazyAnalysisScheduler] = | ||
runnerName.get match { | ||
case "Purity" => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right approach. One would have to change this class for every analysis that should be parsed as an analysis command. Instead, we would need a way to defer this parsing to an existing command, e.g. the FieldAssignabilityCommand, EscapeCommand, or, for the case that is now here, a PurityCommand.
|
||
class PurityConf(args: Array[String]) extends ScallopConf(args) with OpalConf { | ||
|
||
private object analysis extends Subcommand(AnalysisCommand.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lot of boiler plate. Can we get make something general out of this that we then just invoke from here?
subcommand.foreach(_.printHelp()) | ||
sys.exit(0) | ||
case ScallopException(message) => | ||
println(s"Error: $message") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should still use the OPALLogger facilities to print errors.
No description provided.