Skip to main content

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

Project description

en zh-cn

gen-linter-config

A LLM-based linter configuration generate tool .

How to use

  1. install:
pip install gen-linter-config
  1. Configuring LLM: This project uses litellm to call large model in a unified format, so please make sure that you have configured your key as an environment variable and have sufficient token resources before using it.

  2. Usage Example:

    gen-linter-config -t checkstyle --input "No more than 5 function parameters"
    gen-linter-config -t checkstyle --input rule.txt --out output.json
    gen-linter-config -t checkstyle --input "Wrap the code block in braces" --format json
    gen-linter-config --tool Cppcheck --model dashscope/qwen3-max --input "It is forbidden to use malloc functions that may return null pointers without checking."
    # Cppcheck does not apply to the attribute name system, so it will not actually return the content containing the attribute name.
    

Configure key as a system-level environment variable

Windows:Through the system property settings. Find system-properties, find advanced system settings-environment variable, and then create a new user variable with the variable named OPENAI_API_KEY and the value of the key in the user environment variable above.

Linux/macos:Set environment variables in the shell configuration file. Open the terminal and execute the instructions according to different shell:

# Bash
nano ~/.bashrc
# Zsh
nano ~/.zshrc
# Other shell may need to consult relevant documents.

Add in the configuration file:

export OPENAI_API_KEY=[Your OpenAI API key]

Then save and exit. Make the changes take effect:

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

Parameter Introduction

Parameter introduce must default
-h, --help show help message and exit n -
--tool, -t Specify the code checking tool y -
--input, -i File path or rule text y -
--model, -m Specify the model to use n qwen3.7-max
--out, -o Output file path n -
--examples, -e Sample text n -
--full Full prompt mode n false
--api-key, -k API key for LLM n -
--debug, -d Debug mode, output complete log in logs directory n false
--version, -v show program's version number and exit n -

If you don't specify an output file, the output will directly printed in the console.

List of supported tools

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

Among them, Checkstyle and ESLint support a relatively perfect generation mechanism, while other tools do not. The configuration generation of more tools is still under development.

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.1.1.tar.gz (2.0 MB 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.1.1-py3-none-any.whl (3.8 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gen_linter_config-1.1.1.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • 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.1.1.tar.gz
Algorithm Hash digest
SHA256 a54e694154d2a64eb8d6289d61ae381c3915912a3f919830ee8bd28bb215372a
MD5 1af6531c4e77ba25b8a8c6e56d040c2e
BLAKE2b-256 4330be86758b443ae76b99194de9aad675ee7e77491101bff6c18f5007c0eb37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gen_linter_config-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8d8af57d7bfbc4ff09e1c6e269e85b5b91e9f08859346ab020f3ad929a3b83a
MD5 ecb75db7d7db6468ac79412719a00ce5
BLAKE2b-256 0a784f014881f57fd3546469479a553ae30c404ad9ab849eee7fe55a225bc6fd

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