Skip to content

Commit 099bc5f

Browse files
authored
sync pre-commit from PPOCR (#10)
1 parent 3135cdb commit 099bc5f

File tree

3 files changed

+74
-1
lines changed

3 files changed

+74
-1
lines changed

.github/workflows/codestyle.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Code Style Check
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ['main', 'release/*']
7+
8+
jobs:
9+
check-code-style:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{ github.ref }}
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.10'
18+
# Install Dependencies for Python
19+
- name: Install Dependencies for Python
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install "clang-format==13.0.0"
23+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: a11d9314b22d8f8c7556443875b731ef05965464
4+
hooks:
5+
- id: check-merge-conflict
6+
- id: check-symlinks
7+
- id: detect-private-key
8+
files: (?!.*paddle)^.*$
9+
- id: end-of-file-fixer
10+
files: \.md$
11+
- id: trailing-whitespace
12+
files: \.md$
13+
- repo: https://github.com/Lucas-C/pre-commit-hooks
14+
rev: v1.0.1
15+
hooks:
16+
- id: forbid-crlf
17+
files: \.md$
18+
- id: remove-crlf
19+
files: \.md$
20+
- id: forbid-tabs
21+
files: \.md$
22+
- id: remove-tabs
23+
files: \.md$
24+
- repo: local
25+
hooks:
26+
- id: clang-format
27+
name: clang-format
28+
description: Format files with ClangFormat
29+
entry: bash .clang_format.hook -i
30+
language: system
31+
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|cuh|proto)$
32+
# For Python files
33+
- repo: https://github.com/psf/black.git
34+
rev: 23.3.0
35+
hooks:
36+
- id: black
37+
files: (.*\.(py|pyi|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
38+
39+
# Flake8
40+
- repo: https://github.com/pycqa/flake8
41+
rev: 7.0.0
42+
hooks:
43+
- id: flake8
44+
args:
45+
- --count
46+
- --select=E9,F63,F7,F82
47+
- --show-source
48+
- --statistics
49+
exclude: ^benchmark/|^test_tipc/
50+

libs/ustr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def ustr(x):
2525
if type(x) == QString:
2626
# https://blog.csdn.net/friendan/article/details/51088476
2727
# https://blog.csdn.net/xxm524/article/details/74937308
28-
return unicode(x.toUtf8(), DEFAULT_ENCODING, "ignore")
28+
return unicode(x.toUtf8(), DEFAULT_ENCODING, "ignore") # noqa
2929
return x
3030
else:
3131
return x

0 commit comments

Comments
 (0)