-
Notifications
You must be signed in to change notification settings - Fork 127
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
Bravo team cppcheck set 41 #38731
Bravo team cppcheck set 41 #38731
Conversation
👋 Hi, @sf1919, Conflicts have been detected against the base branch. Please rebase your branch against the base branch. |
eac1345
to
fd1d33e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. All the changes look good. I just noticed that the issue on line 473 in {CMAKE_SOURCE_DIR}/Framework/Geometry/src/Objects/CSGObject.cpp wasn’t covered in this pull request, though it was mentioned in the PR description. I was wondering if we should update the description to reflect this?
Thanks @yusufjimoh I will update the description. That failure was fixed in a previous set (see #38715) which is part of the reason I picked up this set to avoid confusion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I think that within a file we should stick to the existing convention in that file for either east or west const
, so we don't have a mix. I put a suggestion for one or two, but would you mind checking them all please? Also I think we can remove one of the inline suppressions.
@@ -189,7 +189,7 @@ class MANTID_GEOMETRY_DLL InstrumentDefinitionParser { | |||
/// elements with \<cuboid\>'s | |||
/// (note for now this will only work for \<cuboid\>'s and when necessary this | |||
/// can be extended). | |||
void adjust(Poco::XML::Element *pElem, std::map<std::string, bool> &isTypeAssembly, | |||
void adjust(Poco::XML::Element *pElem, std::map<std::string, bool> const &isTypeAssembly, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind keeping to west-const
for consistency within the file please? On line 71 you've got const std::string
but here you've got std::map const
. It doesn't make any difference to the compiler but I think it's good to keep it consistent with a file. Line 254 also east instead of west.
@@ -76,7 +76,7 @@ class MANTID_GEOMETRY_DLL XMLInstrumentParameter { | |||
|
|||
/// Returns parameter value as generated using possibly equation expression | |||
/// etc | |||
double createParamValue(Mantid::Kernel::TimeSeriesProperty<double> *logData, const Kernel::TimeROI *) const; | |||
double createParamValue(Mantid::Kernel::TimeSeriesProperty<double> const *logData, const Kernel::TimeROI *) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double createParamValue(Mantid::Kernel::TimeSeriesProperty<double> const *logData, const Kernel::TimeROI *) const; | |
double createParamValue(const Mantid::Kernel::TimeSeriesProperty<double> *logData, const Kernel::TimeROI *) const; |
// cppcheck-suppress stlIfStrFind as string::starts_with(), cppcheck's suggested change, does not allow for position | ||
// 0 to be anywhere | ||
else if (m_extractSingleValueAs.find("position") == 0 && m_extractSingleValueAs.size() >= 10) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the original code is checking that m_extractSingleValueAs
has the string "position"
starting at index 0, so starts_with
should be okay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was failing a number of tests when I used starts_with instead so I don't think it is necessarily the way it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes, spotted a couple more things, sorry.
Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
Outdated
Show resolved
Hide resolved
Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
Outdated
Show resolved
Hide resolved
👋 Hi, @sf1919, Conflicts have been detected against the base branch. Please rebase your branch against the base branch. |
- fix knownConditionTrueFalse and invalidContainer suppressions
- Fix erros in fixing Acomp and CSGObjects from previous commits - Fix constParameterReference and constVariablePointer instances in InstrumentDefinitionParser - Remove the shape code from the Structured Detector in InstrumentDefinitionParser. The shape is defined within StructuredDetector.cpp instead (probably a copy/paste error)
- fixed constParameterPointer and stlIfStrFind
- cppcheck suggests using string::starts_with(). However this breaks functionality because position 0 can be anywhere. Although inefficient the find is necessary as it is.
881dc35
to
326ff87
Compare
Co-authored-by: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com>
Co-authored-by: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com>
Co-authored-by: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those changes 👍
* Fixing knownConditionTrueFalse suppressions in CSGObject * Fix constVariablePointer suppression in ObjCompAssembly * Fix cppcheck suppressions in Acomp - fix knownConditionTrueFalse and invalidContainer suppressions * Fix cppcheck suppressions - Fix erros in fixing Acomp and CSGObjects from previous commits - Fix constParameterReference and constVariablePointer instances in InstrumentDefinitionParser - Remove the shape code from the Structured Detector in InstrumentDefinitionParser. The shape is defined within StructuredDetector.cpp instead (probably a copy/paste error) * Fix cppcheck suppressions in XMLInstrumentParameter - fixed constParameterPointer and stlIfStrFind * Fix oustanding constVariablePointer * Use inline suppression for stlIfStrFind - cppcheck suggests using string::starts_with(). However this breaks functionality because position 0 can be anywhere. Although inefficient the find is necessary as it is. * Use west const more consistently * Change the call to find to starts_with to improve searching * Update Framework/Geometry/src/Instrument/XMLInstrumentParameter.cpp Co-authored-by: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com> * Update Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp Co-authored-by: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com> * Update Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp Co-authored-by: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com> --------- Co-authored-by: James Clarke <139879523+jclarkeSTFC@users.noreply.github.com>
Description of work
Please note that the FitParameter.cpp fix is in a separate PR (#38745 )
Summary of work
Purpose of work
There is no associated issue.
Further detail of work
To test:
Reviewer
Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.Gatekeeper
If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.