Skip to content

Commit

Permalink
Disable version check when running as a pre-commit hook (#2858)
Browse files Browse the repository at this point in the history
As pre-commit itself has ability to upgrade to newer versions, we
disable version check by default when run under it.
  • Loading branch information
ssbarnea authored Jan 1, 2023
1 parent ba769c8 commit 0ca5d95
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ansiblelint/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ def report_summary( # pylint: disable=too-many-branches,too-many-locals
msg += f", and fixed {summary.fixed} issue(s)"
msg += f" on {files_count} files."

if not self.options.offline:
# on offline mode and when run under pre-commit we do not want to
# check for updates.
if not self.options.offline and os.environ.get("PRE_COMMIT", "0") != "1":
version_warning = get_version_warning()
if version_warning:
msg += f"\n{version_warning}"
Expand Down

0 comments on commit 0ca5d95

Please sign in to comment.