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

Anonymous namespaces opening bracket removed after using -fix #19

Open
PascalBoeschoten opened this issue Sep 14, 2017 · 11 comments
Open

Comments

@PascalBoeschoten
Copy link

I tried running run_O2CodeChecker.py with the -fix option on the ReadoutCard library (master branch).
This resulted in anonymous namespaces being broken by having their opening bracket removed.
For example, code like:

namespace {
 // some stuff in here
}

is turned into:

namespace
 // some stuff in here
}

The command I used was

run_O2CodeChecker.py -clang-tidy-binary `which O2codecheck` -checks=-*,modernize-*,-modernize-use-default,-modernize-pass-by-value,-modernize-use-auto,-modernize-use-bool-literals,-modernize-use-using,-modernize-loop-convert,-modernize-use-bool-literals,-modernize-make-unique,aliceO2-member-name,alice* -fix
@sawenzel
Copy link
Collaborator

Thanks for this report.
@ZdravkoD : Can you please take a look into this bug report?

Please note that the namespace check is development is progress. Please disable it for the moment. The only checks in production are the ones listed in the o2checkcode.sh recipe.
We might have to go to a real release model ... now that people are starting to use the checks -:)

@sawenzel
Copy link
Collaborator

@PascalBoeschoten: I merged an improved namespace checker. Would you mind trying it out and seeing if the bug is solved?

@PascalBoeschoten
Copy link
Author

If I run

run_O2CodeChecker.py -clang-tidy-binary `which O2codecheck` -checks=-*,aliceO2-namespace-naming -fix

it doesn't seem to find/change anything, even though my namespace names are camelcase. But it also doesn't break anonymous namespaces anymore.

@ZdravkoD
Copy link
Contributor

@PascalBoeschoten Can you try running O2codecheck --list-checks --checks="alice*" and check if aliceO2-namespace-naming appears in the list? The command that you gave runs fine and finds namespace errors when I run it at ~/alice/sw/BUILD/O2-latest/O2/.

@PascalBoeschoten
Copy link
Author

It appears in the list.
The command I gave also lists only aliceO2-namespace-naming as check (others are all disabled)

$> run_O2CodeChecker.py -clang-tidy-binary `which O2codecheck` -checks=-*,aliceO2-namespace-naming -fix
Enabled checks:
    aliceO2-namespace-naming

@sawenzel
Copy link
Collaborator

@PascalBoeschoten : Ok, I believe I know why this is: We recently needed to added filtering of the source path of the translation unit and we have probably put something with O2 ... not knowing that other repos want to use the tool as well. @ZdravkoD : We need to add configuration of the path from the outside.

@sawenzel
Copy link
Collaborator

@PascalBoeschoten : We now added a configuration possibility to let the tool know which repository it is checking. Can you please add a .clang-tidy file inside your project as mentioned in this commit 642b8f4 and provide the proper regular expression matching your source tree.

Feedback is highly welcome.

@sawenzel
Copy link
Collaborator

@PascalBoeschoten : see also AliceO2Group/AliceO2#583; I checked that this works for O2 and the namespace checks.

@PascalBoeschoten
Copy link
Author

So the file would contain something like this?

CheckOptions:
  - key: CheckPathRegex
    value: '.*/ReadoutCard/.*'

@ZdravkoD
Copy link
Contributor

@PascalBoeschoten : Yes, that should work if your files are located at a subfolder of ReadoutCard.

@PascalBoeschoten
Copy link
Author

Done

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

No branches or pull requests

3 participants