con un clic
run-code-quality-tool
// Use when source code changes under lib/jnpr/junos and the user wants to run static code analysis and code format using pylint and ruff
// Use when source code changes under lib/jnpr/junos and the user wants to run static code analysis and code format using pylint and ruff
| name | run-code-quality-tool |
| description | Use when source code changes under lib/jnpr/junos and the user wants to run static code analysis and code format using pylint and ruff |
| allowed-tools | ["run_in_terminal","read_file","get_changed_files","grep_search"] |
| context | fork |
Run formatting checks and static analysis for Python changes under lib/jnpr/junos.
Install pylint and ruff before running checks:
python3 -m pip install pylint ruffCollect changed files under lib/jnpr/junos and keep only .py files.
Preferred commands:
git diff --name-only -- lib/jnpr/junos | grep -E '\\.py$'git diff --name-only --cached -- lib/jnpr/junos | grep -E '\\.py$'Run formatting check for only changed Python files under lib/jnpr/junos:
CHANGED=$( (git diff --name-only -- lib/jnpr/junos; git diff --name-only --cached -- lib/jnpr/junos) | grep -E '\\.py$' | sort -u )if [ -n "$CHANGED" ]; then echo "$CHANGED" | xargs -I{} ruff format --check "{}"; else echo "No changed Python files under lib/jnpr/junos"; fiRun pylint for only changed Python files first:
CHANGED=$( (git diff --name-only -- lib/jnpr/junos; git diff --name-only --cached -- lib/jnpr/junos) | grep -E '\\.py$' | sort -u )if [ -n "$CHANGED" ]; then pylint $CHANGED --exit-zero; else echo "No changed Python files under lib/jnpr/junos"; fiIf requested, run ruff format across all tracked Python files:
git ls-files '*.py' | xargs -I{} ruff format "{}"If requested, run the broader pylint command:
pylint $(git ls-files '*.py' | grep -vE '^(docs/|build/|tests/|samples/|setup.py|versioneer.py)') --exit-zeroWhen this skill is invoked, the final response must include:
lib/jnpr/junos.ruff format --check result for changed files.pylint result for changed files.