Skip to content

Commit

Permalink
sync pre-commit from PPOCR (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatV authored May 16, 2024
1 parent 3135cdb commit 099bc5f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Code Style Check

on:
pull_request:
push:
branches: ['main', 'release/*']

jobs:
check-code-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.10'
# Install Dependencies for Python
- name: Install Dependencies for Python
run: |
python -m pip install --upgrade pip
pip install "clang-format==13.0.0"
- uses: pre-commit/action@v3.0.1
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: a11d9314b22d8f8c7556443875b731ef05965464
hooks:
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
files: (?!.*paddle)^.*$
- id: end-of-file-fixer
files: \.md$
- id: trailing-whitespace
files: \.md$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.0.1
hooks:
- id: forbid-crlf
files: \.md$
- id: remove-crlf
files: \.md$
- id: forbid-tabs
files: \.md$
- id: remove-tabs
files: \.md$
- repo: local
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat
entry: bash .clang_format.hook -i
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
# For Python files
- repo: https://github.com/psf/black.git
rev: 23.3.0
hooks:
- id: black
files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$

# Flake8
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
args:
- --count
- --select=E9,F63,F7,F82
- --show-source
- --statistics
exclude: ^benchmark/|^test_tipc/

2 changes: 1 addition & 1 deletion libs/ustr.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def ustr(x):
if type(x) == QString:
# https://blog.csdn.net/friendan/article/details/51088476
# https://blog.csdn.net/xxm524/article/details/74937308
return unicode(x.toUtf8(), DEFAULT_ENCODING, "ignore")
return unicode(x.toUtf8(), DEFAULT_ENCODING, "ignore") # noqa
return x
else:
return x

0 comments on commit 099bc5f

Please sign in to comment.