agentleFS
prassanna-ravishankarprassanna-ravishankar/clearml-mcp/.cursor/rules/linting-philosophy.mdc

clearml-mcp / rules

Cursor rule16 starsChanged 17 months agoMITView on GitHub

linting philosophy and file-level ruff configuration

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 1,527 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository4 other files it gives its agents.

The file

We split this linting-philosophy.mdc into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Only truly global style choices that apply project-wide:

    line 15
  2. Very specific:

    Import/typing consistency: UP035, RUF013, COM812

    line 18

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
linting-philosophy.mdc
---
description: "linting philosophy and file-level ruff configuration"
alwaysApply: true
---

# Linting Philosophy: File-Level Ignores Over Global

## Core Principle
**Use file-level ignores unless we truly need global ones.** Different file types have different requirements - main source code should have strict linting, while tests and examples need appropriate flexibility.

## Configuration Structure
Linting rules are configured in [pyproject.toml](mdc:pyproject.toml) `[tool.ruff.lint]` section:

### Global Ignores (11 rules)
Only **truly global style choices** that apply project-wide:
- Exception handling style: `TRY003`, `EM101`, `EM102`, `B904`, `TRY300`, `BLE001`
- Docstring formatting consistency: `D203`, `D205`, `D212`, `D400`, `D407`, `D415`
- Import/typing consistency: `UP035`, `RUF013`, `COM812`
- Build/maintenance: `CPY`, `ERA`, `W293`

### File-Level Ignores (per-file-ignores)

#### Test Files (`tests/**/*.py`)
**11 ignores** for test-specific patterns:
- `S101` - Assert usage (required in tests)
- `ANN*` - Type annotations (relaxed for test helpers)
- `PLR2004` - Magic values (acceptable in test data)
- `SIM103`, `B007`, `ARG*` - Test helper patterns

#### Example Files (`examples/**/*.py`)
**17 ignores** for demo code flexibility:
- `T201` - Print statements (examples need output)
- `E402`, `E501` - Import placement, line length (demo flexibility)
- `F401` - Unused imports (examples may import for demonstration)
- `ANN*`, `D*` - Relaxed typing and documentation
- `BLE001` - Broad exception handling (simplified examples)

#### Main Source (`src/clearml_mcp/clearml_mcp.py`)
**4 specific ignores** for legitimate architectural needs:
- `C901` - Complex function (compare_tasks function)
- `PERF401`, `C401` - Performance patterns (specific instances)
- `PLR0913` - Argument count (specific functions)

## Benefits
✅ **Strict main code**: Source files enforce high quality standards
✅ **Appropriate flexibility**: Tests and examples have relaxed rules where needed
✅ **Clear rationale**: Each ignore is documented with specific reasoning
✅ **Maintainable**: File-specific concerns handled at file level, not globally

## Verification
```bash
# All files pass with appropriate rules
ruff check src/ tests/ examples/
# Pre-commit hooks work
pre-commit run --all-files
# CI workflows use GitHub format
ruff check --output-format=github src/ tests/ examples/
```

This approach ensures code quality without over-restricting different file types that serve different purposes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.