Skip to content

[PWGCF] DptDpt - Filter and skimming framework fix linter issues - #18702

Open
victor-gonzalez wants to merge 3 commits into
AliceO2Group:masterfrom
victor-gonzalez:master
Open

victor-gonzalez wants to merge 3 commits into
AliceO2Group:masterfrom
victor-gonzalez:master

Conversation

@victor-gonzalez

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 17 warnings, 🔕 0 disabled

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 6376e54 at 2026-11-11 23:35:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'To reproduce the results below locally, run: '\''aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'\''.'
To reproduce the results below locally, run: 'aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'.
++ echo 'To apply all automatic fixes, add the '\''-e O2PHYSICS_CHECKER_FIX=1'\'' option.'
To apply all automatic fixes, add the '-e O2PHYSICS_CHECKER_FIX=1' option.
++ echo 'See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.'
See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.
++ echo 'Found 62 errors and 305 warnings.'
Found 62 errors and 305 warnings.
++ [[ 62 -gt 0 ]]
++ cat /sw/BUILD/f73306c1c86483f4f101eca3c3b9c861dfc21036/O2Physics-code-check/errors.txt
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:173:5: error: Call to virtual method 'EventSelectionFilterAndAnalysis::storeArmedMask' during construction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:249:44: error: C-style casts are discouraged; use static_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:306:44: error: C-style casts are discouraged; use static_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:405:17: error: Call to virtual method 'EventSelectionFilterAndAnalysis::calculateMaskLength' during construction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:436:16: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:436:16: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:440:18: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.cxx:440:18: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h:190:34: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h:190:34: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h:195:36: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/EventSelectionFilterAndAnalysis.h:195:36: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx:199:5: error: Call to virtual method 'PIDSelectionFilterAndAnalysis::storeArmedMask' during construction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/PIDSelectionFilterAndAnalysis.cxx:327:17: error: Call to virtual method 'PIDSelectionFilterAndAnalysis::calculateMaskLength' during construction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SelectionFilterAndAnalysis.cxx:65:40: error: C-style casts are discouraged; use static_cast (if needed, the cast may be redundant) [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:971:32: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:973:12: error: the type of the loop variable 'iarmed' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const reference &' (aka 'const std::_Bit_reference &') but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value [performance-implicit-conversion-in-loop,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:980:32: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:982:12: error: the type of the loop variable 'iarmed' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const reference &' (aka 'const std::_Bit_reference &') but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value [performance-implicit-conversion-in-loop,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:1011:30: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:1015:30: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:1030:16: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:1033:16: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:1049:34: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/SkimmingConfigurableCuts.cxx:1050:14: error: the type of the loop variable 'iarmed' is different from the one returned by the iterator and generates an implicit conversion; you can either change the type to the matching one ('const reference &' (aka 'const std::_Bit_reference &') but 'const auto&' is always a valid option) or remove the reference to make it explicit that you are creating a new value [performance-implicit-conversion-in-loop,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:229:5: error: Call to virtual method 'TrackSelectionFilterAndAnalysis::storeArmedMask' during construction bypasses virtual dispatch [clang-analyzer-optin.cplusplus.VirtualCall,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:238:16: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:238:16: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:241:16: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:241:16: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:368:12: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:368:12: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:373:12: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:373:12: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:378:12: error: C-style casts are discouraged; use static_cast/const_cast/reinterpret_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Core/TrackSelectionFilterAndAnalysis.cxx:378:12: error: do not use C-style cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-cstyle-cast,-warnings-as-errors]
[0 more errors; see full log]

Full log here.

@victor-gonzalez

Copy link
Copy Markdown
Collaborator Author

Hello @vkucera! Here we go!
Of the 17 remaining linter warnings 16 are false positives. The other one is a phi constrain I need to think twice on it
For the MegaLinter errors I will work on them tomorrow
I will leave the PR open until they are fixed

@vkucera

vkucera commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Hello @vkucera! Here we go! Of the 17 remaining linter warnings 16 are false positives. The other one is a phi constrain I need to think twice on it For the MegaLinter errors I will work on them tomorrow I will leave the PR open until they are fixed

Hi @victor-gonzalez , thanks for the fixes!

@victor-gonzalez

Copy link
Copy Markdown
Collaborator Author

Hi @vkucera! All remaining MegaLinter errors/warnings are false positives!
I consider the job done!
If there are not compilation errors (I hope not, it compiles locally in Ubuntu) I will merge the PR

@vkucera

vkucera commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Hi @vkucera! All remaining MegaLinter errors/warnings are false positives! I consider the job done! If there are not compilation errors (I hope not, it compiles locally in Ubuntu) I will merge the PR

Hi @victor-gonzalez , thanks for the additional fixes. I don't think that the remaining errors are all false positives though. For example:

EventSelectionFilterAndAnalysis.h:186:29: style: Condition 'atleastonealternative' is always false [knownConditionTrueFalse]
      atleastonealternative = atleastonealternative || acc;
                              ^

The code:

bool atleastonealternative = false;
atleastonealternative = atleastonealternative || acc;

Cppcheck complains correctly. The expression is equivalent to

atleastonealternative = acc;

Please have another look.

@victor-gonzalez

Copy link
Copy Markdown
Collaborator Author

Hi @vkucera! All remaining MegaLinter errors/warnings are false positives! I consider the job done! If there are not compilation errors (I hope not, it compiles locally in Ubuntu) I will merge the PR

Hi @victor-gonzalez , thanks for the additional fixes. I don't think that the remaining errors are all false positives though. For example:

EventSelectionFilterAndAnalysis.h:186:29: style: Condition 'atleastonealternative' is always false [knownConditionTrueFalse]
      atleastonealternative = atleastonealternative || acc;
                              ^

The code:

bool atleastonealternative = false;
atleastonealternative = atleastonealternative || acc;

Cppcheck complains correctly. The expression is equivalent to

atleastonealternative = acc;

Please have another look.

If it were the last use of atleastonealternative I will fully agree but clearly it is an overassumption.

@vkucera

vkucera commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Hi @vkucera! All remaining MegaLinter errors/warnings are false positives! I consider the job done! If there are not compilation errors (I hope not, it compiles locally in Ubuntu) I will merge the PR

Hi @victor-gonzalez , thanks for the additional fixes. I don't think that the remaining errors are all false positives though. For example:

EventSelectionFilterAndAnalysis.h:186:29: style: Condition 'atleastonealternative' is always false [knownConditionTrueFalse]
      atleastonealternative = atleastonealternative || acc;
                              ^

The code:

bool atleastonealternative = false;
atleastonealternative = atleastonealternative || acc;

Cppcheck complains correctly. The expression is equivalent to

atleastonealternative = acc;

Please have another look.

If it were the last use of atleastonealternative I will fully agree but clearly it is an overassumption.

Why? It seems to be a true positive regardless of the surrounding code. Can you please elaborate?

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

Development

Successfully merging this pull request may close these issues.

3 participants