diff --git a/docs/ug/usingAuthorTags.md b/docs/ug/usingAuthorTags.md index 5d67dbe991..9056477304 100644 --- a/docs/ug/usingAuthorTags.md +++ b/docs/ug/usingAuthorTags.md @@ -15,8 +15,8 @@ If you want to override the code authorship deduced by RepoSense (which is based on Git blame/log data), you can use `@@author` tags to specify certain code segments that should be credited to a certain author irrespective of git history. An example scenario where this is useful is when a method was originally written by one author but a second author did some minor refactoring to it; in this case, RepoSense might attribute the code to the second author while you may want to attribute the code to the first author. There are 2 types of `@@author` tags: -- Start Tags (format: `@@author AUTHOR_GITHUB_ID`): A start tag indicates the start of a code segment written by the author identified by the `AUTHOR_GITHUB_ID`. -- End Tags (format: `@@author`): Optional. An end tag indicates the end of a code segment written by the author identified by the `AUTHOR_GITHUB_ID` of the start tag. +- Start Tags (format: `@@author AUTHOR_GIT_AUTHOR_NAME`): A start tag indicates the start of a code segment written by the author identified by the `AUTHOR_GIT_AUTHOR_NAME`. +- End Tags (format: `@@author`): Optional. An end tag indicates the end of a code segment written by the author identified by the `AUTHOR_GIT_AUTHOR_NAME` of the start tag. @@ -28,7 +28,7 @@ If an end tag is not provided, the code till the next start tag (or the end of t If an end tag is provided without a corresponding start tag, the code until the next start tag, the next end tag, or the end of the file, will not be attributed to any author. This should only be used if the code should not be attributed to any author. -The `@@author` tags should be enclosed within a comment, using the comment syntax of the file in concern. Below are some examples: +The `@@author` tags should be enclosed within a single-line comment, using the comment syntax of the file in concern. Below are some examples: ![author tags](../images/add-author-tags.png) @@ -46,11 +46,10 @@ Currently, the following comment formats are supported: -First, RepoSense checks whether the line matches the supported comment formats. If the line does not match the formats, -RepoSense treats it as a normal line. Else, it continues to check whether the GitHub username is in valid format. +RepoSense checks whether the line matches the supported comment formats. If the line does not match the formats, +RepoSense treats it as a normal line. -If the username is valid, the code till the next start tag, the end tag, or the end of file will be attributed to that author. -Otherwise, the code will not be attributed to any author. +The code until the next start tag, the end tag, or the end of file will be attributed to that author. Note: Remember to **commit** the files after the changes. (reason: RepoSense can see committed code only) diff --git a/src/main/java/reposense/authorship/analyzer/AnnotatorAnalyzer.java b/src/main/java/reposense/authorship/analyzer/AnnotatorAnalyzer.java index 9f870fd8e0..fbfba72a34 100644 --- a/src/main/java/reposense/authorship/analyzer/AnnotatorAnalyzer.java +++ b/src/main/java/reposense/authorship/analyzer/AnnotatorAnalyzer.java @@ -21,17 +21,14 @@ */ public class AnnotatorAnalyzer { private static final String AUTHOR_TAG = "@@author"; - // GitHub username format - private static final String REGEX_AUTHOR_NAME_FORMAT = "^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"; - private static final Pattern PATTERN_AUTHOR_NAME_FORMAT = Pattern.compile(REGEX_AUTHOR_NAME_FORMAT); - private static final String REGEX_AUTHOR_TAG_FORMAT = "@@author(\\s+[^\\s]+)?"; + private static final String REGEX_AUTHOR_TAG_FORMAT = "@@author(\\s+.*)?"; private static final String[][] COMMENT_FORMATS = { - {"//", "\\s"}, + {"//", null}, {"/\\*", "\\*/"}, - {"#", "\\s"}, + {"#", null}, {""}, - {"%", "\\s"}, + {"%", null}, {"\\[.*]:\\s*#\\s*\\(", "\\)"}, {""} }; @@ -106,11 +103,13 @@ public static Optional extractAuthorName(String line) { .map(l -> l.split(AUTHOR_TAG)) .filter(array -> array.length >= 2) // separates by end-comment format to obtain the author's name at the zeroth index - .map(array -> array[1].trim().split(COMMENT_FORMATS[getCommentTypeIndex(line)][1])) + .map(array -> COMMENT_FORMATS[getCommentTypeIndex(line)][1] != null + ? array[1].trim().split(COMMENT_FORMATS[getCommentTypeIndex(line)][1]) + : new String[]{ array[1].trim() }) .filter(array -> array.length > 0) .map(array -> array[0].trim()) - // checks if the author name is valid - .filter(trimmedParameters -> PATTERN_AUTHOR_NAME_FORMAT.matcher(trimmedParameters).find()); + // checks if the author name is not empty + .filter(trimmedParameters -> !trimmedParameters.isEmpty()); } /** @@ -118,6 +117,9 @@ public static Optional extractAuthorName(String line) { * flanked by {@code commentStart} and {@code commentEnd}. */ private static String generateCommentRegex(String commentStart, String commentEnd) { + if (commentEnd == null) { + return "^[\\s]*" + commentStart + "[\\s]*" + REGEX_AUTHOR_TAG_FORMAT + "[\\s]*$"; + } return "^[\\s]*" + commentStart + "[\\s]*" + REGEX_AUTHOR_TAG_FORMAT + "[\\s]*(" + commentEnd + ")?[\\s]*$"; } diff --git a/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/authorship.json b/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/authorship.json index b7546ad0d5..92ece1238c 100644 --- a/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/authorship.json +++ b/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/authorship.json @@ -1 +1 @@ -[{"path":"README.md","fileType":"md","lines":[{"lineNumber":1,"author":{"gitId":"eugenepeh"},"content":"This is a test repository for [RepoSense](https://github.com/reposense/RepoSense)."}],"authorContributionMap":{"eugenepeh":1}},{"path":"_reposense/config.json","fileType":"json","lines":[{"lineNumber":1,"author":{"gitId":"Eugene Peh"},"content":"{"},{"lineNumber":2,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"about-us/**\", \"**index.html\"],"},{"lineNumber":3,"author":{"gitId":"Eugene Peh"},"content":" \"formats\": [\"html\", \"css\"],"},{"lineNumber":4,"author":{"gitId":"FH-30"},"content":" \"ignoreCommitsList\": [\"\", \"67890def\"],"},{"lineNumber":5,"author":{"gitId":"Eugene Peh"},"content":" \"authors\":"},{"lineNumber":6,"author":{"gitId":"Eugene Peh"},"content":" ["},{"lineNumber":7,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":8,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"alice\","},{"lineNumber":9,"author":{"gitId":"Eugene Peh"},"content":" \"displayName\": \"Alice T.\","},{"lineNumber":10,"author":{"gitId":"Eugene Peh"},"content":" \"authorNames\": [\"AT\", \"A\"],"},{"lineNumber":11,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"**.css\"]"},{"lineNumber":12,"author":{"gitId":"Eugene Peh"},"content":" },"},{"lineNumber":13,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":14,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"bob\""},{"lineNumber":15,"author":{"gitId":"Eugene Peh"},"content":" }"},{"lineNumber":16,"author":{"gitId":"Eugene Peh"},"content":" ]"},{"lineNumber":17,"author":{"gitId":"Eugene Peh"},"content":"}"}],"authorContributionMap":{"FH-30":1,"Eugene Peh":16}},{"path":"annotationTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"fakeAuthor"},"content":"fake all the lines in this file is writtened by fakeAuthor"},{"lineNumber":2,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":5,"author":{"gitId":"harryggg"},"content":"//@@author harryggg"},{"lineNumber":6,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":7,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":8,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":9,"author":{"gitId":"harryggg"},"content":"//@@author"},{"lineNumber":10,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":11,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":12,"author":{"gitId":"-"},"content":"//@@author -invalidGitUsername_TreatedAsUnknownUser"},{"lineNumber":13,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":14,"author":{"gitId":"-"},"content":"System.out.println(\"//@@author invalidAuthorLineFormat\"); unknown"},{"lineNumber":15,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":16,"author":{"gitId":"-"},"content":"//@@author"},{"lineNumber":17,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":18,"author":{"gitId":"fakeAuthor"},"content":"//@@author harryggg invalidAuthorLineFormat"},{"lineNumber":19,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":20,"author":{"gitId":"-"},"content":"//@@author"},{"lineNumber":21,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":22,"author":{"gitId":"-"},"content":"unknown"}],"authorContributionMap":{"fakeAuthor":9,"harryggg":5,"-":8}},{"path":"blameTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 3"}],"authorContributionMap":{"fakeAuthor":1,"harryggg":3}},{"path":"newFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"}],"authorContributionMap":{"harryggg":2}},{"path":"newPos/movedFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 4"}],"authorContributionMap":{"harryggg":4}},{"path":"space test.txt","fileType":"txt","lines":[{"lineNumber":1,"author":{"gitId":"chan-j-d"},"content":"1"}],"authorContributionMap":{"chan-j-d":1}}] +[{"path":"README.md","fileType":"md","lines":[{"lineNumber":1,"author":{"gitId":"eugenepeh"},"content":"This is a test repository for [RepoSense](https://github.com/reposense/RepoSense)."}],"authorContributionMap":{"eugenepeh":1}},{"path":"_reposense/config.json","fileType":"json","lines":[{"lineNumber":1,"author":{"gitId":"Eugene Peh"},"content":"{"},{"lineNumber":2,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"about-us/**\", \"**index.html\"],"},{"lineNumber":3,"author":{"gitId":"Eugene Peh"},"content":" \"formats\": [\"html\", \"css\"],"},{"lineNumber":4,"author":{"gitId":"FH-30"},"content":" \"ignoreCommitsList\": [\"\", \"67890def\"],"},{"lineNumber":5,"author":{"gitId":"Eugene Peh"},"content":" \"authors\":"},{"lineNumber":6,"author":{"gitId":"Eugene Peh"},"content":" ["},{"lineNumber":7,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":8,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"alice\","},{"lineNumber":9,"author":{"gitId":"Eugene Peh"},"content":" \"displayName\": \"Alice T.\","},{"lineNumber":10,"author":{"gitId":"Eugene Peh"},"content":" \"authorNames\": [\"AT\", \"A\"],"},{"lineNumber":11,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"**.css\"]"},{"lineNumber":12,"author":{"gitId":"Eugene Peh"},"content":" },"},{"lineNumber":13,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":14,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"bob\""},{"lineNumber":15,"author":{"gitId":"Eugene Peh"},"content":" }"},{"lineNumber":16,"author":{"gitId":"Eugene Peh"},"content":" ]"},{"lineNumber":17,"author":{"gitId":"Eugene Peh"},"content":"}"}],"authorContributionMap":{"FH-30":1,"Eugene Peh":16}},{"path":"annotationTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"fakeAuthor"},"content":"fake all the lines in this file is writtened by fakeAuthor"},{"lineNumber":2,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":5,"author":{"gitId":"harryggg"},"content":"//@@author harryggg"},{"lineNumber":6,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":7,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":8,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":9,"author":{"gitId":"harryggg"},"content":"//@@author"},{"lineNumber":10,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":11,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":12,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"//@@author -invalidGitUsername_TreatedAsUnknownUser"},{"lineNumber":13,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"unknown"},{"lineNumber":14,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"System.out.println(\"//@@author invalidAuthorLineFormat\"); unknown"},{"lineNumber":15,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"unknown"},{"lineNumber":16,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"//@@author"},{"lineNumber":17,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":18,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"//@@author harryggg invalidAuthorLineFormat"},{"lineNumber":19,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"fake"},{"lineNumber":20,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"//@@author"},{"lineNumber":21,"author":{"gitId":"fakeAuthor"},"content":"unknown"},{"lineNumber":22,"author":{"gitId":"fakeAuthor"},"content":"unknown"}],"authorContributionMap":{"fakeAuthor":9,"-invalidGitUsername_TreatedAsUnknownUser":5,"harryggg":5,"harryggg invalidAuthorLineFormat":3}},{"path":"blameTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 3"}],"authorContributionMap":{"fakeAuthor":1,"harryggg":3}},{"path":"newFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"}],"authorContributionMap":{"harryggg":2}},{"path":"newPos/movedFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 4"}],"authorContributionMap":{"harryggg":4}},{"path":"space test.txt","fileType":"txt","lines":[{"lineNumber":1,"author":{"gitId":"chan-j-d"},"content":"1"}],"authorContributionMap":{"chan-j-d":1}}] diff --git a/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/commits.json b/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/commits.json index ebe340bcbd..240a62706b 100644 --- a/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/commits.json +++ b/src/systemtest/resources/LocalRepoSystemTest/testRelativePathing/parent1_test-repo_master/commits.json @@ -1 +1 @@ -{"authorDailyContributionsMap":{"chan-j-d":[{"date":"2021-08-22","commitResults":[{"hash":"5fdb7b10c2107fdeaff7fcc512fcec41eacc381e","messageTitle":"Add space test file","messageBody":"","fileTypesAndContributionMap":{"txt":{"insertions":1,"deletions":0}}}]}],"fakeAuthor":[{"date":"2018-02-08","commitResults":[{"hash":"768015345e70f06add2a8b7d1f901dc07bf70582","messageTitle":"fake","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":1}}}]},{"date":"2018-02-09","commitResults":[{"hash":"cd7f610e0becbdf331d5231887d8010a689f87c7","messageTitle":"moved","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151","messageTitle":"fake annotation:","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}},{"hash":"2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7","messageTitle":"fix annoation","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":2}}}]},{"date":"2021-04-05","commitResults":[{"hash":"c08107145269d5d5bb42ad78833774b7e5532977","messageTitle":"Add test lines for disowned code","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}}]},{"date":"2021-08-03","commitResults":[{"hash":"f34c20ec2c3be63e0764d4079a575dd75269ffeb","messageTitle":"Update annotationTest.java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":3}}}]}],"WANG CHAO":[],"FH-30":[{"date":"2021-08-25","commitResults":[{"hash":"af6087ebc0c689a9dcf3de0c3b2eb13ff47775d5","messageTitle":"Update standalone config to make it consistent with PR#1561","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":1,"deletions":1}}}]}],"harryggg":[{"date":"2018-02-05","commitResults":[{"hash":"fd425072e12004b71d733a58d819d845509f8db3","messageTitle":"Initial commit","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":0}}},{"hash":"05310e79fe8e54c5096bacc97b886ab24304d12b","messageTitle":"1","messageBody":"","fileTypesAndContributionMap":{"inMasterBranch":{"insertions":0,"deletions":0}}}]},{"date":"2018-02-06","commitResults":[{"hash":"7d7584fc204922cc5ff3bd5ca073cad6bed2c46a","messageTitle":"k","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"8d0ac2ee20f04dce8df0591caed460bffacb65a4","messageTitle":"java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":0}}}]},{"date":"2018-02-07","commitResults":[{"hash":"8e4ca1da5d413e9ab84a1e8d1474918afa97f7a1","messageTitle":"yo","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":0}}}]},{"date":"2018-02-09","commitResults":[{"hash":"e3f699fd4ef128eebce98d5b4e5b3bb06a512f49","messageTitle":"new","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":4,"deletions":0}}}]}],"Eugene Peh":[{"date":"2018-10-07","commitResults":[{"hash":"b28dfac5bd449825c1a372e58485833b35fdbd50","messageTitle":"Simulate error thrown by issue reposense/RepoSense#360 (#1)","messageBody":"","fileTypesAndContributionMap":{"attach_pid11612":{"insertions":0,"deletions":0}}}]},{"date":"2018-11-08","commitResults":[{"hash":"136c6713fc00cfe79a1598e8ce83c6ef3b878660","messageTitle":"Add config.json with invalid fields (#2)","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":17,"deletions":0}}}]}],"eugenepeh":[{"date":"2018-05-07","commitResults":[{"hash":"2d87a431fcbb8f73a731b6df0fcbee962c85c250","messageTitle":"README: update to reflect repository transition","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":1}}}]}]},"authorFileTypeContributionMap":{"chan-j-d":{"txt":1},"fakeAuthor":{"java":10},"WANG CHAO":{},"FH-30":{"json":1},"harryggg":{"java":14},"Eugene Peh":{"json":16},"eugenepeh":{"md":1}},"authorContributionVariance":{"chan-j-d":7.6982257E-4,"fakeAuthor":0.30051088,"WANG CHAO":0.0,"FH-30":0.00307929,"harryggg":0.023052901,"Eugene Peh":0.22248779,"eugenepeh":0.0030792993},"authorDisplayNameMap":{"chan-j-d":"chan-j-d","fakeAuthor":"fakeAuthor","WANG CHAO":"WANG CHAO","FH-30":"FH-30","harryggg":"harryggg","Eugene Peh":"Eugene Peh","eugenepeh":"eugenepeh"}} +{"authorDailyContributionsMap":{"chan-j-d":[{"date":"2021-08-22","commitResults":[{"hash":"5fdb7b10c2107fdeaff7fcc512fcec41eacc381e","messageTitle":"Add space test file","messageBody":"","fileTypesAndContributionMap":{"txt":{"insertions":1,"deletions":0}}}]}],"fakeAuthor":[{"date":"2018-02-08","commitResults":[{"hash":"768015345e70f06add2a8b7d1f901dc07bf70582","messageTitle":"fake","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":1}}}]},{"date":"2018-02-09","commitResults":[{"hash":"cd7f610e0becbdf331d5231887d8010a689f87c7","messageTitle":"moved","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151","messageTitle":"fake annotation:","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}},{"hash":"2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7","messageTitle":"fix annoation","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":2}}}]},{"date":"2021-04-05","commitResults":[{"hash":"c08107145269d5d5bb42ad78833774b7e5532977","messageTitle":"Add test lines for disowned code","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}}]},{"date":"2021-08-03","commitResults":[{"hash":"f34c20ec2c3be63e0764d4079a575dd75269ffeb","messageTitle":"Update annotationTest.java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":3}}}]}],"WANG CHAO":[],"-invalidGitUsername_TreatedAsUnknownUser":[],"FH-30":[{"date":"2021-08-25","commitResults":[{"hash":"af6087ebc0c689a9dcf3de0c3b2eb13ff47775d5","messageTitle":"Update standalone config to make it consistent with PR#1561","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":1,"deletions":1}}}]}],"harryggg":[{"date":"2018-02-05","commitResults":[{"hash":"fd425072e12004b71d733a58d819d845509f8db3","messageTitle":"Initial commit","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":0}}},{"hash":"05310e79fe8e54c5096bacc97b886ab24304d12b","messageTitle":"1","messageBody":"","fileTypesAndContributionMap":{"inMasterBranch":{"insertions":0,"deletions":0}}}]},{"date":"2018-02-06","commitResults":[{"hash":"7d7584fc204922cc5ff3bd5ca073cad6bed2c46a","messageTitle":"k","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"8d0ac2ee20f04dce8df0591caed460bffacb65a4","messageTitle":"java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":0}}}]},{"date":"2018-02-07","commitResults":[{"hash":"8e4ca1da5d413e9ab84a1e8d1474918afa97f7a1","messageTitle":"yo","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":0}}}]},{"date":"2018-02-09","commitResults":[{"hash":"e3f699fd4ef128eebce98d5b4e5b3bb06a512f49","messageTitle":"new","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":4,"deletions":0}}}]}],"harryggg invalidAuthorLineFormat":[],"Eugene Peh":[{"date":"2018-10-07","commitResults":[{"hash":"b28dfac5bd449825c1a372e58485833b35fdbd50","messageTitle":"Simulate error thrown by issue reposense/RepoSense#360 (#1)","messageBody":"","fileTypesAndContributionMap":{"attach_pid11612":{"insertions":0,"deletions":0}}}]},{"date":"2018-11-08","commitResults":[{"hash":"136c6713fc00cfe79a1598e8ce83c6ef3b878660","messageTitle":"Add config.json with invalid fields (#2)","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":17,"deletions":0}}}]}],"eugenepeh":[{"date":"2018-05-07","commitResults":[{"hash":"2d87a431fcbb8f73a731b6df0fcbee962c85c250","messageTitle":"README: update to reflect repository transition","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":1}}}]}]},"authorFileTypeContributionMap":{"chan-j-d":{"txt":1},"fakeAuthor":{"java":10},"WANG CHAO":{},"-invalidGitUsername_TreatedAsUnknownUser":{"java":5},"FH-30":{"json":1},"harryggg":{"java":14},"harryggg invalidAuthorLineFormat":{"java":3},"Eugene Peh":{"json":16},"eugenepeh":{"md":1}},"authorContributionVariance":{"chan-j-d":7.6982257E-4,"fakeAuthor":0.30051088,"WANG CHAO":0.0,"-invalidGitUsername_TreatedAsUnknownUser":0.0,"FH-30":0.00307929,"harryggg":0.023052901,"harryggg invalidAuthorLineFormat":0.0,"Eugene Peh":0.22248779,"eugenepeh":0.0030792993},"authorDisplayNameMap":{"chan-j-d":"chan-j-d","fakeAuthor":"fakeAuthor","WANG CHAO":"WANG CHAO","-invalidGitUsername_TreatedAsUnknownUser":"-invalidGitUsername_TreatedAsUnknownUser","FH-30":"FH-30","harryggg":"harryggg","harryggg invalidAuthorLineFormat":"harryggg invalidAuthorLineFormat","Eugene Peh":"Eugene Peh","eugenepeh":"eugenepeh"}} diff --git a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/authorship.json b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/authorship.json index b7546ad0d5..92ece1238c 100644 --- a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/authorship.json +++ b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/authorship.json @@ -1 +1 @@ -[{"path":"README.md","fileType":"md","lines":[{"lineNumber":1,"author":{"gitId":"eugenepeh"},"content":"This is a test repository for [RepoSense](https://github.com/reposense/RepoSense)."}],"authorContributionMap":{"eugenepeh":1}},{"path":"_reposense/config.json","fileType":"json","lines":[{"lineNumber":1,"author":{"gitId":"Eugene Peh"},"content":"{"},{"lineNumber":2,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"about-us/**\", \"**index.html\"],"},{"lineNumber":3,"author":{"gitId":"Eugene Peh"},"content":" \"formats\": [\"html\", \"css\"],"},{"lineNumber":4,"author":{"gitId":"FH-30"},"content":" \"ignoreCommitsList\": [\"\", \"67890def\"],"},{"lineNumber":5,"author":{"gitId":"Eugene Peh"},"content":" \"authors\":"},{"lineNumber":6,"author":{"gitId":"Eugene Peh"},"content":" ["},{"lineNumber":7,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":8,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"alice\","},{"lineNumber":9,"author":{"gitId":"Eugene Peh"},"content":" \"displayName\": \"Alice T.\","},{"lineNumber":10,"author":{"gitId":"Eugene Peh"},"content":" \"authorNames\": [\"AT\", \"A\"],"},{"lineNumber":11,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"**.css\"]"},{"lineNumber":12,"author":{"gitId":"Eugene Peh"},"content":" },"},{"lineNumber":13,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":14,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"bob\""},{"lineNumber":15,"author":{"gitId":"Eugene Peh"},"content":" }"},{"lineNumber":16,"author":{"gitId":"Eugene Peh"},"content":" ]"},{"lineNumber":17,"author":{"gitId":"Eugene Peh"},"content":"}"}],"authorContributionMap":{"FH-30":1,"Eugene Peh":16}},{"path":"annotationTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"fakeAuthor"},"content":"fake all the lines in this file is writtened by fakeAuthor"},{"lineNumber":2,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":5,"author":{"gitId":"harryggg"},"content":"//@@author harryggg"},{"lineNumber":6,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":7,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":8,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":9,"author":{"gitId":"harryggg"},"content":"//@@author"},{"lineNumber":10,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":11,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":12,"author":{"gitId":"-"},"content":"//@@author -invalidGitUsername_TreatedAsUnknownUser"},{"lineNumber":13,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":14,"author":{"gitId":"-"},"content":"System.out.println(\"//@@author invalidAuthorLineFormat\"); unknown"},{"lineNumber":15,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":16,"author":{"gitId":"-"},"content":"//@@author"},{"lineNumber":17,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":18,"author":{"gitId":"fakeAuthor"},"content":"//@@author harryggg invalidAuthorLineFormat"},{"lineNumber":19,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":20,"author":{"gitId":"-"},"content":"//@@author"},{"lineNumber":21,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":22,"author":{"gitId":"-"},"content":"unknown"}],"authorContributionMap":{"fakeAuthor":9,"harryggg":5,"-":8}},{"path":"blameTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 3"}],"authorContributionMap":{"fakeAuthor":1,"harryggg":3}},{"path":"newFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"}],"authorContributionMap":{"harryggg":2}},{"path":"newPos/movedFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 4"}],"authorContributionMap":{"harryggg":4}},{"path":"space test.txt","fileType":"txt","lines":[{"lineNumber":1,"author":{"gitId":"chan-j-d"},"content":"1"}],"authorContributionMap":{"chan-j-d":1}}] +[{"path":"README.md","fileType":"md","lines":[{"lineNumber":1,"author":{"gitId":"eugenepeh"},"content":"This is a test repository for [RepoSense](https://github.com/reposense/RepoSense)."}],"authorContributionMap":{"eugenepeh":1}},{"path":"_reposense/config.json","fileType":"json","lines":[{"lineNumber":1,"author":{"gitId":"Eugene Peh"},"content":"{"},{"lineNumber":2,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"about-us/**\", \"**index.html\"],"},{"lineNumber":3,"author":{"gitId":"Eugene Peh"},"content":" \"formats\": [\"html\", \"css\"],"},{"lineNumber":4,"author":{"gitId":"FH-30"},"content":" \"ignoreCommitsList\": [\"\", \"67890def\"],"},{"lineNumber":5,"author":{"gitId":"Eugene Peh"},"content":" \"authors\":"},{"lineNumber":6,"author":{"gitId":"Eugene Peh"},"content":" ["},{"lineNumber":7,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":8,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"alice\","},{"lineNumber":9,"author":{"gitId":"Eugene Peh"},"content":" \"displayName\": \"Alice T.\","},{"lineNumber":10,"author":{"gitId":"Eugene Peh"},"content":" \"authorNames\": [\"AT\", \"A\"],"},{"lineNumber":11,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"**.css\"]"},{"lineNumber":12,"author":{"gitId":"Eugene Peh"},"content":" },"},{"lineNumber":13,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":14,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"bob\""},{"lineNumber":15,"author":{"gitId":"Eugene Peh"},"content":" }"},{"lineNumber":16,"author":{"gitId":"Eugene Peh"},"content":" ]"},{"lineNumber":17,"author":{"gitId":"Eugene Peh"},"content":"}"}],"authorContributionMap":{"FH-30":1,"Eugene Peh":16}},{"path":"annotationTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"fakeAuthor"},"content":"fake all the lines in this file is writtened by fakeAuthor"},{"lineNumber":2,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":5,"author":{"gitId":"harryggg"},"content":"//@@author harryggg"},{"lineNumber":6,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":7,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":8,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":9,"author":{"gitId":"harryggg"},"content":"//@@author"},{"lineNumber":10,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":11,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":12,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"//@@author -invalidGitUsername_TreatedAsUnknownUser"},{"lineNumber":13,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"unknown"},{"lineNumber":14,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"System.out.println(\"//@@author invalidAuthorLineFormat\"); unknown"},{"lineNumber":15,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"unknown"},{"lineNumber":16,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"//@@author"},{"lineNumber":17,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":18,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"//@@author harryggg invalidAuthorLineFormat"},{"lineNumber":19,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"fake"},{"lineNumber":20,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"//@@author"},{"lineNumber":21,"author":{"gitId":"fakeAuthor"},"content":"unknown"},{"lineNumber":22,"author":{"gitId":"fakeAuthor"},"content":"unknown"}],"authorContributionMap":{"fakeAuthor":9,"-invalidGitUsername_TreatedAsUnknownUser":5,"harryggg":5,"harryggg invalidAuthorLineFormat":3}},{"path":"blameTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 3"}],"authorContributionMap":{"fakeAuthor":1,"harryggg":3}},{"path":"newFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"}],"authorContributionMap":{"harryggg":2}},{"path":"newPos/movedFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 4"}],"authorContributionMap":{"harryggg":4}},{"path":"space test.txt","fileType":"txt","lines":[{"lineNumber":1,"author":{"gitId":"chan-j-d"},"content":"1"}],"authorContributionMap":{"chan-j-d":1}}] diff --git a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/commits.json b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/commits.json index ebe340bcbd..240a62706b 100644 --- a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/commits.json +++ b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent1_test-repo_master/commits.json @@ -1 +1 @@ -{"authorDailyContributionsMap":{"chan-j-d":[{"date":"2021-08-22","commitResults":[{"hash":"5fdb7b10c2107fdeaff7fcc512fcec41eacc381e","messageTitle":"Add space test file","messageBody":"","fileTypesAndContributionMap":{"txt":{"insertions":1,"deletions":0}}}]}],"fakeAuthor":[{"date":"2018-02-08","commitResults":[{"hash":"768015345e70f06add2a8b7d1f901dc07bf70582","messageTitle":"fake","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":1}}}]},{"date":"2018-02-09","commitResults":[{"hash":"cd7f610e0becbdf331d5231887d8010a689f87c7","messageTitle":"moved","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151","messageTitle":"fake annotation:","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}},{"hash":"2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7","messageTitle":"fix annoation","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":2}}}]},{"date":"2021-04-05","commitResults":[{"hash":"c08107145269d5d5bb42ad78833774b7e5532977","messageTitle":"Add test lines for disowned code","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}}]},{"date":"2021-08-03","commitResults":[{"hash":"f34c20ec2c3be63e0764d4079a575dd75269ffeb","messageTitle":"Update annotationTest.java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":3}}}]}],"WANG CHAO":[],"FH-30":[{"date":"2021-08-25","commitResults":[{"hash":"af6087ebc0c689a9dcf3de0c3b2eb13ff47775d5","messageTitle":"Update standalone config to make it consistent with PR#1561","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":1,"deletions":1}}}]}],"harryggg":[{"date":"2018-02-05","commitResults":[{"hash":"fd425072e12004b71d733a58d819d845509f8db3","messageTitle":"Initial commit","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":0}}},{"hash":"05310e79fe8e54c5096bacc97b886ab24304d12b","messageTitle":"1","messageBody":"","fileTypesAndContributionMap":{"inMasterBranch":{"insertions":0,"deletions":0}}}]},{"date":"2018-02-06","commitResults":[{"hash":"7d7584fc204922cc5ff3bd5ca073cad6bed2c46a","messageTitle":"k","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"8d0ac2ee20f04dce8df0591caed460bffacb65a4","messageTitle":"java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":0}}}]},{"date":"2018-02-07","commitResults":[{"hash":"8e4ca1da5d413e9ab84a1e8d1474918afa97f7a1","messageTitle":"yo","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":0}}}]},{"date":"2018-02-09","commitResults":[{"hash":"e3f699fd4ef128eebce98d5b4e5b3bb06a512f49","messageTitle":"new","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":4,"deletions":0}}}]}],"Eugene Peh":[{"date":"2018-10-07","commitResults":[{"hash":"b28dfac5bd449825c1a372e58485833b35fdbd50","messageTitle":"Simulate error thrown by issue reposense/RepoSense#360 (#1)","messageBody":"","fileTypesAndContributionMap":{"attach_pid11612":{"insertions":0,"deletions":0}}}]},{"date":"2018-11-08","commitResults":[{"hash":"136c6713fc00cfe79a1598e8ce83c6ef3b878660","messageTitle":"Add config.json with invalid fields (#2)","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":17,"deletions":0}}}]}],"eugenepeh":[{"date":"2018-05-07","commitResults":[{"hash":"2d87a431fcbb8f73a731b6df0fcbee962c85c250","messageTitle":"README: update to reflect repository transition","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":1}}}]}]},"authorFileTypeContributionMap":{"chan-j-d":{"txt":1},"fakeAuthor":{"java":10},"WANG CHAO":{},"FH-30":{"json":1},"harryggg":{"java":14},"Eugene Peh":{"json":16},"eugenepeh":{"md":1}},"authorContributionVariance":{"chan-j-d":7.6982257E-4,"fakeAuthor":0.30051088,"WANG CHAO":0.0,"FH-30":0.00307929,"harryggg":0.023052901,"Eugene Peh":0.22248779,"eugenepeh":0.0030792993},"authorDisplayNameMap":{"chan-j-d":"chan-j-d","fakeAuthor":"fakeAuthor","WANG CHAO":"WANG CHAO","FH-30":"FH-30","harryggg":"harryggg","Eugene Peh":"Eugene Peh","eugenepeh":"eugenepeh"}} +{"authorDailyContributionsMap":{"chan-j-d":[{"date":"2021-08-22","commitResults":[{"hash":"5fdb7b10c2107fdeaff7fcc512fcec41eacc381e","messageTitle":"Add space test file","messageBody":"","fileTypesAndContributionMap":{"txt":{"insertions":1,"deletions":0}}}]}],"fakeAuthor":[{"date":"2018-02-08","commitResults":[{"hash":"768015345e70f06add2a8b7d1f901dc07bf70582","messageTitle":"fake","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":1}}}]},{"date":"2018-02-09","commitResults":[{"hash":"cd7f610e0becbdf331d5231887d8010a689f87c7","messageTitle":"moved","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151","messageTitle":"fake annotation:","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}},{"hash":"2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7","messageTitle":"fix annoation","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":2}}}]},{"date":"2021-04-05","commitResults":[{"hash":"c08107145269d5d5bb42ad78833774b7e5532977","messageTitle":"Add test lines for disowned code","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}}]},{"date":"2021-08-03","commitResults":[{"hash":"f34c20ec2c3be63e0764d4079a575dd75269ffeb","messageTitle":"Update annotationTest.java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":3}}}]}],"WANG CHAO":[],"-invalidGitUsername_TreatedAsUnknownUser":[],"FH-30":[{"date":"2021-08-25","commitResults":[{"hash":"af6087ebc0c689a9dcf3de0c3b2eb13ff47775d5","messageTitle":"Update standalone config to make it consistent with PR#1561","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":1,"deletions":1}}}]}],"harryggg":[{"date":"2018-02-05","commitResults":[{"hash":"fd425072e12004b71d733a58d819d845509f8db3","messageTitle":"Initial commit","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":0}}},{"hash":"05310e79fe8e54c5096bacc97b886ab24304d12b","messageTitle":"1","messageBody":"","fileTypesAndContributionMap":{"inMasterBranch":{"insertions":0,"deletions":0}}}]},{"date":"2018-02-06","commitResults":[{"hash":"7d7584fc204922cc5ff3bd5ca073cad6bed2c46a","messageTitle":"k","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"8d0ac2ee20f04dce8df0591caed460bffacb65a4","messageTitle":"java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":0}}}]},{"date":"2018-02-07","commitResults":[{"hash":"8e4ca1da5d413e9ab84a1e8d1474918afa97f7a1","messageTitle":"yo","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":0}}}]},{"date":"2018-02-09","commitResults":[{"hash":"e3f699fd4ef128eebce98d5b4e5b3bb06a512f49","messageTitle":"new","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":4,"deletions":0}}}]}],"harryggg invalidAuthorLineFormat":[],"Eugene Peh":[{"date":"2018-10-07","commitResults":[{"hash":"b28dfac5bd449825c1a372e58485833b35fdbd50","messageTitle":"Simulate error thrown by issue reposense/RepoSense#360 (#1)","messageBody":"","fileTypesAndContributionMap":{"attach_pid11612":{"insertions":0,"deletions":0}}}]},{"date":"2018-11-08","commitResults":[{"hash":"136c6713fc00cfe79a1598e8ce83c6ef3b878660","messageTitle":"Add config.json with invalid fields (#2)","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":17,"deletions":0}}}]}],"eugenepeh":[{"date":"2018-05-07","commitResults":[{"hash":"2d87a431fcbb8f73a731b6df0fcbee962c85c250","messageTitle":"README: update to reflect repository transition","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":1}}}]}]},"authorFileTypeContributionMap":{"chan-j-d":{"txt":1},"fakeAuthor":{"java":10},"WANG CHAO":{},"-invalidGitUsername_TreatedAsUnknownUser":{"java":5},"FH-30":{"json":1},"harryggg":{"java":14},"harryggg invalidAuthorLineFormat":{"java":3},"Eugene Peh":{"json":16},"eugenepeh":{"md":1}},"authorContributionVariance":{"chan-j-d":7.6982257E-4,"fakeAuthor":0.30051088,"WANG CHAO":0.0,"-invalidGitUsername_TreatedAsUnknownUser":0.0,"FH-30":0.00307929,"harryggg":0.023052901,"harryggg invalidAuthorLineFormat":0.0,"Eugene Peh":0.22248779,"eugenepeh":0.0030792993},"authorDisplayNameMap":{"chan-j-d":"chan-j-d","fakeAuthor":"fakeAuthor","WANG CHAO":"WANG CHAO","-invalidGitUsername_TreatedAsUnknownUser":"-invalidGitUsername_TreatedAsUnknownUser","FH-30":"FH-30","harryggg":"harryggg","harryggg invalidAuthorLineFormat":"harryggg invalidAuthorLineFormat","Eugene Peh":"Eugene Peh","eugenepeh":"eugenepeh"}} diff --git a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/authorship.json b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/authorship.json index b7546ad0d5..92ece1238c 100644 --- a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/authorship.json +++ b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/authorship.json @@ -1 +1 @@ -[{"path":"README.md","fileType":"md","lines":[{"lineNumber":1,"author":{"gitId":"eugenepeh"},"content":"This is a test repository for [RepoSense](https://github.com/reposense/RepoSense)."}],"authorContributionMap":{"eugenepeh":1}},{"path":"_reposense/config.json","fileType":"json","lines":[{"lineNumber":1,"author":{"gitId":"Eugene Peh"},"content":"{"},{"lineNumber":2,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"about-us/**\", \"**index.html\"],"},{"lineNumber":3,"author":{"gitId":"Eugene Peh"},"content":" \"formats\": [\"html\", \"css\"],"},{"lineNumber":4,"author":{"gitId":"FH-30"},"content":" \"ignoreCommitsList\": [\"\", \"67890def\"],"},{"lineNumber":5,"author":{"gitId":"Eugene Peh"},"content":" \"authors\":"},{"lineNumber":6,"author":{"gitId":"Eugene Peh"},"content":" ["},{"lineNumber":7,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":8,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"alice\","},{"lineNumber":9,"author":{"gitId":"Eugene Peh"},"content":" \"displayName\": \"Alice T.\","},{"lineNumber":10,"author":{"gitId":"Eugene Peh"},"content":" \"authorNames\": [\"AT\", \"A\"],"},{"lineNumber":11,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"**.css\"]"},{"lineNumber":12,"author":{"gitId":"Eugene Peh"},"content":" },"},{"lineNumber":13,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":14,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"bob\""},{"lineNumber":15,"author":{"gitId":"Eugene Peh"},"content":" }"},{"lineNumber":16,"author":{"gitId":"Eugene Peh"},"content":" ]"},{"lineNumber":17,"author":{"gitId":"Eugene Peh"},"content":"}"}],"authorContributionMap":{"FH-30":1,"Eugene Peh":16}},{"path":"annotationTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"fakeAuthor"},"content":"fake all the lines in this file is writtened by fakeAuthor"},{"lineNumber":2,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":5,"author":{"gitId":"harryggg"},"content":"//@@author harryggg"},{"lineNumber":6,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":7,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":8,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":9,"author":{"gitId":"harryggg"},"content":"//@@author"},{"lineNumber":10,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":11,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":12,"author":{"gitId":"-"},"content":"//@@author -invalidGitUsername_TreatedAsUnknownUser"},{"lineNumber":13,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":14,"author":{"gitId":"-"},"content":"System.out.println(\"//@@author invalidAuthorLineFormat\"); unknown"},{"lineNumber":15,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":16,"author":{"gitId":"-"},"content":"//@@author"},{"lineNumber":17,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":18,"author":{"gitId":"fakeAuthor"},"content":"//@@author harryggg invalidAuthorLineFormat"},{"lineNumber":19,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":20,"author":{"gitId":"-"},"content":"//@@author"},{"lineNumber":21,"author":{"gitId":"-"},"content":"unknown"},{"lineNumber":22,"author":{"gitId":"-"},"content":"unknown"}],"authorContributionMap":{"fakeAuthor":9,"harryggg":5,"-":8}},{"path":"blameTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 3"}],"authorContributionMap":{"fakeAuthor":1,"harryggg":3}},{"path":"newFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"}],"authorContributionMap":{"harryggg":2}},{"path":"newPos/movedFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 4"}],"authorContributionMap":{"harryggg":4}},{"path":"space test.txt","fileType":"txt","lines":[{"lineNumber":1,"author":{"gitId":"chan-j-d"},"content":"1"}],"authorContributionMap":{"chan-j-d":1}}] +[{"path":"README.md","fileType":"md","lines":[{"lineNumber":1,"author":{"gitId":"eugenepeh"},"content":"This is a test repository for [RepoSense](https://github.com/reposense/RepoSense)."}],"authorContributionMap":{"eugenepeh":1}},{"path":"_reposense/config.json","fileType":"json","lines":[{"lineNumber":1,"author":{"gitId":"Eugene Peh"},"content":"{"},{"lineNumber":2,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"about-us/**\", \"**index.html\"],"},{"lineNumber":3,"author":{"gitId":"Eugene Peh"},"content":" \"formats\": [\"html\", \"css\"],"},{"lineNumber":4,"author":{"gitId":"FH-30"},"content":" \"ignoreCommitsList\": [\"\", \"67890def\"],"},{"lineNumber":5,"author":{"gitId":"Eugene Peh"},"content":" \"authors\":"},{"lineNumber":6,"author":{"gitId":"Eugene Peh"},"content":" ["},{"lineNumber":7,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":8,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"alice\","},{"lineNumber":9,"author":{"gitId":"Eugene Peh"},"content":" \"displayName\": \"Alice T.\","},{"lineNumber":10,"author":{"gitId":"Eugene Peh"},"content":" \"authorNames\": [\"AT\", \"A\"],"},{"lineNumber":11,"author":{"gitId":"Eugene Peh"},"content":" \"ignoreGlobList\": [\"**.css\"]"},{"lineNumber":12,"author":{"gitId":"Eugene Peh"},"content":" },"},{"lineNumber":13,"author":{"gitId":"Eugene Peh"},"content":" {"},{"lineNumber":14,"author":{"gitId":"Eugene Peh"},"content":" \"githubId\": \"bob\""},{"lineNumber":15,"author":{"gitId":"Eugene Peh"},"content":" }"},{"lineNumber":16,"author":{"gitId":"Eugene Peh"},"content":" ]"},{"lineNumber":17,"author":{"gitId":"Eugene Peh"},"content":"}"}],"authorContributionMap":{"FH-30":1,"Eugene Peh":16}},{"path":"annotationTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"fakeAuthor"},"content":"fake all the lines in this file is writtened by fakeAuthor"},{"lineNumber":2,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":5,"author":{"gitId":"harryggg"},"content":"//@@author harryggg"},{"lineNumber":6,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":7,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":8,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":9,"author":{"gitId":"harryggg"},"content":"//@@author"},{"lineNumber":10,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":11,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":12,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"//@@author -invalidGitUsername_TreatedAsUnknownUser"},{"lineNumber":13,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"unknown"},{"lineNumber":14,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"System.out.println(\"//@@author invalidAuthorLineFormat\"); unknown"},{"lineNumber":15,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"unknown"},{"lineNumber":16,"author":{"gitId":"-invalidGitUsername_TreatedAsUnknownUser"},"content":"//@@author"},{"lineNumber":17,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":18,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"//@@author harryggg invalidAuthorLineFormat"},{"lineNumber":19,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"fake"},{"lineNumber":20,"author":{"gitId":"harryggg invalidAuthorLineFormat"},"content":"//@@author"},{"lineNumber":21,"author":{"gitId":"fakeAuthor"},"content":"unknown"},{"lineNumber":22,"author":{"gitId":"fakeAuthor"},"content":"unknown"}],"authorContributionMap":{"fakeAuthor":9,"-invalidGitUsername_TreatedAsUnknownUser":5,"harryggg":5,"harryggg invalidAuthorLineFormat":3}},{"path":"blameTest.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"fakeAuthor"},"content":"fake"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 3"}],"authorContributionMap":{"fakeAuthor":1,"harryggg":3}},{"path":"newFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"}],"authorContributionMap":{"harryggg":2}},{"path":"newPos/movedFile.java","fileType":"java","lines":[{"lineNumber":1,"author":{"gitId":"harryggg"},"content":"line 1"},{"lineNumber":2,"author":{"gitId":"harryggg"},"content":"line 2"},{"lineNumber":3,"author":{"gitId":"harryggg"},"content":"line 3"},{"lineNumber":4,"author":{"gitId":"harryggg"},"content":"line 4"}],"authorContributionMap":{"harryggg":4}},{"path":"space test.txt","fileType":"txt","lines":[{"lineNumber":1,"author":{"gitId":"chan-j-d"},"content":"1"}],"authorContributionMap":{"chan-j-d":1}}] diff --git a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/commits.json b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/commits.json index ebe340bcbd..240a62706b 100644 --- a/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/commits.json +++ b/src/systemtest/resources/LocalRepoSystemTest/testSameFinalDirectory/parent2_test-repo_master/commits.json @@ -1 +1 @@ -{"authorDailyContributionsMap":{"chan-j-d":[{"date":"2021-08-22","commitResults":[{"hash":"5fdb7b10c2107fdeaff7fcc512fcec41eacc381e","messageTitle":"Add space test file","messageBody":"","fileTypesAndContributionMap":{"txt":{"insertions":1,"deletions":0}}}]}],"fakeAuthor":[{"date":"2018-02-08","commitResults":[{"hash":"768015345e70f06add2a8b7d1f901dc07bf70582","messageTitle":"fake","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":1}}}]},{"date":"2018-02-09","commitResults":[{"hash":"cd7f610e0becbdf331d5231887d8010a689f87c7","messageTitle":"moved","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151","messageTitle":"fake annotation:","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}},{"hash":"2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7","messageTitle":"fix annoation","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":2}}}]},{"date":"2021-04-05","commitResults":[{"hash":"c08107145269d5d5bb42ad78833774b7e5532977","messageTitle":"Add test lines for disowned code","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}}]},{"date":"2021-08-03","commitResults":[{"hash":"f34c20ec2c3be63e0764d4079a575dd75269ffeb","messageTitle":"Update annotationTest.java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":3}}}]}],"WANG CHAO":[],"FH-30":[{"date":"2021-08-25","commitResults":[{"hash":"af6087ebc0c689a9dcf3de0c3b2eb13ff47775d5","messageTitle":"Update standalone config to make it consistent with PR#1561","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":1,"deletions":1}}}]}],"harryggg":[{"date":"2018-02-05","commitResults":[{"hash":"fd425072e12004b71d733a58d819d845509f8db3","messageTitle":"Initial commit","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":0}}},{"hash":"05310e79fe8e54c5096bacc97b886ab24304d12b","messageTitle":"1","messageBody":"","fileTypesAndContributionMap":{"inMasterBranch":{"insertions":0,"deletions":0}}}]},{"date":"2018-02-06","commitResults":[{"hash":"7d7584fc204922cc5ff3bd5ca073cad6bed2c46a","messageTitle":"k","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"8d0ac2ee20f04dce8df0591caed460bffacb65a4","messageTitle":"java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":0}}}]},{"date":"2018-02-07","commitResults":[{"hash":"8e4ca1da5d413e9ab84a1e8d1474918afa97f7a1","messageTitle":"yo","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":0}}}]},{"date":"2018-02-09","commitResults":[{"hash":"e3f699fd4ef128eebce98d5b4e5b3bb06a512f49","messageTitle":"new","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":4,"deletions":0}}}]}],"Eugene Peh":[{"date":"2018-10-07","commitResults":[{"hash":"b28dfac5bd449825c1a372e58485833b35fdbd50","messageTitle":"Simulate error thrown by issue reposense/RepoSense#360 (#1)","messageBody":"","fileTypesAndContributionMap":{"attach_pid11612":{"insertions":0,"deletions":0}}}]},{"date":"2018-11-08","commitResults":[{"hash":"136c6713fc00cfe79a1598e8ce83c6ef3b878660","messageTitle":"Add config.json with invalid fields (#2)","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":17,"deletions":0}}}]}],"eugenepeh":[{"date":"2018-05-07","commitResults":[{"hash":"2d87a431fcbb8f73a731b6df0fcbee962c85c250","messageTitle":"README: update to reflect repository transition","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":1}}}]}]},"authorFileTypeContributionMap":{"chan-j-d":{"txt":1},"fakeAuthor":{"java":10},"WANG CHAO":{},"FH-30":{"json":1},"harryggg":{"java":14},"Eugene Peh":{"json":16},"eugenepeh":{"md":1}},"authorContributionVariance":{"chan-j-d":7.6982257E-4,"fakeAuthor":0.30051088,"WANG CHAO":0.0,"FH-30":0.00307929,"harryggg":0.023052901,"Eugene Peh":0.22248779,"eugenepeh":0.0030792993},"authorDisplayNameMap":{"chan-j-d":"chan-j-d","fakeAuthor":"fakeAuthor","WANG CHAO":"WANG CHAO","FH-30":"FH-30","harryggg":"harryggg","Eugene Peh":"Eugene Peh","eugenepeh":"eugenepeh"}} +{"authorDailyContributionsMap":{"chan-j-d":[{"date":"2021-08-22","commitResults":[{"hash":"5fdb7b10c2107fdeaff7fcc512fcec41eacc381e","messageTitle":"Add space test file","messageBody":"","fileTypesAndContributionMap":{"txt":{"insertions":1,"deletions":0}}}]}],"fakeAuthor":[{"date":"2018-02-08","commitResults":[{"hash":"768015345e70f06add2a8b7d1f901dc07bf70582","messageTitle":"fake","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":1}}}]},{"date":"2018-02-09","commitResults":[{"hash":"cd7f610e0becbdf331d5231887d8010a689f87c7","messageTitle":"moved","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151","messageTitle":"fake annotation:","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}},{"hash":"2fb6b9b2dd9fa40bf0f9815da2cb0ae8731436c7","messageTitle":"fix annoation","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":2}}}]},{"date":"2021-04-05","commitResults":[{"hash":"c08107145269d5d5bb42ad78833774b7e5532977","messageTitle":"Add test lines for disowned code","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":11,"deletions":0}}}]},{"date":"2021-08-03","commitResults":[{"hash":"f34c20ec2c3be63e0764d4079a575dd75269ffeb","messageTitle":"Update annotationTest.java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":3}}}]}],"WANG CHAO":[],"-invalidGitUsername_TreatedAsUnknownUser":[],"FH-30":[{"date":"2021-08-25","commitResults":[{"hash":"af6087ebc0c689a9dcf3de0c3b2eb13ff47775d5","messageTitle":"Update standalone config to make it consistent with PR#1561","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":1,"deletions":1}}}]}],"harryggg":[{"date":"2018-02-05","commitResults":[{"hash":"fd425072e12004b71d733a58d819d845509f8db3","messageTitle":"Initial commit","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":0}}},{"hash":"05310e79fe8e54c5096bacc97b886ab24304d12b","messageTitle":"1","messageBody":"","fileTypesAndContributionMap":{"inMasterBranch":{"insertions":0,"deletions":0}}}]},{"date":"2018-02-06","commitResults":[{"hash":"7d7584fc204922cc5ff3bd5ca073cad6bed2c46a","messageTitle":"k","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":0,"deletions":0}}},{"hash":"8d0ac2ee20f04dce8df0591caed460bffacb65a4","messageTitle":"java","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":3,"deletions":0}}}]},{"date":"2018-02-07","commitResults":[{"hash":"8e4ca1da5d413e9ab84a1e8d1474918afa97f7a1","messageTitle":"yo","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":2,"deletions":0}}}]},{"date":"2018-02-09","commitResults":[{"hash":"e3f699fd4ef128eebce98d5b4e5b3bb06a512f49","messageTitle":"new","messageBody":"","fileTypesAndContributionMap":{"java":{"insertions":4,"deletions":0}}}]}],"harryggg invalidAuthorLineFormat":[],"Eugene Peh":[{"date":"2018-10-07","commitResults":[{"hash":"b28dfac5bd449825c1a372e58485833b35fdbd50","messageTitle":"Simulate error thrown by issue reposense/RepoSense#360 (#1)","messageBody":"","fileTypesAndContributionMap":{"attach_pid11612":{"insertions":0,"deletions":0}}}]},{"date":"2018-11-08","commitResults":[{"hash":"136c6713fc00cfe79a1598e8ce83c6ef3b878660","messageTitle":"Add config.json with invalid fields (#2)","messageBody":"","fileTypesAndContributionMap":{"json":{"insertions":17,"deletions":0}}}]}],"eugenepeh":[{"date":"2018-05-07","commitResults":[{"hash":"2d87a431fcbb8f73a731b6df0fcbee962c85c250","messageTitle":"README: update to reflect repository transition","messageBody":"","fileTypesAndContributionMap":{"md":{"insertions":1,"deletions":1}}}]}]},"authorFileTypeContributionMap":{"chan-j-d":{"txt":1},"fakeAuthor":{"java":10},"WANG CHAO":{},"-invalidGitUsername_TreatedAsUnknownUser":{"java":5},"FH-30":{"json":1},"harryggg":{"java":14},"harryggg invalidAuthorLineFormat":{"java":3},"Eugene Peh":{"json":16},"eugenepeh":{"md":1}},"authorContributionVariance":{"chan-j-d":7.6982257E-4,"fakeAuthor":0.30051088,"WANG CHAO":0.0,"-invalidGitUsername_TreatedAsUnknownUser":0.0,"FH-30":0.00307929,"harryggg":0.023052901,"harryggg invalidAuthorLineFormat":0.0,"Eugene Peh":0.22248779,"eugenepeh":0.0030792993},"authorDisplayNameMap":{"chan-j-d":"chan-j-d","fakeAuthor":"fakeAuthor","WANG CHAO":"WANG CHAO","-invalidGitUsername_TreatedAsUnknownUser":"-invalidGitUsername_TreatedAsUnknownUser","FH-30":"FH-30","harryggg":"harryggg","harryggg invalidAuthorLineFormat":"harryggg invalidAuthorLineFormat","Eugene Peh":"Eugene Peh","eugenepeh":"eugenepeh"}} diff --git a/src/test/java/reposense/authorship/AnnotatorAnalyzerTest.java b/src/test/java/reposense/authorship/AnnotatorAnalyzerTest.java index b74f6f62fb..0d93e3d5aa 100644 --- a/src/test/java/reposense/authorship/AnnotatorAnalyzerTest.java +++ b/src/test/java/reposense/authorship/AnnotatorAnalyzerTest.java @@ -27,17 +27,20 @@ public class AnnotatorAnalyzerTest extends GitTestTemplate { FAKE_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, MAIN_AUTHOR, MAIN_AUTHOR, MAIN_AUTHOR, MAIN_AUTHOR, MAIN_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, - UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, - FAKE_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, - UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR + UNCONVENTIONAL_AUTHOR, UNCONVENTIONAL_AUTHOR, UNCONVENTIONAL_AUTHOR, UNCONVENTIONAL_AUTHOR, + UNCONVENTIONAL_AUTHOR, + FAKE_AUTHOR, + WHITESPACE_AUTHOR, WHITESPACE_AUTHOR, WHITESPACE_AUTHOR, + FAKE_AUTHOR, FAKE_AUTHOR }; private static final Author[] EXPECTED_LINE_AUTHORS_DISOWN_CODE_TEST = { FAKE_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, - FAKE_AUTHOR, FAKE_AUTHOR, FAKE_AUTHOR, - UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR + FAKE_AUTHOR, + UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, UNKNOWN_AUTHOR, + FAKE_AUTHOR, FAKE_AUTHOR }; private RepoConfiguration config; @@ -97,6 +100,18 @@ public void extractAuthorName_matchCommentPattern0_returnAuthorName() { line = " // @@author fake-4u-th0r "; Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); Assertions.assertEquals("fake-4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = "// @@author fake 4u-th0r"; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("fake 4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = "// @@author --fake4u-th0r--"; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("--fake4u-th0r--", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = "// @@author --fake-- __4u-th0r-- "; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("--fake-- __4u-th0r--", AnnotatorAnalyzer.extractAuthorName(line).get()); } @Test @@ -126,6 +141,14 @@ public void extractAuthorName_matchCommentPattern1_returnAuthorName() { line = " /* @@author fake-4u-th0r */ "; Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); Assertions.assertEquals("fake-4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = "/* @@author fake 4u-th0r */"; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("fake 4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = "/* @@author --_fake4u-th0r */"; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("--_fake4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); } @Test @@ -143,6 +166,14 @@ public void extractAuthorName_matchCommentPattern2_returnAuthorName() { line = " # @@author fake-4u-th0r "; Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); Assertions.assertEquals("fake-4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = "# @@author fake 4u-th0r"; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("fake 4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = "# @@author fake -4u-th0r "; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("fake -4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); } @Test @@ -157,6 +188,10 @@ public void extractAuthorName_matchCommentPattern3_returnAuthorName() { Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); Assertions.assertEquals("fakeauthor", AnnotatorAnalyzer.extractAuthorName(line).get()); + line = " "; Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); Assertions.assertEquals("fake-4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = " --> "; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("fake-4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = " --> "; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("fake-4u-th0r-", AnnotatorAnalyzer.extractAuthorName(line).get()); } @Test @@ -186,9 +229,17 @@ public void extractAuthorName_matchCommentPattern4_returnAuthorName() { Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); Assertions.assertEquals("fakeauthor", AnnotatorAnalyzer.extractAuthorName(line).get()); + line = " % @@author fake-4u-th0r"; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("fake-4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + line = " % @@author fake-4u-th0r "; Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); Assertions.assertEquals("fake-4u-th0r", AnnotatorAnalyzer.extractAuthorName(line).get()); + + line = " % @@author *()fake-4u-th0r-- %% "; + Assertions.assertEquals(index, AnnotatorAnalyzer.getCommentTypeIndex(line)); + Assertions.assertEquals("*()fake-4u-th0r-- %%", AnnotatorAnalyzer.extractAuthorName(line).get()); } @Test @@ -300,31 +351,6 @@ public void extractAuthorName_noAuthorName_returnNull() { Assertions.assertFalse(AnnotatorAnalyzer.extractAuthorName(line).isPresent()); } - @Test - public void extractAuthorName_invalidAuthorName_returnNull() { - String line; - - line = "% @@author thisAuthorNameHasMoreThanThirtyNineLetters"; - Assertions.assertEquals(4, AnnotatorAnalyzer.getCommentTypeIndex(line)); - Assertions.assertFalse(AnnotatorAnalyzer.extractAuthorName(line).isPresent()); - - line = "# @@author -invalidUsernameFormat"; - Assertions.assertEquals(2, AnnotatorAnalyzer.getCommentTypeIndex(line)); - Assertions.assertFalse(AnnotatorAnalyzer.extractAuthorName(line).isPresent()); - - line = "/*@@author fakeAuthor-->"; - Assertions.assertEquals(1, AnnotatorAnalyzer.getCommentTypeIndex(line)); - Assertions.assertFalse(AnnotatorAnalyzer.extractAuthorName(line).isPresent()); - - line = "[//]: # (@@author)"; - Assertions.assertEquals(5, AnnotatorAnalyzer.getCommentTypeIndex(line)); - Assertions.assertFalse(AnnotatorAnalyzer.extractAuthorName(line).isPresent()); - - line = "[//]: # (@@author ) "; - Assertions.assertEquals(5, AnnotatorAnalyzer.getCommentTypeIndex(line)); - Assertions.assertFalse(AnnotatorAnalyzer.extractAuthorName(line).isPresent()); - } - @Test public void getCommentType_matchCommentPattern0_success() { Assertions.assertEquals(0, AnnotatorAnalyzer.getCommentTypeIndex("//@@author fakeAuthor")); @@ -383,25 +409,21 @@ public void getCommentType_matchCommentPattern6_success() { @Test public void getCommentType_invalidCommentPattern_returnMinus1() { - Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("// @@author fakeAuthor //")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("@@author fakeAuthor")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("/@@author fakeAuthor")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("@@author fakeAuthor */")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("# something @@author fakeAuthor")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("something % @@author fakeAuthor")); - Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("# @@author fakeAuthor something")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("")); } @Test public void getCommentType_invalidMarkdownCommentPattern_returnMinus1() { - Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("// @@author fakeAuthor //")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("@@author fakeAuthor")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("/@@author fakeAuthor")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("@@author fakeAuthor */")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("# something @@author fakeAuthor")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("something % @@author fakeAuthor")); - Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("# @@author fakeAuthor something")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("")); Assertions.assertEquals(-1, AnnotatorAnalyzer.getCommentTypeIndex("[//]: # (@@authorfakeAuthor)")); } diff --git a/src/test/java/reposense/template/GitTestTemplate.java b/src/test/java/reposense/template/GitTestTemplate.java index f18f6999f6..7a01a94cdd 100644 --- a/src/test/java/reposense/template/GitTestTemplate.java +++ b/src/test/java/reposense/template/GitTestTemplate.java @@ -46,6 +46,8 @@ public class GitTestTemplate { protected static final String TEST_COMMIT_HASH_PARENT = "c5a6dc774e22099cd9ddeb0faff1e75f9cf4f151"; protected static final String MAIN_AUTHOR_NAME = "harryggg"; protected static final String FAKE_AUTHOR_NAME = "fakeAuthor"; + protected static final String UNCONVENTIONAL_AUTHOR_NAME = "-invalidGitUsername_TreatedAsUnknownUser"; + protected static final String AUTHOR_NAME_WITH_WHITESPACES = "harryggg invalidAuthorLineFormat"; protected static final String IGNORED_AUTHOR_NAME = "FH-30"; protected static final String EUGENE_AUTHOR_NAME = "eugenepeh"; protected static final String YONG_AUTHOR_NAME = "Yong Hao TENG"; @@ -93,6 +95,8 @@ public class GitTestTemplate { protected static final Author MAIN_AUTHOR = new Author(MAIN_AUTHOR_NAME); protected static final Author FAKE_AUTHOR = new Author(FAKE_AUTHOR_NAME); + protected static final Author UNCONVENTIONAL_AUTHOR = new Author(UNCONVENTIONAL_AUTHOR_NAME); + protected static final Author WHITESPACE_AUTHOR = new Author(AUTHOR_NAME_WITH_WHITESPACES); protected static ThreadLocal configs = ThreadLocal.withInitial(() -> { try {