User forums > Using Code::Blocks

howto use clang-tidy in code::blocks

<< < (3/3)

my command line looks like this:

--- Code: ---$compiler $file -config='' -header-filter='^[^/].*' -- $includes $options
--- End code ---

I am using Linux and this has worked so far for several years. The code compiles with MSVC as well but I do not use clang-tidy on windows.

Please do not use single quotes for header names. For separators of directory names I recommend / instead of \. This also works on Windows.

Thank you blauzahn for your answer and original post!

Using exactly your line from your last message the error for me is: (I use Code::Blocks on Windows 10)

--- Code: ---File    Line     Message
YAML     1      error: not a mapping
                Error: invalid configuration specified.

--- End code ---

The log attached:

Examining the log I don't understand why it just tries to compile a few specific .cpp files of all the total. Seems to ignore the rest. From a ignored file, for instance, Tarot_Wall.cpp, I tried both
--- Code: ---#include "Tarot_Wall.h"
--- End code ---
--- Code: ---#include <Tarot_Wall.h>
--- End code ---
with no luck. It ignores Tarot_Wall.cpp every time (among others) (check the log.txt from my last message, please).

Maybe your .clang-tidy file is not correct.  Please try to move it away and try temporarily without or with a minimal one. Then create a new one (see docs howto). Start small.

You can set within the compiler settings the max errors count to zero, so that cb continues calling the "compiler" with the next "translation unit" regardless of the number of "hard compiler errors" seen so far. Output that is parsed and considered to be a warning is not limited though.

You do not have the compiler warning "-Werror" enabled, haven't you?

As for the #include<> versus "": Please have look into the core-guidelines on or/and read a decent book about C++. E.g. "A tour of C++" by Bjarne Stroustrup.

What version of clang tidy do you use?

Hi again blauzahn. Thanks for your answer, your help, your time and your patience.

The project structure is like this:

Is there where the file goes? It has no extension, right? I created a new empty file and added only to the build option "Clang Tidy".

The contents of the file are the ones you provided:

--- Code: ------

## disable all, then enable one check only:
Checks: '-*,clang-analyzer-core.NullDereference'

# Checks: '-*,modernize-use-nullptr'
# Checks: '-*,cppcoreguidelines-special-member-functions'

## disable all,then enable 2 checks:
# Checks: '-*,modernize-use-nullptr,readability-identifier-naming'

## enable all, then disable unwanted group and a single check:
# Checks: '*,-clang-analyzer-alpha*,-llvm-header-guard'

HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false

  - key:             modernize-use-nullptr.NullMacros
    value:           'NULL'
  - key:             readability-identifier-naming.PrivateMemberCase
    value:           aNy_CasE
  - key:             readability-identifier-naming.MemberPrefix
    value:           'm_'

--- End code ---

I tried it with or without "..." at the end (I don't understand if this is necessary).

Every time it tells the error YAML error: not a mapping, as seen in the attached log:

When you tell me "Then create a new one (see docs howto)." I don't understand what you are saying to me exactly. Please expand on this point, I don't know where is "docs howto".

About -Werror I looked it and it's not checked.

Clang-tidy version:

--- Code: ---H:\morgana>clang-tidy --version
  LLVM version 11.0.0
  Optimized build.
  Default target: i686-pc-windows-msvc
  Host CPU: haswell

--- End code ---

Finally, removing the file .clang-tidy alltogether produces the same YAML errors seen in the log.txt attached.


[0] Message Index

[*] Previous page

Go to full version