-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds axiom to enable rules only on projects with a certain amount of contributors. Uses node-gitlog library to get the contributor count of the repository. Some simple tests are also included. See issue #169 Signed-off-by: Yann Jorelle <yann.jorelle@nokia.com>
- Loading branch information
Yann Jorelle
committed
Aug 12, 2020
1 parent
1a66d77
commit a890f8a
Showing
6 changed files
with
691 additions
and
608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const gitlog = require('gitlog').default | ||
|
||
module.exports = function (fileSystem) { | ||
const commits = gitlog({ | ||
repo: fileSystem.targetDir, | ||
all: true, | ||
number: 10000 // Fetch the last 10000 commits | ||
}) | ||
if (!commits) { | ||
return 0 | ||
} | ||
// Get commit authors and filter unique values | ||
const contributors = commits | ||
.map((commit) => commit.authorName.toLowerCase()) | ||
.filter((value, index, self) => self.indexOf(value) === index) | ||
return contributors.length | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.