コード例 #1
0
  public static void main(String[] args) {
    // TODO Auto-generated method stub
    projectName = globalConfig.getValue("project");
    projectConfig = new Config("config/" + projectName + ".properties");

    issues = (JSONArray) JSONUtil.readJsonFromFile(projectConfig.getValue("ISSUE_FILE"));
    smells = (JSONArray) JSONUtil.readJsonFromFile(projectConfig.getValue("SMELL_PKG"));
    addSmess2All();
    JSONUtil.writeJSONArray2File(issues, projectConfig.getValue("DEP_CON_PKG"));
    smells = (JSONArray) JSONUtil.readJsonFromFile(projectConfig.getValue("SMELL_ARC"));
    addSmess2All();
    JSONUtil.writeJSONArray2File(issues, projectConfig.getValue("DEP_CON_ARC"));
    smells = (JSONArray) JSONUtil.readJsonFromFile(projectConfig.getValue("SMELL_ACDC"));
    addSmess2All();
    JSONUtil.writeJSONArray2File(issues, projectConfig.getValue("DEP_CON_ACDC"));
    // StringUtil.printStringSet(getDirectoryPrefix());
    System.out.println("done! (๑•ᴗ•๑)♡‼");
  }
コード例 #2
0
 public static void addSmell2Issue(JSONObject issue) {
   JSONArray commits = (JSONArray) issue.get("commits");
   // iterate commits
   for (int commitIdx = 0; commitIdx < commits.size(); commitIdx++) {
     JSONObject commit = (JSONObject) commits.get(commitIdx);
     JSONArray files = (JSONArray) commit.get("files");
     // iterate files in each commit
     for (int fileIdx = 0; fileIdx < files.size(); fileIdx++) {
       JSONObject file = (JSONObject) files.get(fileIdx);
       String filename = (String) file.get("filename");
       String[] pkgPrefixs = projectConfig.getValue("PKG_PREFIX").split("#");
       if (StringUtil.isValidFilename(filename, pkgPrefixs)) {
         addSmell2File(issue, file, filename);
       }
     }
   }
 }