Unverified Commit 84ce193e authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

ci/treefmt: add nixf-diagnose (#438559)

parents 5135bf52 91a8fee3
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -87,6 +87,32 @@ let
          "pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml"
        ];

        programs.nixf-diagnose.enable = true;
        settings.formatter.nixf-diagnose = {
          # Ensure nixfmt cleans up after nixf-diagnose.
          priority = -1;
          options = [
            "--auto-fix"
            # Rule names can currently be looked up here:
            # https://github.com/nix-community/nixd/blob/main/libnixf/src/Basic/diagnostic.py
            # TODO: Remove the following and fix things.
            "--ignore=sema-unused-def-lambda-noarg-formal"
            "--ignore=sema-unused-def-lambda-witharg-arg"
            "--ignore=sema-unused-def-lambda-witharg-formal"
            "--ignore=sema-unused-def-let"
            # Keep this rule, because we have `lib.or`.
            "--ignore=or-identifier"
          ];
          excludes = [
            # Auto-generated; violates sema-extra-with
            # Can only sensibly be removed when --auto-fix supports multiple fixes at once:
            # https://github.com/inclyc/nixf-diagnose/issues/13
            "pkgs/servers/home-assistant/component-packages.nix"
            # https://github.com/nix-community/nixd/issues/708
            "nixos/maintainers/scripts/azure-new/examples/basic/system.nix"
          ];
        };

        settings.formatter.editorconfig-checker = {
          command = "${pkgs.lib.getExe pkgs.editorconfig-checker}";
          options = [ "-disable-indent-size" ];
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ stdenvNoCC.mkDerivation (
      decl:
      let
        declStr = toString decl;
        root = toString (../..);
        root = toString ../..;
        subpath = lib.removePrefix "/" (lib.removePrefix root declStr);
      in
      if lib.hasPrefix root declStr then
+1 −1
Original line number Diff line number Diff line
@@ -396,7 +396,7 @@ rec {
      outputs = drv.outputs or [ "out" ];

      commonAttrs =
        drv // (listToAttrs outputsList) // ({ all = map (x: x.value) outputsList; }) // passthru;
        drv // (listToAttrs outputsList) // { all = map (x: x.value) outputsList; } // passthru;

      outputToAttrListElement = outputName: {
        name = outputName;
+6 −6
Original line number Diff line number Diff line
@@ -26,29 +26,29 @@ in
{
  imports = [
    #  Module A
    ({
    {
      options.attrsOfModule = attrsOfModule;
      options.mergedAttrsOfModule = attrsOfModule;
      options.listOfModule = listOfModule;
      options.mergedListOfModule = listOfModule;
    })
    }
    # Module B
    ({
    {
      options.mergedAttrsOfModule = attrsOfModule;
      options.mergedListOfModule = listOfModule;
    })
    }
    # Values
    # It is important that the value is defined in a separate module
    # Without valueMeta the actual value and sub-options wouldn't be accessible via:
    # options.attrsOfModule.type.getSubOptions
    ({
    {
      attrsOfModule = {
        foo.bar = 42;
      };
      mergedAttrsOfModule = {
        foo.bar = 42;
      };
    })
    }
    (
      { options, ... }:
      {
+2 −2
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@ let
in
{
  options.number = mkOption {
    type = types.submodule ({
    type = types.submodule {
      freeformType = types.attrsOf (types.either types.int types.int);
    });
    };
    default = {
      int = 42;
    }; # should not emit a warning
Loading