Search in sources :

Example 1 with DOACalculator

use of aserg.gtf.task.DOACalculator in project Truck-Factor by aserg-ufmg.

the class GitTruckFactor method calculateTF.

private static void calculateTF(String repositoryPath, String repositoryName, Map<String, List<LineInfo>> filesInfo, Map<String, List<LineInfo>> modulesInfo, FileInfoExtractor fileExtractor, LinguistExtractor linguistExtractor, GitLogExtractor gitLogExtractor, NewAliasHandler aliasHandler) throws Exception {
    Map<String, LogCommitInfo> commits = gitLogExtractor.execute();
    if (aliasHandler != null)
        commits = aliasHandler.execute(repositoryName, commits);
    List<NewFileInfo> files = fileExtractor.execute();
    files = linguistExtractor.setNotLinguist(files);
    if (filesInfo != null && filesInfo.size() > 0)
        if (filesInfo.containsKey(repositoryName))
            applyFilterFiles(filesInfo.get(repositoryName), files);
        else
            LOGGER.warn("No filesInfo for " + repositoryName);
    if (modulesInfo != null && modulesInfo.containsKey(repositoryName))
        setModules(modulesInfo.get(repositoryName), files);
    //Persist file info
    //fileExtractor.persist(files);
    DOACalculator doaCalculator = new DOACalculator(repositoryPath, repositoryName, commits.values(), files);
    Repository repository = doaCalculator.execute();
    //printFileAuthors(repository);
    //Persist authors info
    //doaCalculator.persist(repository);
    TruckFactor truckFactor = new GreedyTruckFactor();
    TFInfo tf = truckFactor.getTruckFactor(repository);
    System.out.println(tf);
}
Also used : Repository(aserg.gtf.model.authorship.Repository) TruckFactor(aserg.gtf.truckfactor.TruckFactor) GreedyTruckFactor(aserg.gtf.truckfactor.GreedyTruckFactor) TFInfo(aserg.gtf.truckfactor.TFInfo) LogCommitInfo(aserg.gtf.model.LogCommitInfo) GreedyTruckFactor(aserg.gtf.truckfactor.GreedyTruckFactor) DOACalculator(aserg.gtf.task.DOACalculator) NewFileInfo(aserg.gtf.model.NewFileInfo)

Example 2 with DOACalculator

use of aserg.gtf.task.DOACalculator in project Truck-Factor by aserg-ufmg.

the class GitTruckFactor method printCoverageInTime.

//Test: calculates the authorship variation on time 
private static void printCoverageInTime(String repositoryPath, String repositoryName, Map<String, List<LineInfo>> filesInfo, FileInfoExtractor fileExtractor, LinguistExtractor linguistExtractor, GitLogExtractor gitLogExtractor, NewAliasHandler aliasHandler) throws Exception {
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 2015);
    cal.set(Calendar.MONTH, Calendar.FEBRUARY);
    cal.set(Calendar.DAY_OF_MONTH, 25);
    String[] devsA = { "Yoann Delouis", "yDelouis" };
    //String devsA[] = {"WonderCsabo", "Damien"};
    List<String> devs = Arrays.asList(devsA);
    for (int i = 0; i < 24; i++) {
        Map<String, LogCommitInfo> commits = gitLogExtractor.execute();
        commits = aliasHandler.execute(repositoryName, commits);
        List<NewFileInfo> files = fileExtractor.execute();
        files = linguistExtractor.setNotLinguist(files);
        if (filesInfo != null)
            applyFilterFiles(filesInfo.get(repositoryName), files);
        Map<String, LogCommitInfo> newCommits = filterCommitsByDate(commits, cal.getTime());
        DOACalculator doaCalculator = new DOACalculator(repositoryPath, repositoryName, newCommits.values(), files);
        Repository repository = doaCalculator.execute();
        printCoverage(repository, devs, cal);
        cal.add(Calendar.MONTH, -1);
    }
}
Also used : Repository(aserg.gtf.model.authorship.Repository) Calendar(java.util.Calendar) LogCommitInfo(aserg.gtf.model.LogCommitInfo) DOACalculator(aserg.gtf.task.DOACalculator) NewFileInfo(aserg.gtf.model.NewFileInfo)

Example 3 with DOACalculator

use of aserg.gtf.task.DOACalculator in project Truck-Factor by aserg-ufmg.

the class GitTruckFactorRepList method main.

public static void main(String[] args) throws IOException {
    String[] repArray = { "activeadmin/activeadmin", "ajaxorg/ace", "alexreisner/geocoder", "android/platform_frameworks_base", "ansible/ansible", "apache/cassandra", "atom/atom-shell", "bbatsov/rubocop", "bitcoin/bitcoin", "bjorn/tiled", "boto/boto", "bumptech/glide", "bundler/bundler", "bup/bup", "BVLC/caffe", "caskroom/homebrew-cask", "celery/celery", "celluloid/celluloid", "chef/chef", "clojure/clojure", "cocos2d/cocos2d-x", "codemirror/CodeMirror", "composer/composer", "cucumber/cucumber", "diaspora/diaspora", "divio/django-cms", "django/django", "driftyco/ionic", "dropwizard/dropwizard", "dropwizard/metrics", "drupal/drupal", "elasticsearch/elasticsearch", "elasticsearch/logstash", "emberjs/ember.js", "erikhuda/thor", "Eugeny/ajenti", "excilys/androidannotations", "facebook/osquery", "facebook/presto", "fog/fog", "FriendsOfPHP/PHP-CS-Fixer", "fzaninotto/Faker", "getsentry/sentry", "git/git", "github/android", "github/linguist", "gradle/gradle", "gruntjs/grunt", "haml/haml", "Homebrew/homebrew", "iojs/io.js", "ipython/ipython", "Itseez/opencv", "jadejs/jade", "janl/mustache.js", "jashkenas/backbone", "jekyll/jekyll", "JetBrains/intellij-community", "jnicklas/capybara", "JohnLangford/vowpal_wabbit", "joomla/joomla-cms", "jquery/jquery", "jquery/jquery-ui", "jrburke/requirejs", "justinfrench/formtastic", "kivy/kivy", "koush/ion", "kriswallsmith/assetic", "Leaflet/Leaflet", "less/less.js", "libgdx/libgdx", "mailpile/Mailpile", "mbostock/d3", "meskyanichi/backup", "meteor/meteor", "mitchellh/vagrant", "mitsuhiko/flask", "moment/moment", "mongoid/mongoid", "mozilla/pdf.js", "mrdoob/three.js", "nate-parrott/Flashlight", "netty/netty", "nicolasgramlich/AndEngine", "odoo/odoo", "omab/django-social-auth", "openframeworks/openFrameworks", "paulasmuth/fnordmetric", "phacility/phabricator", "php/php-src", "plataformatec/devise", "powerline/powerline", "prawnpdf/prawn", "puphpet/puphpet", "puppetlabs/puppet", "pydata/pandas", "rails/rails", "ratchetphp/Ratchet", "ReactiveX/RxJava", "Respect/Validation", "resque/resque", "rg3/youtube-dl", "ruby/ruby", "saltstack/salt", "sampsyo/beets", "sandstorm-io/capnproto", "sass/sass", "scikit-learn/scikit-learn", "sebastianbergmann/phpunit", "Seldaek/monolog", "sferik/twitter", "SFTtech/openage", "Shopify/active_merchant", "silexphp/Silex", "sparklemotion/nokogiri", "spotify/luigi", "spring-projects/spring-framework", "sstephenson/sprockets", "strongloop/express", "substack/node-browserify", "thinkaurelius/titan", "ThinkUpLLC/ThinkUp", "thoughtbot/factory_girl", "thoughtbot/paperclip", "thumbor/thumbor", "torvalds/linux", "TryGhost/Ghost", "v8/v8", "webscalesql/webscalesql-5.6", "WordPress/WordPress", "wp-cli/wp-cli", "xetorthio/jedis", "yiisoft/yii2" };
    GitTruckFactor.loadConfiguration();
    System.out.println("BEGIN at " + new Date() + "\n\n");
    //fileExtractor.persist(files);
    String step = "begin";
    String repositoryPath;
    String repositoryName = "";
    for (int i = 0; i < repArray.length; i++) {
        try {
            step = "begin";
            repositoryPath = "E:/backups/icpc-selected-repos-logs/" + repArray[i].replace('/', '-') + "/";
            repositoryName = repArray[i];
            Map<String, List<LineInfo>> filesInfo = FileInfoReader.getFileInfo("repo_info/filtered-files.txt");
            Map<String, List<LineInfo>> aliasInfo = FileInfoReader.getFileInfo("repo_info/alias.txt");
            GitLogExtractor gitLogExtractor = new GitLogExtractor(repositoryPath, repositoryName);
            //		AliasHandler aliasHandler = new AliasHandler(aliasInfo.get(repositoryName));
            NewAliasHandler aliasHandler = new NewAliasHandler(aliasInfo.get(repositoryName));
            FileInfoExtractor fileExtractor = new FileInfoExtractor(repositoryPath, repositoryName);
            LinguistExtractor linguistExtractor = new LinguistExtractor(repositoryPath, repositoryName);
            step = "logextractor";
            Map<String, LogCommitInfo> commits = gitLogExtractor.execute();
            step = "aliashandler";
            commits = aliasHandler.execute(repositoryName, commits);
            //				step = "commits persist";
            //				gitLogExtractor.persist(commits);
            step = "fileExtractor";
            List<NewFileInfo> files = fileExtractor.execute();
            step = "linguist";
            files = linguistExtractor.setNotLinguist(files);
            //				step = "files persist";
            //				fileExtractor.persist(files);
            step = "DOA Calculator";
            DOACalculator doaCalculator = new DOACalculator(repositoryPath, repositoryName, commits.values(), files);
            Repository repository = doaCalculator.execute();
            //step = "Doa Persist";
            //doaCalculator.persist(repository);
            step = "TF";
            TruckFactor truckFactor = new GreedyTruckFactor();
            TFInfo tf = truckFactor.getTruckFactor(repository);
            System.out.println(repository.getFullName() + ": " + tf.getTf());
        } catch (Exception e) {
            System.err.format("\nException in GitTruckFactor: %s step: %s\n", repositoryName, step);
            e.printStackTrace();
        }
    }
    System.out.println("\n\nEND at " + new Date());
}
Also used : TruckFactor(aserg.gtf.truckfactor.TruckFactor) GreedyTruckFactor(aserg.gtf.truckfactor.GreedyTruckFactor) LogCommitInfo(aserg.gtf.model.LogCommitInfo) NewAliasHandler(aserg.gtf.task.NewAliasHandler) Date(java.util.Date) IOException(java.io.IOException) Repository(aserg.gtf.model.authorship.Repository) TFInfo(aserg.gtf.truckfactor.TFInfo) GitLogExtractor(aserg.gtf.task.extractor.GitLogExtractor) GreedyTruckFactor(aserg.gtf.truckfactor.GreedyTruckFactor) List(java.util.List) FileInfoExtractor(aserg.gtf.task.extractor.FileInfoExtractor) LinguistExtractor(aserg.gtf.task.extractor.LinguistExtractor) DOACalculator(aserg.gtf.task.DOACalculator) NewFileInfo(aserg.gtf.model.NewFileInfo)

Aggregations

LogCommitInfo (aserg.gtf.model.LogCommitInfo)3 NewFileInfo (aserg.gtf.model.NewFileInfo)3 Repository (aserg.gtf.model.authorship.Repository)3 DOACalculator (aserg.gtf.task.DOACalculator)3 GreedyTruckFactor (aserg.gtf.truckfactor.GreedyTruckFactor)2 TFInfo (aserg.gtf.truckfactor.TFInfo)2 TruckFactor (aserg.gtf.truckfactor.TruckFactor)2 NewAliasHandler (aserg.gtf.task.NewAliasHandler)1 FileInfoExtractor (aserg.gtf.task.extractor.FileInfoExtractor)1 GitLogExtractor (aserg.gtf.task.extractor.GitLogExtractor)1 LinguistExtractor (aserg.gtf.task.extractor.LinguistExtractor)1 IOException (java.io.IOException)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 List (java.util.List)1