Lint: how-to for local configuration?

Hello,
Can someone point me some how-to configure the lint and more important the rules used by lint for GitHub pull request?

Each time I try to submit a PR lint stop me because I have a different rule on my local environment.

Some inputs?

Hello;

If you are using VScode + PIO you have to add the “clang-Format” extension.
Once done, do a right-click into the file and click on “Format document”.
It should take automatically the right rules for the workspace.

Thanks, Discovered my problem, I had a tool set by default which was different

Is required clang-formatter as npm global package already installed and clang-formatter plugin on vscode

Now I hope is ok :blush:

Thanks!

1 Like

How should I configure clang-format with VSCode and PIO?

I’m running Windows 10, I’ve installed Clang-Format v1.9.0 xaver under VSCode v1.66.2. I’ve tried uninstalling then reinstalling VSCode and Clang-Format without correcting the problem. Formatting the code with C/C++ does not produce an error.

When formatting with clang-foirmat I get this error message:

YAML:7:21: error: unknown key ‘IndentPPDirectives’
IndentPPDirectives: AfterHash
^~~~~~~~~
Error reading c:\Users\joe\Documents\PlatformIO\Projects\OpenMQTTGateway-0.9.11 2022-04-20.clang-format: invalid argument

When you say formatting with clang-format, how do you do it exactly?

When an .ino file is being edited, right click, from the pull-down select “Format Document With…” then choose “Clang-Format”. If “C/C++ (default)” is chosen instead then there is no error message.

Same error message if Clang-Format is configured as the default formatter and Shift+Alt+F is pressed.

Is a configuration in VSCode needed to activate Clang-Format or particular version of it?

Fixed the problem.

LLVM v3.9.1 was installed on my system, removed it and installed v14.0.0. In VS Code settings specified the path C:\Program Files\LLVM\bin\clang-format.exe then the problem was corrected.

1 Like