Skip to content

Commit

Permalink
add flags for printing only smells or dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
blueoly committed Feb 13, 2020
1 parent 8e6818c commit 5c2b5c9
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions src/main/java/gr/aueb/balab/jadolint/Jadolint.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,20 @@ public static void main(String[] args){
return;
}

boolean depsFlag = false;

boolean smellsFlag = false;

String path = args[0];

if(args.length > 1){
if(args[1].equals("--deps"))
depsFlag = true;

if(args[1].equals("--smells"))
smellsFlag = true;
}

LineMerger l = new LineMerger();
Dockerfile doc = new Dockerfile();

Expand Down Expand Up @@ -99,17 +111,22 @@ public static void main(String[] args){

getDependencies2(path, doc);

for(Violation v : doc.getViolations())
System.out.println(v.getFileName() + " " + v.getLineNumber() + " " + v.getCode() + " " + v.getMessage());
if(args.length == 1 || smellsFlag == true){
for(Violation v : doc.getViolations())
System.out.println(v.getFileName() + " " + v.getLineNumber() + " " + v.getCode() + " " + v.getMessage());
}

System.out.println("-----");
if(args.length == 1)
System.out.println("-----");

for(Dependency d : doc.getDependencies()){
System.out.print(d.getPackageName().trim());
if(d.getPackageVersion() != null)
System.out.println(" " + d.getPackageVersion());
else
System.out.println();
if(args.length == 1 || depsFlag == true){
for(Dependency d : doc.getDependencies()){
System.out.print(d.getPackageName().trim());
if(d.getPackageVersion() != null)
System.out.println(" " + d.getPackageVersion());
else
System.out.println();
}
}
} catch (IOException ex) {
Logger.getLogger(Jadolint.class.getName()).log(Level.SEVERE, null, ex);
Expand Down

0 comments on commit 5c2b5c9

Please # to comment.