Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SG-33057 Update pre-commit hooks #58

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Styles the code properly

default_language_version:
python: python3

# List of super useful formatters.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v5.0.0
hooks:
# Ensures the code is syntaxically correct
- id: check-ast
language_version: python3
# Ensures a file name will resolve on all platform
- id: check-case-conflict
# Checks files with the execute bit set have shebangs
Expand All @@ -22,8 +25,7 @@ repos:
# Removes trailing whitespaces.
- id: trailing-whitespace
# Leave black at the bottom so all touchups are done before it is run.
- repo: https://github.com/ambv/black
rev: 23.7.0
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ You save the following as a starting point at the root of your respository in a
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

default_language_version:
python: python3

# Styles the code properly
# Exclude the UI files, as they are auto-generated.
exclude: "ui\/.*py$"
Expand All @@ -51,7 +54,6 @@ repos:
hooks:
# Ensures the code is syntaxically correct
- id: check-ast
language_version: python3
# Ensures a file name will resolve on all platform
- id: check-case-conflict
# Checks files with the execute bit set have shebangs
Expand All @@ -65,12 +67,10 @@ repos:
# Removes trailing whitespaces.
- id: trailing-whitespace
# Leave black at the bottom so all touchups are done before it is run.
- repo: https://github.com/ambv/black
rev: 19.10b0
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
language_version: python3

```

## Azure Pipeline configuration
Expand Down
3 changes: 3 additions & 0 deletions internal/code-style-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
- name: tk-core
ref: ${{ parameters.tk_core_ref }}

- bash: pre-commit autoupdate
displayName: Update pre-commit hook versions

- bash: pre-commit run --all
displayName: Validate code

Expand Down