forked from ultralytics/yolov5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pre-commit CI actions (ultralytics#4982)
* define pre-commit * add CI code * configure * apply pre-commit * fstring * apply MD * pre-commit * Update torch_utils.py * Update print strings * notes * Cleanup code-format.yml * Update setup.cfg * Update .pre-commit-config.yaml Co-authored-by: Glenn Jocher <[email protected]>
- Loading branch information
1 parent
78fc024
commit 52b605d
Showing
30 changed files
with
273 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Run code formatting GitHub Action, can be replaced by this bot: https://github.com/marketplace/pre-commit-ci | ||
|
||
name: Code formatting | ||
|
||
on: # https://help.github.com/en/actions/reference/events-that-trigger-workflows | ||
push: | ||
branches: [master] | ||
pull_request: {} | ||
|
||
jobs: | ||
pep8-check-flake8: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Install dependencies | ||
run: | | ||
pip install flake8 | ||
pip list | ||
shell: bash | ||
- name: PEP8 | ||
run: | | ||
flake8 . | ||
pre-commit-check: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# for private repo - first is the checkout step, which needs to use unlimited fetch depth for pushing | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-python@v2 | ||
|
||
- name: set PY | ||
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- uses: pre-commit/[email protected] | ||
# this action also provides an additional behaviour when used in private repositories | ||
# when configured with a github token, the action will push back fixes to the pull request branch | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
*.data | ||
*.json | ||
*.cfg | ||
!setup.cfg | ||
!cfg/yolov3*.cfg | ||
|
||
storage.googleapis.com | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Define hooks for code formations | ||
# Will be applied on any updated commit files if a user has installed and linked commit hook | ||
|
||
default_language_version: | ||
python: python3.8 | ||
|
||
# Define bot property if installed via https://github.com/marketplace/pre-commit-ci | ||
ci: | ||
autofix_prs: true | ||
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions' | ||
autoupdate_schedule: quarterly | ||
# submodules: true | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: check-case-conflict | ||
- id: check-yaml | ||
- id: check-toml | ||
- id: pretty-format-json | ||
- id: check-docstring-first | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.23.1 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py36-plus] | ||
name: Upgrade code | ||
|
||
# TODO | ||
#- repo: https://github.com/PyCQA/isort | ||
# rev: 5.9.3 | ||
# hooks: | ||
# - id: isort | ||
# name: imports | ||
|
||
# TODO | ||
#- repo: https://github.com/pre-commit/mirrors-yapf | ||
# rev: v0.31.0 | ||
# hooks: | ||
# - id: yapf | ||
# name: formatting | ||
|
||
# TODO | ||
#- repo: https://github.com/executablebooks/mdformat | ||
# rev: 0.7.7 | ||
# hooks: | ||
# - id: mdformat | ||
# additional_dependencies: | ||
# - mdformat-gfm | ||
# - mdformat-black | ||
# - mdformat_frontmatter | ||
|
||
# TODO | ||
#- repo: https://github.com/asottile/yesqa | ||
# rev: v1.2.3 | ||
# hooks: | ||
# - id: yesqa | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 3.9.2 | ||
hooks: | ||
- id: flake8 | ||
name: PEP8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.