Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions .ai-rulez/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$schema: https://raw.githubusercontent.com/Goldziher/ai-rulez/main/schema/ai-rules-v3.schema.json
description: Convert PaddlePaddle models to ONNX format
gitignore: true
name: Paddle2ONNX

builtins:
- python
- security
- git-workflow
- code-quality
- testing
- token-efficiency
- default-commands

presets:
- claude
- gemini
- codex

compression:
level: moderate
version: "3.0"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ paddle2onnx/*.so
paddle2onnx/__pycache_*
protobuf-*

# Python / uv
.venv
__pycache__/
*.egg-info/
.hypothesis/

# Temporary files automatically generated when executing Paddle2ONNX unit tests
*.pdmodel
*.pdiparams
Expand Down
15 changes: 0 additions & 15 deletions .gitmodules

This file was deleted.

163 changes: 53 additions & 110 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,111 +1,54 @@
# Exclude all third-party libraries
exclude: |
(?x)^(
patches/.+|
third_party/.+
)$
default_install_hook_types:
- pre-commit
- commit-msg
exclude: ^third_party/|vendor/|node_modules/|dist/|\.setuptools-cmake-build/|patches/

repos:
# Common hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: check-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.1
hooks:
- id: remove-crlf
- id: remove-tabs
name: Tabs remover (C++)
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps)$
args: [--whitespaces-count, '2']
- id: remove-tabs
name: Tabs remover (Python)
files: (.*\.(py|bzl)|BUILD|.*\.BUILD|WORKSPACE)$
args: [--whitespaces-count, '4']
# Exclude some unit test files that require tabs.
- repo: local
hooks:
- id: copyright_checker
name: copyright_checker
entry: python ./tools/codestyle/copyright.py
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|xpu|kps|py|pyi|sh)$
# For Python files
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --no-cache]
# For C++ files
- repo: local
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat.
entry: bash ./tools/codestyle/clang_format.sh -i
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps)$
- repo: local
hooks:
- id: cpplint-cpp-source
name: cpplint
description: Check C++ code style using cpplint.py.
entry: bash ./tools/codestyle/cpplint_pre_commit.sh
language: system
files: \.(cc|cxx|cpp|cu|h|hpp|hxx)$
args:
- --extensions=cc,cxx,cpp,cu,cuh,h,hpp,hxx,kps
- --filter=-readability/fn_size,-build/include_what_you_use,-build/c++11,-whitespace/parens
- --quiet
- repo: local
hooks:
- id: clang-tidy
name: clang-tidy
description: Parallel clang-tidy runner.
entry: python ./tools/codestyle/clang-tidy.py
language: system
files: \.(c|cc|cxx|cpp|h|hpp|hxx)$
args:
- -p=build/
- -extra-arg=-Wno-unknown-warning-option
- -extra-arg=-Wno-pessimizing-move
- -extra-arg=-Wno-braced-scalar-init
- -extra-arg=-Wno-dangling-gsl
- -extra-arg=-Wno-deprecated-copy
- -extra-arg=-Wno-final-dtor-non-final-class
- -extra-arg=-Wno-implicit-int-float-conversion
- -extra-arg=-Wno-inconsistent-missing-override
- -extra-arg=-Wno-infinite-recursion
- -extra-arg=-Wno-mismatched-tags
- -extra-arg=-Wno-self-assign
- -extra-arg=-Wno-sign-compare
- -extra-arg=-Wno-sometimes-uninitialized
- -extra-arg=-Wno-tautological-overlap-compare
- -extra-arg=-Wno-unused-const-variable
- -extra-arg=-Wno-unused-lambda-capture
- -extra-arg=-Wno-unused-private-field
- -extra-arg=-Wno-unused-value
- -extra-arg=-Wno-unused-variable
- -extra-arg=-Wno-overloaded-virtual
- -extra-arg=-Wno-defaulted-function-deleted
- -extra-arg=-Wno-delete-non-abstract-non-virtual-dtor
- -extra-arg=-Wno-return-type-c-linkage
# For CMake files
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/PFCCLab/cmake-lint-paddle
rev: v1.5.1
hooks:
- id: cmakelint
args: [--config=./tools/codestyle/.cmakelintrc]
# Commit message linting
- repo: https://github.com/Goldziher/gitfluff
rev: v0.8.0
hooks:
- id: gitfluff-lint
args: ["--write"]
stages: [commit-msg]

# AI-Rulez: auto-generate AI assistant configuration files
- repo: https://github.com/Goldziher/ai-rulez
rev: v3.8.3
hooks:
- id: ai-rulez-generate

# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-added-large-files
- id: detect-private-key
- id: check-json
- id: check-yaml
args: ["--allow-multiple-documents", "--unsafe"]
- id: check-toml
- id: check-case-conflict

# TOML formatting
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "v2.16.2"
hooks:
- id: pyproject-fmt

- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
exclude: "pyproject.toml"

# Python: ruff (linting + formatting)
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
Loading