-
Notifications
You must be signed in to change notification settings - Fork 25
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
Bump cppcheck from 2.3 to 2.9 #570
Conversation
Any idea why the cppcheck build started failing? |
Want some help getting this to pass? |
``` run-clang-tidy -config-file=../OpenStudioApplication/src/.clang-tidy -header-filter='OpenStudioApplication/src.*' -checks=-*,google-explicit-constructor -fix -format -style=file ```
@macumber Only one type of warning left, the
|
468a62b
to
a23fce9
Compare
Can we just make |
In this specific case it's fine. This wasn't perhaps the best of examples, the most common one is "setCategoriesAndFields", which is in the base class OSGridController and all derives classes override it and call it from the ctor. OpenStudioApplication/src/shared_gui_components/OSGridController.hpp Lines 528 to 531 in a2feef7
OpenStudioApplication/src/openstudio_lib/SpacesShadingGridView.cpp Lines 111 to 130 in a2feef7
The clean way would maybe be to have a private setCategoriesAndFieldInternal method that isn't virtual and that's the one both the Ctor and the setCategoriesAndFields would call. But that's an annoying code change |
Ok I see, well IMHO this is an important check so we should probably try to fix these issues. If you want, I can do the remaining changes. |
I guess setCategoriesAndFields isn't a virtual method per se actually.
|
```python from pathlib import Path import re ROOT_DIR = Path('.').resolve().parent cpp_files = list(Path(ROOT_DIR / 'src').glob('**/*.cpp')) for cpp_file in cpp_files: replacement_done = False with open(cpp_file, 'r') as f: content = f.read() lines = content.splitlines() new_lines = [] in_block = False for i, line in enumerate(lines): if 'std::vector<QString> fields;' in line: replacement_done = True in_block = True new_lines.append(' std::vector<QString> fields{') elif not in_block: new_lines.append(line) elif 'fields.push_back' in line: new_lines.append(line.replace('fields.push_back(', '').replace(');', ',')) else: new_lines.append(' };') new_lines.append(line) in_block = False if not replacement_done: continue with open(cpp_file, 'w') as f: f.write("\n".join(new_lines) + '\n') ```
@macumber I cleaned up the rest of the cppcheck warnings... I suppose I could have "unvirtualized" a few more functions, but I was getting pretty annoyed by the end. If you could spot check the last commits and do a quick UI test session that'd be great |
Sounds good, will do! |
There seems to be a crash when going to the schedule tab, I'll get a debug build of your branch going and see if I can find it. I can look later but here is the call stack for the crash. To reproduce, load the example model and then go to the schedules tab.
|
src/openstudio_lib/SchedulesView.cpp
Outdated
@@ -613,14 +610,15 @@ ScheduleTab::ScheduleTab(const model::ScheduleRuleset& schedule, SchedulesView* | |||
: QWidget(parent), | |||
//m_mouseDown(false), | |||
m_selected(false), | |||
m_header(new ScheduleTabHeader(this)), |
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.
@jmarrec there is an issue here because ScheduleTabHeader::ScheduleTabHeader
tries to call SchedulesView::schedule
before m_schedule
is set. I fixed that but hit another error. I think some of these changes to move construction from ctor body to initializer list might not be ok in this file at least.
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 was just running the same inside LLDB right now, came up to the same conclusion about the order of members being initialized, and the fact that the ScheduleTabHeader ctor takes this
No description provided.