﻿# Aider lint commands receive filenames and must distinguish formatting from failure

Connect a custom linter to Aider with correct filename arguments and exit semantics, distinguishing a formatter that changed files from a genuine unresolved failure.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-aider-lint-filenames-formatter-exit/
Language: en

## Treat linting as a command interface

A project replaces its default checks with a preferred linter, but Aider starts diagnosing command-line errors as code defects. The integration contract matters: the linter must accept the filenames Aider supplies and expose genuine failures through its output and exit status. Test that small interface independently before allowing its messages to drive repeated model edits.

## Accept the intended file arguments

The [testing and linting guide](https://aider.chat/docs/usage/lint-test.html) says custom lint commands receive filenames and should report errors on standard output or error with a nonzero exit. This differs from the test-command path, which does not append filenames. A script designed to run a complete project test suite may interpret appended paths incorrectly. Decide whether the check belongs in the lint or test role according to its actual invocation needs.

## Make formatting outcomes unambiguous

Some formatters return a nonzero status after modifying files even when no unresolved defect remains. The guide warns that this can look like a lint error to Aider. Use a wrapper or check mode with meaningful final status for the chosen formatter, and inspect the resulting file changes. Do not suppress every nonzero outcome merely to quiet the assistant: that also hides genuine syntax or rule failures the repair loop should receive.

## Read configuration and manual scope separately

The [options reference](https://aider.chat/docs/config/options.html) documents language-qualified `--lint-cmd` values and automatic linting enabled by default. Automatic testing is a separate setting. The [command reference](https://aider.chat/docs/usage/commands.html) says manual `/lint` works on in-chat files, or dirty files if none are present. A manual check can consequently have a different file scope from the last edited file. Record the effective selection before attributing an unrelated existing violation to the new patch.

## Review what the feedback caused

Use a small formatting change and a real lint error to verify that they produce the intended distinct outcomes. Inspect diagnostics, assistant repairs, and the final diff together. The [task-contract guide](/journal/learn-codex-task-contract/) keeps the requested change visible; [tool observations](/journal/learn-codex-tool-observation/) distinguish command status from repaired behavior. Once the interface is correct, evaluate the actual code change instead of repeatedly broadening the lint scope to obtain a reassuring green result.
