Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adding support for clang-format #5285

Open
@mtfurlan

Description

There is a clang-tidy check tool, but no clang-format.

I see in many projects without any kind of autoformatter, and they end up with things like a mix of spaces and tab indentation, and other such annoyances.
I would really like to be able to add clang-format to projects so they can enforce a consistent style, but adding dependencies to random open source projects isn't always a good choice.
But if they're already using pio, and pio is already distributing clang-tidy, it seems like distributing clang-format through pio is the best way forward.


The platformio/tool-clangtidy package has a few random versions(llvm has had a lot more releases), some platform support(less than llvm), but there is no link to the source for the platformio package.
The lack of source is quite confusing.

Also, if I just add check_tool = clangtidy to my platformio.ini, pio will install the platformio/tool-clangtidy package 1.150005.0 containing clang-tidy 15.0.5 from 2022 instead of the latest pio package(1.190100.0, presumably containing clang-tidy 19.1.0 from 2024) I think because of dependencies.py?
It's reasonably important to let users choose which version of clang-format and clang-tidy they get, llvm tries to not do breaking changes, but different versions still do things different.

I think the order of operations should be:

  1. Y'all create a repo for platformio/tool-clangtidy
  2. Someone(probably me) makes a PR to automate releases so whenever llvm releases, we publish a new pio registry version of clang-format,
  3. Duplicate the repo for clang-format.
    Could alternately have one repo handle both packages? It would mean that less duplication of the automation actions, which is nice, but also a little more confusing than a single source repo for each platformio package?
  4. Someone makes a PR to add clang-format as a pio check tool.
  5. Think of how to let users choose version of clang-tidy and clang-format.
    If it's just tied to pio release that's at least acceptable for now, when you update pio for your project you fight the linters a bit, and just make sure your CI and you use the same version of pio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /