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.

Surpress warnings with --silent

See original GitHub issue

Hi,

I’ve dockerized pre-commit and every time I run in, it mounts my repo in the docker and runs pre-commit run --all-files.

Every time, however, I’m getting warnings which I would like to surpress or remove:

[WARNING] The 'rev' field of repo 'https://github.com/pre-commit/pre-commit-hooks' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.  Hint: `pre-commit autoupdate` often fixes this.
[WARNING] The 'rev' field of repo 'https://github.com/psf/black' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.  Hint: `pre-commit autoupdate` often fixes this.

I guess these comes from the black and pre-commit-hooks github references in the config file. Any ideas how to reduce verbosity here? I’m mounting my cache (~/.cache/pre-commit) into docker.

Here is my .pre-commit-config.yaml:

exclude: 'docs|node_modules|migrations|.git|.tox'
default_stages: [commit]
fail_fast: true

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: master
    hooks:
      - id: trailing-whitespace
        files: (^|/)a/.+\.(py|html|sh|css|js)$
      - id: check-merge-conflict
      - id: check-ast
      - id: check-json
      - id: check-yaml
      - id: debug-statements
      - id: check-docstring-first
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: end-of-file-fixer
      - id: fix-encoding-pragma
      - id: trailing-whitespace
      - id: pretty-format-json

-   repo: https://github.com/psf/black
    rev: stable
    hooks:
      - id: black
        language_version: python3

-   repo: local
    hooks:
      - id: flake8
        name: flake8
        entry: flake8
        language: python
        types: [python]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Jun 23, 2021

also some other hints:

  • your exclude has some unnecessary entries, pre-commit never runs on files that aren’t checked in
  • your local flake8 hook is a fork bomb, you should use https://github.com/pycqa/flake8
0reactions
mihaigaloscommented, Jun 23, 2021

@asottile that was my initial though, but since the context is docker, changes would be lost on restart.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is a "--silent" flag supposed to suppress warnings and errors ...
1 Answer 1 · Have a meaningfull returncode. · If your application can produce lots of warnings, have a flag to filter only...
Read more >
Suppress compiler warnings - Visual Studio - Microsoft Learn
In Solution Explorer, choose the project in which you want to suppress warnings. Right-click on the project node, and choose Properties on ...
Read more >
Silence Warnings From the Test Suite
When running Python's test suite, no warnings should result when you run it under strenuous testing conditions (you can ignore the extra flags...
Read more >
No way to silence warnings · Issue #6672 · yarnpkg/yarn
Either yarn --silent should be truly silent, or a log level configuration should be added to add the ability to ignore warnings.
Read more >
How to disable Python warnings? - Stack Overflow
If you rely on the current behaviour, change it to [this other thing] . I would rather ignore the warnings now and wait...
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