forked from tushartushar/DesigniteJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDesignite.java
More file actions
54 lines (49 loc) · 1.99 KB
/
Designite.java
File metadata and controls
54 lines (49 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package Designite;
import Designite.ArgumentParser.ArgumentParser;
import Designite.ArgumentParser.CLIArgumentParser;
import Designite.ArgumentParser.InputArgs;
import Designite.ArgumentParser.RegularArgumentParser;
import Designite.SourceModel.SM_Project;
import Designite.utils.Constants;
import Designite.utils.DJLogger;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
/**
* This is the start of the project
*/
public class Designite {
public static void main(String[] args) throws FileNotFoundException {
ArgumentParser argumentParser = (Constants.DEBUG) ? new RegularArgumentParser() : new CLIArgumentParser();
InputArgs argsObj = argumentParser.parseArguments(args);
DJLogger.getInstance().setOutputDirectory(argsObj.getOutputFolder());
SM_Project project = new SM_Project(argsObj);
project.parse();
project.resolve();
project.computeMetrics();
project.detectCodeSmells();
writeDebugLog(argsObj, project);
DJLogger.log("Done.");
}
private static void writeDebugLog(InputArgs argsObj, SM_Project project) {
if (Constants.DEBUG) {
PrintWriter writer = getDebugLogStream(argsObj);
project.printDebugLog(writer);
if (writer != null) writer.close();
}
}
private static PrintWriter getDebugLogStream(InputArgs argsObj) {
PrintWriter writer = null;
if (!argsObj.getOutputFolder().equals("")) {
String timeStamp = new SimpleDateFormat("ddMMyyyy_HHmm").format(Calendar.getInstance().getTime());
String filename = argsObj.getOutputFolder() + "DesigniteDebugLog" + timeStamp + ".txt";
try {
writer = new PrintWriter(filename);
} catch (FileNotFoundException ex) {
DJLogger.log(ex.getMessage());
}
}
return writer;
}
}