Skip to content

Add option to simply run a command, without git repo #344

Closed

Description

@hvdklauw

Would be really great if pre commit supported the option to run a certain command to do the checking, just handling the passing of filenames to the command.

This would allow isort to work correctly (see #181, about why it doesn't work). And would allow a CI environment to use the same executable, without the need for another repo just to manage something that is in fact related to the project.

Also this would make sure my editor (Atom in this case) will use the exact same version of the file as the pre-commit hook, preventing issues from everything looking fine in my editor, but then the hook failing because of a version difference.

Activity

  1. asottile commented on Feb 8, 2016

    @asottile
    Member

    I believe this satisfies this: #226

    It needs documentation however

  2. asottile commented on Feb 8, 2016

    @asottile
    Member

    That said, I've written https://github.com/asottile/reorder_python_imports which works entirely statically opposed to the dynamic analysis that isort does -- we use it at yelp and it works great for our usecases :)

  3. asottile commented on Feb 8, 2016

    @asottile
    Member

    In your case I believe the config you'd want is:

    -   repo: local
        hooks:
        -   id: isort
            name: isort
            entry: isort
            language: system
            files: '\.py$'
  4. hvdklauw commented on Feb 8, 2016

    @hvdklauw
    Author

    Thanks, that's nice. Maybe the documentation should mention this :-(

    On Mon, 8 Feb 2016, 21:35 Anthony Sottile notifications@github.com wrote:

    In your case I believe the config you'd want is:

    • repo: local
      hooks:
    • id: isort
      name: isort
      entry: isort
      language: system
      files: '.py$'

    —
    Reply to this email directly or view it on GitHub
    #344 (comment)
    .

  5. asottile commented on May 4, 2016

    @asottile
    Member

    local hooks are now documented here: http://pre-commit.com/#repository-local-hooks

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions