Skip to content

Support using fixers (specifically clang-format) as a linter #5098

@abudden

Description

@abudden

I generally don't want to let code formatters loose on my code. However, I am interested in knowing when they think I'm doing something wrong. That helps let me get into good habits rather than relying on a formatter to sort things out.

clang-format has a dry-run option -n that just reports when things would be reformatted. The error messages aren't that helpful (they all say "warning: code should be clang-formatted [-Wclang-format-violations]") but it would be nice to have this as an ALE lint output where it just puts a note on the end of the line rather than having to run the fixer.

The way I would imagine using this:

let g:ale_linters = {'cpp': ['cppcheck', 'clang-format']}

Then I'd see this:

Image

At the moment my work-around is to run it from the command-line, either with the dry-run option or (more commonly) outputting into a temporary file and using BeyondCompare to see what it thinks should change.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions