This project is a code inspection tool for teaching purposes in the "High-level Language Programming" course at Tongji University, used to check whether C/C++ code uses syntax features that violate assignment requirements.
Project description
TJHLP-CHECKER 同济高程代码合规检查
简介
高级语言程序设计 是为同济大学信息类大一学生开设的专业入门课,使用 C/C++ 教学。由于教学需求,课程对作业中允许使用的语言特性做出了一定的限制。本项目基于 libclang 的 Python binding 实现,提供 AST 级别的准确检测工具。
使用
tjhlp-checker既可以用库的形式引入,也可以直接作为 CLI 工具使用。
安装
pip install tjhlp-checker
# 若需直接在命令行使用,则改为:
# pip install tjhlp-checker[cli]
作为库引入
import sys
from tjhlp-checker import load_config, find_all_violations
if __name__ == '__main__':
"""
Usage: python main.py <cpp file> <config file>
"""
with open(sys.argv[2], 'rb') as conf:
violations = find_all_violations(
sys.argv[1],
load_config(conf)
)
print(violations)
直接在命令行使用
pip install tjhlp-checker[cli]
tjhlp-checker --config-file=<PATH TO CONFIG FILE> <FILE>
配置文件使用 TOML 格式。由于本项目使用 Pydantic 验证配置文件格式,因此具体配置项可以直接参考 src/tjhlp_checker/config.py。
构建
本项目使用 uv 进行项目管理。
git clone https://github.com/Tongji-High-level-Language-Programming/tjhlp-checker && cd tjhlp-checker
uv sync --all-extras --dev
uvx pre-commit install
uv build
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tjhlp_checker-0.2.0.tar.gz.
File metadata
- Download URL: tjhlp_checker-0.2.0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4170713b57905e0ab52b39259fbcfb66c2f21cc3d2f75428de51a7cb50f075f
|
|
| MD5 |
21d386765dd524eab9188d78f7ce0652
|
|
| BLAKE2b-256 |
02cfcdd84d8b2a85be633b1532033aeb6dec9fa17379d0ee134759b8b9e4ddfd
|
Provenance
The following attestation bundles were made for tjhlp_checker-0.2.0.tar.gz:
Publisher:
pypi.yml on Tongji-High-level-Language-Programming/tjhlp-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tjhlp_checker-0.2.0.tar.gz -
Subject digest:
b4170713b57905e0ab52b39259fbcfb66c2f21cc3d2f75428de51a7cb50f075f - Sigstore transparency entry: 1412047277
- Sigstore integration time:
-
Permalink:
Tongji-High-level-Language-Programming/tjhlp-checker@6085d7ea3ac318eceeac50b82a480b37e2ab3226 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Tongji-High-level-Language-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@6085d7ea3ac318eceeac50b82a480b37e2ab3226 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tjhlp_checker-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tjhlp_checker-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f739fd3873df5bc38b2c4507748147957ec9266877ecc27d8844f6e2442a0025
|
|
| MD5 |
95fa4b1ac6974e17b4c73bc4abc70923
|
|
| BLAKE2b-256 |
1d9916fb4613ab3abf280f234c6a599b532ba9a1826038526173aec5cad44001
|
Provenance
The following attestation bundles were made for tjhlp_checker-0.2.0-py3-none-any.whl:
Publisher:
pypi.yml on Tongji-High-level-Language-Programming/tjhlp-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tjhlp_checker-0.2.0-py3-none-any.whl -
Subject digest:
f739fd3873df5bc38b2c4507748147957ec9266877ecc27d8844f6e2442a0025 - Sigstore transparency entry: 1412047388
- Sigstore integration time:
-
Permalink:
Tongji-High-level-Language-Programming/tjhlp-checker@6085d7ea3ac318eceeac50b82a480b37e2ab3226 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/Tongji-High-level-Language-Programming
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@6085d7ea3ac318eceeac50b82a480b37e2ab3226 -
Trigger Event:
release
-
Statement type: