From 4def222ea40aef58ee83fb00bd412b78ee807205 Mon Sep 17 00:00:00 2001 From: ckie Date: Tue, 3 May 2022 22:17:44 +0300 Subject: [PATCH] stdenv/check-meta: add a "maintainerless" warning This warning logs when a package has no maintainers. It will stay silent if `meta.maintainers` is not set at all, only complaining when it is an empty list. In the future a separate warning could be added to allow for that stricter behavior. Or this warning could be changed. --- pkgs/stdenv/generic/check-meta.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/stdenv/generic/check-meta.nix b/pkgs/stdenv/generic/check-meta.nix index 4a9af7a6f67..1da098dabbe 100644 --- a/pkgs/stdenv/generic/check-meta.nix +++ b/pkgs/stdenv/generic/check-meta.nix @@ -50,6 +50,9 @@ let hasLicense attrs && isUnfree (lib.lists.toList attrs.meta.license); + hasNoMaintainers = attrs: + attrs ? meta.maintainers && (lib.length attrs.meta.maintainers) == 0; + isMarkedBroken = attrs: attrs.meta.broken or false; hasUnsupportedPlatform = attrs: @@ -95,6 +98,7 @@ let insecure = remediate_insecure; broken-outputs = remediateOutputsToInstall; unknown-meta = x: ""; + maintainerless = x: ""; }; remediation_env_var = allow_attr: { Unfree = "NIXPKGS_ALLOW_UNFREE"; @@ -302,6 +306,11 @@ let { valid = "no"; reason = "broken-outputs"; errormsg = "has invalid meta.outputsToInstall"; } else let res = checkMeta (attrs.meta or {}); in if res != [] then { valid = "no"; reason = "unknown-meta"; errormsg = "has an invalid meta attrset:${lib.concatMapStrings (x: "\n\t - " + x) res}"; } + # --- warnings --- + # Please also update the type in /pkgs/top-level/config.nix alongside this. + else if hasNoMaintainers attrs then + { valid = "warn"; reason = "maintainerless"; errormsg = "has no maintainers"; } + # ----- else { valid = "yes"; }); assertValidity = { meta, attrs }: let