Skip to main content

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 同济高程代码合规检查

Continuous Integration cov PyPI - Version

简介

高级语言程序设计 是为同济大学信息类大一学生开设的专业入门课,使用 C/C++ 教学。由于教学需求,课程对作业中允许使用的语言特性做出了一定的限制。本项目基于 libclangPython 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/Maoyao233/tjhlp-checker && cd tjhlp-checker
uv sync --all-extras --dev
uv build

使用 Docker

也可以直接使用 Docker:

docker build -t tjhlp-checker .
docker run -it tjhlp-checker

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

tjhlp_checker-0.1.3.tar.gz (22.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tjhlp_checker-0.1.3-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file tjhlp_checker-0.1.3.tar.gz.

File metadata

  • Download URL: tjhlp_checker-0.1.3.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tjhlp_checker-0.1.3.tar.gz
Algorithm Hash digest
SHA256 125b5c0ebeae9a81da6b69391fa1525702151e0dd859f132ffb07696b7aac051
MD5 219c6224c2f8cdbb5568d273aa3cdc86
BLAKE2b-256 a75c7bc1d3bf10be4abea4864cec15be9452b816afc6a5d01cb84d5d96a71316

See more details on using hashes here.

Provenance

The following attestation bundles were made for tjhlp_checker-0.1.3.tar.gz:

Publisher: pypi.yml on Maoyao233/tjhlp-checker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tjhlp_checker-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: tjhlp_checker-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for tjhlp_checker-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7b828cf8dc7be23505a44a212e3f03fb5e36fcb84fbe427b9ea51b557e9eb99c
MD5 fa9983169c999c9e84132d6335623abe
BLAKE2b-256 ac1d4619c162827181a4530f87fb97b6cfccee8d1d950daf7701a27a20bd8dea

See more details on using hashes here.

Provenance

The following attestation bundles were made for tjhlp_checker-0.1.3-py3-none-any.whl:

Publisher: pypi.yml on Maoyao233/tjhlp-checker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page