Skip to content

Commit

Permalink
feat(back): fluidattacks#1314 upgrade lint-git-mailmap
Browse files Browse the repository at this point in the history
- Upgrade to the latest version of mailmap-linter
- Add a `exclude` option to the lint-git-mailmap module
- Add a `--exclude` option to the entrypoint script
- Update documentation

Signed-off-by: Robin Quintero <rohaquinlop301@gmail.com>
  • Loading branch information
rohaquinlop committed Mar 19, 2024
1 parent 815f4c8 commit 3a960c1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/src/api/builtins/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ Types:
- lintGitMailmap:
- enable (`boolean`): Optional.
Defaults to `false`.
- exclude (`str`): Optional.
If the excludes aren't too many then use `exclude` instead
of the exclude file (`.mailmap-exclude`).
Defaults to `^$`.

Example:

Expand All @@ -139,6 +143,7 @@ Example:
{
lintGitMailMap = {
enable = true;
exclude = "^.* <.*noreply@github.com>$";
};
}
```
Expand Down
6 changes: 4 additions & 2 deletions src/args/lint-git-mailmap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
}: {
name,
src,
exclude,
}: let
mailmapLinter = fetchGithub {
owner = "kamadorueda";
repo = "mailmap-linter";
rev = "a51ac7e44515c754938a08f81038762e7d09a827";
sha256 = "1da49y2cw9g9i4gbd2ykqghnpqpqdac18lafmn878qdlf1v8n9lh";
rev = "ffed6a68e507228d7e462642a8ec129f816b6a5d";
sha256 = "XHmqLTT7TZ/dXBtQSH1xkEGSWI4mpImt+KRqBHbfGLk=";
};
in
makeScript {
entrypoint = ./entrypoint.sh;
replace = {
__argSrc__ = src;
__argExclude__ = exclude;
};
name = "lint-git-mailmap-for-${name}";
searchPaths = {
Expand Down
2 changes: 1 addition & 1 deletion src/args/lint-git-mailmap/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function main {
cd '__argSrc__' \
&& mailmap-linter
&& mailmap-linter --exclude '__argExclude__'
}

main "${@}"
5 changes: 5 additions & 0 deletions src/evaluator/modules/lint-git-mailmap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
default = false;
type = lib.types.bool;
};
exclude = lib.mkOption {
default = "^$";
type = lib.types.str;
};
};
};
config = {
Expand All @@ -19,6 +23,7 @@
(lintGitMailMap {
name = "lint-git-mailmap";
src = ".";
exclude = config.lintGitMailMap.exclude;
});
};
};
Expand Down

0 comments on commit 3a960c1

Please sign in to comment.