code-standards

Enforces MindIE-SD Python formatting and lint rules via ruff, pylint, bandit, and pre-commit.

14|5|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Ascend/MindIE-SD --skill code-standards-ascend
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-standards
Source: https://github.com/Ascend/MindIE-SD/tree/main/.agents/skills/code-standards
Command: npx skills add https://github.com/Ascend/MindIE-SD --skill code-standards-ascend

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Python contributors to the MindIE-SD repository face confusing lint behavior: the CI gate reads pre-commit/pyproject.toml (line-length 120, minimal ruff rule set) while local IDEs read the root pyproject.toml (line-length 100, broader rules), causing "local fails but CI passes" confusion and accidental mass-reformatting of untouched code. ## Core Features & Use Cases - Gate Configuration Truth Source: Documents exactly which config file the pre-commit gate reads, with a diff table of divergent values (line-length, quote-style, enabled rule sets) between the two pyproject.toml files. - Hook Inventory & Rule Classification: Lists all 21 pre-commit hook entries (ruff, pylint, bandit, codespell, typos, clang-format, clang-tidy, gitleaks, markdownlint) and classifies each style rule as gate-enforced, review convention, or unverifiable historical record. - Anti-Diff-Pollution Rules: Forbids formatting unmodified lines, renaming existing variables, or changing quote styles, keeping MRs reviewable. - Use Case: A developer sees E501 Line too long (102 > 100) locally but CI passes; this Skill explains the gate uses 120 columns with E501 disabled, and provides the exact ruff check --config pre-commit/pyproject.toml commands to reproduce CI behavior. ## Quick Start Ask the AI to check and fix lint issues in your modified MindIE-SD Python file using the gate configuration before committing.

Frequently Asked Questions about code-standards

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reproduce the MindIE-SD CI lint gate locally?

Run ruff with the gate config: `ruff check --config pre-commit/pyproject.toml --fix <file>` and `ruff format --config pre-commit/pyproject.toml <file>`, or run `pre-commit run --all-files` for the full default-stage hook set. The root pyproject.toml is not what the gate reads.

Why does ruff report E501 locally but CI passes?

The gate config sets line-length to 120 and does not enable E501, while the root pyproject.toml uses 100 columns with a broader rule set for local IDE use. Local E501 errors at 100 columns do not indicate a CI failure.

What pre-commit hooks run on MindIE-SD commits?

Twenty hooks run at the default stage, including ruff-check, ruff-format, pylint, bandit, codespell, typos, clang-format, clang-tidy, gitleaks, and markdownlint-agents for .agents/ files. A separate markdownlint-manual hook for other Markdown files requires `--hook-stage manual`.

Can I run ruff format on the whole file to fix style?

No. The project forbids formatting unmodified lines, changing quote styles, renaming existing variables, or collapsing expressions, because unrelated diffs burden review and cause merge conflicts. Only fix lint on lines you actually changed.

Which style rules are enforced by the gate versus review convention only?

Gate-enforced rules include bandit B110 (except-pass), B607 (subprocess bare command names), ruff SIM115 and D209. Rules like protected-access, raise-missing-from, and the 5-parameter limit are review conventions disabled in the pylint gate config.