Skip to main content

GenerateLinterConfig - 代码检查规则生成工具

Project description

en zh-cn

generate-linter-configuration-beta

beta edition of a linter configuration generate tool ,mainly use LLM . May need some help while using .

How to use

  1. 安装:在根目录下打开终端,使用指令安装
pip install -e .
  1. 配置大模型:配置大模型:本项目使用litellm库进行大模型的统一格式调用,因此在使用前请确保您已经将自己的key配置为环境变量且有充足的token资源。

  2. 使用示例:

    gen-linter-config -t checkstyle --input "函数参数不多于5个"
    gen-linter-config -t checkstyle --input rule.txt --out output.json
    gen-linter-config -t checkstyle --input "使用大括号包裹代码块" --format json
    gen-linter-config --tool Cppcheck --model dashscope/qwen3-max --input "禁止使用可能返回空指针的 malloc 函数而不进行检查。"
    # cppcheck不适用属性名系统所以实际上不会返回包含属性名的内容。
    

    如果不指定输出文件则直接输出在控制台中。

将key配置为系统级环境变量

Windows:通过系统属性设置。找到系统-属性,找到高级系统设置-环境变量,然后在上方的用户环境变量中新建一个变量名为OPENAI_API_KEY,值为密钥的值的用户变量。

Linux/macos:在shell配置文件中设置环境变量。打开终端,根据使用shell的不同执行指令:

# Bash
nano ~/.bashrc
# Zsh
nano ~/.zshrc
# 其它的shell可能需要查阅相关文档确定具体指令。

在配置文件中添加:

export OPENAI_API_KEY=[你的 OpenAI API 密钥]

然后保存并退出。让更改生效:

# Bash
source ~/.bashrc
# Zsh
source ~/.zshrc
# 其它的shell可能需要查阅相关文档确定具体指令。

支持的工具清单

Tool Y/N
Checkstyle Y
ESLint Y
Biome Y
ClangTidy Y
CppCheck Y
Flake8 Y
PMD Y
Pylint Y
Reek Y
RuboCop Y
Ruff Y

其中Checkstyle和ESLint支持较为完善的生成机制,其余工具则不支持,更多工具的配置生成还在开发中。

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

gen_linter_config-1.0.0.tar.gz (137.2 kB view details)

Uploaded Source

Built Distribution

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

gen_linter_config-1.0.0-py3-none-any.whl (145.4 kB view details)

Uploaded Python 3

File details

Details for the file gen_linter_config-1.0.0.tar.gz.

File metadata

  • Download URL: gen_linter_config-1.0.0.tar.gz
  • Upload date:
  • Size: 137.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gen_linter_config-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9e9249d65000c9d31aef4f089d67aa71608cc8212191d20c9e8eafa75b3c70ba
MD5 64ccf62dfccae7ea31f4049fc7e0699f
BLAKE2b-256 ce9ef483aafb48e73609f0e4a2aedd29f76ffb538bf84a2993f8e765a9ae4b46

See more details on using hashes here.

File details

Details for the file gen_linter_config-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gen_linter_config-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b4d7e5fc647c0f09e84181ff69c9ce6fdae5bf9c92bbc085f674ea17dbd0d0
MD5 c9c91cfd26e7057f1b4ba5b90e573db7
BLAKE2b-256 d65e5ad30858d597322d4c09cded01ea833ef63b5d27b32965ac3522dcae0bfb

See more details on using hashes here.

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