Skip to content

insert-license hook ignores top-level files selected by types or types_or #52

Description

@vlotorev

https://github.com/Lucas-C/pre-commit-hooks/blob/master/.pre-commit-hooks.yaml#L33 has line files: '.*/.*'. This overrides defaults and ignores top level files from project (top-level files don't have / in path when pre-commit is run).

Example when insert-license hook omits useful files (example uses language: fail just to print filenames passed by pre-commit):

repos:
  - repo: https://github.com/Lucas-C/pre-commit-hooks
    rev: v1.3.0
    hooks:
      - id: insert-license
        types: [makefile]
        language: fail
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.2.0
    hooks:
      - id: end-of-file-fixer
        types: [makefile]
        language: fail

The output for running pre-commit:

$ pre-commit run --all
Insert license in comments...............................................Failed
- hook id: insert-license
- exit code: 1

insert_license

doc/Makefile
src/Makefile

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1

end-of-file-fixer

Makefile
doc/Makefile
src/Makefile

Note fix end of files hook from https://github.com/pre-commit/pre-commit-hooks prints top-level Makefile while insert-license doesn't.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions