Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable "--config-file" flag for clang-tidy #4186

Closed
stevenengland opened this issue Feb 19, 2022 · 0 comments · Fixed by #4210
Closed

Enable "--config-file" flag for clang-tidy #4186

stevenengland opened this issue Feb 19, 2022 · 0 comments · Fixed by #4210

Comments

@stevenengland
Copy link

What kind of issue is this?

  • [ x] Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Win10

PlatformIO Version (platformio --version): latest

Description of problem

As a developer I would like to tell clang-tidy to use an external config file to keep my configs clean. Especially when handling multiple clang-tidy checks the code looks messy if I am forced to use the clangtidy extra flag --checks= for that purpose.
Instead it would be great to use a config file that is made of yaml like this:

---
Checks:              '-*,some-check'
WarningsAsErrors:    ''
HeaderFilterRegex:   ''
FormatStyle:         none
InheritParentConfig: true
User:                user
CheckOptions:
  - key:             some-check.SomeOption
    value:           'some value'
...

CLang Tidy comes with a flag --config-file for that scenario (see clang-tidy --help, it is not documented on the websites). Its help text is: "Specify the path of .clang-tidy or custom config file: e.g. --config-file=/some/path/myTidyConfigFile This option internally works exactly the same way as --config option after reading specified config file. Use either --config-file or --config, not both."

Actually it is not possible to use this flag because at least the Checks part is overriden due to the logic in https://github.com/platformio/platformio-core/blob/4839fe37a3d1433737c80147ce9a205100dc4925/platformio/commands/check/tools/clangtidy.py:

if not self.is_flag_set("--checks", flags):
            cmd.append("--checks=*")

Additional info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants