Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Add interface for excluding generated files from formatting #14

Closed
roberth opened this issue Oct 2, 2019 · 1 comment
Closed

Add interface for excluding generated files from formatting #14

roberth opened this issue Oct 2, 2019 · 1 comment

Comments

@roberth
Copy link
Member

roberth commented Oct 2, 2019

Current approach is somewhat cumbersome and is coupled to a specific formatting tool.

For example, config in the niv integration:

// lib.optionalAttrs (options ? pre-commit.hooks) {
      pre-commit.hooks.nixpkgs-fmt.excludes = [ "nix/sources.nix$" ];
    }

Suggested option

formatting.excludedFiles = mkOption {
  type = listOf (either str path);
}
  • to be read by pre-commit (and any standalone formatters, unimplemented)
  • to be written by tool modules that generate files, like niv
  • also to be written by project-specific file generation (for example a nix file written by a terraform module)
  • the str type is to be interpreted literally - no regex, globs etc
@roberth roberth mentioned this issue Oct 2, 2019
3 tasks
@roberth
Copy link
Member Author

roberth commented Feb 8, 2020

Use config.pre-commit.excludes = [ "some python regex" ].

This doesn't solve the problem for formatters outside pre-commit, but we'll solve that when it comes up.

@roberth roberth closed this as completed Feb 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant