question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I configure arguments for a given hook?

See original GitHub issue

Apologies if the question looks too simple. I’m new to pre-commit.

I followed these steps to set things up:

brew install pre-commit
cd my_repo
pre-commit install

and then created a .pre-commit-config.yaml file inside my_repo with the following contents:

-   repo: git://github.com/pre-commit/pre-commit-hooks
    sha: v1.2.0  # Use the ref you want to point at
    hooks:
    -   id: check-added-large-files

My understanding is that check-added-large-files supports arguments args: ['--maxkb=123'].

I would like to set up the hook so that it prevents me from committing files larger than 50MB any time I try to git commit anything on the repo. Where exactly do I specify these arguments?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
asottilecommented, Jul 12, 2018

You’ll add those args to the hook dictionary itself – it’ll look something like this:

-   repo: git://github.com/pre-commit/pre-commit-hooks
    sha: v1.2.0  # Use the ref you want to point at
    hooks:
    -   id: check-added-large-files
        args: [--maxkb=123]

The full docs for this can be found here: Passing arguments to hooks

1reaction
asottilecommented, Jul 12, 2018

you’ve got invalid yaml there 😃

here’s (I think) what you want:

  - id: jenkins_pipeline_from_terraform_input_vars
    args: ['--replacements={ "params.name.toString()": "convertToName(params.name.toString())" }']
Read more comments on GitHub >

github_iconTop Results From Across the Web

Git Hooks - Git SCM
The post-rewrite hook is run by commands that replace commits, such as git commit --amend and git rebase (though not by git filter-branch...
Read more >
Rules of Hooks - React
Hooks are JavaScript functions, but you need to follow two rules when ... Read the name state variable (argument is ignored) useEffect(persistForm) //...
Read more >
Writing hook functions — pytest documentation
Hooks receive parameters using only keyword arguments. Now your hook is ready to be used. To register a function at the hook, other...
Read more >
Git Hooks | Atlassian Git Tutorial
All Git hooks are ordinary scripts that Git executes when certain events occur in the repository. This makes them very easy to install...
Read more >
before_record hook - Vcr - Relish
Your block should accept up to 2 arguments. ... select which cassettes a given hook applies to. ... VCR.configure do |c| c.before_record(:twitter) {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found