Skip to content

Conversation

@mitchute
Copy link
Collaborator

@mitchute mitchute commented Nov 4, 2025

Pull request overview

CppCheck has a flagged number of warnings, as well as some style and performance recommendations. In addition, several files are being ignored. This is expected to be a pass at moving these towards a better place.

Pull Request Author

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies
  • If adding/removing any output files (e.g., eplustbl.*)
    • Update ..\scripts\Epl-run.bat
    • Update ..\scripts\RunEPlus.bat
    • Update ..\src\EPLaunch\ MainModule.bas, epl-ui.frm, and epl.vbp (VersionComments)
    • Update ...github\workflows\energyplus.py

Reviewer

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@mitchute mitchute added the Defect Includes code to repair a defect in EnergyPlus label Nov 4, 2025
Copy link
Contributor

@rraustad rraustad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CppCheck is running pretty fast so including these doesn't seem to hurt GHA run time.

@mitchute
Copy link
Collaborator Author

mitchute commented Nov 4, 2025

@rraustad yeah, I don't think it was the speed, but that it was just that those files were throwing some errors that they didn't have time to deal with.

@github-actions
Copy link

github-actions bot commented Nov 5, 2025

⚠️ Regressions detected on macos-14 for commit eae6352

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

github-actions bot commented Nov 5, 2025

⚠️ Regressions detected on ubuntu-24.04 for commit eae6352

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit 76cb589

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 76cb589

Regression Summary
  • ESO Small Diffs: 4


// Check the number of primary air loops
if (!simulation_control.DuctLoss) {
int NumAPL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think this should be initialized to 0 here since distribution_simulated could be false? and NumAPL is used at line 2224.

int BaseboardNum = 0;
for (int ConvElecBBNum = 1; ConvElecBBNum <= NumConvElecBaseboards; ++ConvElecBBNum) {

auto &s_ipsc = state.dataIPShortCut;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be done outside the for loop? after line 190?

for (nLayer = 1; nLayer <= Construction::MaxLayersInConstruct; ++nLayer) {
state.dataConstruction->Construct(state.dataHeatBal->TotConstructs).LayerPoint(nLayer) = state.dataConstruction->LayerPoint(nLayer);
if (state.dataConstruction->LayerPoint(nLayer) != 0) {
auto &s_mat = state.dataMaterial;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, do this just above line 863?


auto &thisDemandMgrList = state.dataDemandManager->DemandManagerList(ListNum);

auto &s_ipsc = state.dataIPShortCut;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, outside for loop.

for (int DuctLossNum = 1; DuctLossNum <= state.dataDuctLoss->NumOfDuctLosses; DuctLossNum++) {
auto &thisDuctLoss(state.dataDuctLoss->ductloss(DuctLossNum));

std::string CurrentModuleObject;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outside for loop.

if (this->NumCompressors > 1) {
UpperStageCompressorRatio = (1.0 - this->CompressorSizeRatio) / (this->NumCompressors - 1);
int Stage; // used for crankcase heater power calculation
for (Stage = 1; Stage <= this->NumCompressors - 2; ++Stage) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? could you reduce scope by 1 more line?

// Loop over all outside air inlet nodes in the input and count them
CurrentModuleObject = "OutdoorAir:NodeList";
int OutAirInletNodeListNum; // OUTSIDE AIR INLET NODE LIST index
for (OutAirInletNodeListNum = 1; OutAirInletNodeListNum <= NumOutAirInletNodeLists; ++OutAirInletNodeListNum) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several of these here and below, for (int xxx

bool errorsFound = false;
std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;
for (auto const &classToInput : classesToInput) {
std::string &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;
Copy link
Contributor

@rraustad rraustad Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why CppCheck would want this scope reduced?? and line 3780.

@mitchute mitchute marked this pull request as draft December 1, 2025 16:11
@dareumnam
Copy link
Collaborator

@mitchute @rraustad I started the CppCheck cleanup with the (style), [variableScope] The scope of the variable '****' can be reduced warnings, which suggest reducing the scope of certain variables, but it seems like moving the variable declaration closer to where it is actually used or the smallest relevant loop might not be the best placement. If we prefer to keep the current declarations and ignore these specific variable-scope warnings, I can revert the changes and move on to the next set of CppCheck issues.

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

⚠️ Regressions detected on ubuntu-24.04 for commit ed448b4

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

⚠️ Regressions detected on macos-14 for commit ed448b4

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

⚠️ Regressions detected on ubuntu-24.04 for commit 78433b6

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

⚠️ Regressions detected on ubuntu-24.04 for commit a9730a0

Regression Summary
  • EDD: 3
  • ESO Big Diffs: 3
  • ESO Small Diffs: 4
  • EIO: 1
  • ERR: 1
  • MTR Big Diffs: 1
  • Table Big Diffs: 1
  • Table String Diffs: 1

@github-actions
Copy link

github-actions bot commented Dec 5, 2025

⚠️ Regressions detected on macos-14 for commit a9730a0

Regression Summary
  • EDD: 2
  • ESO Big Diffs: 3
  • ESO Small Diffs: 4
  • EIO: 1
  • ERR: 1
  • MTR Big Diffs: 1
  • Table Big Diffs: 1
  • Table String Diffs: 1

int CapacityStageNum; // Loop index for 1,Number of capacity stages
for (DehumidModeNum = 0; DehumidModeNum <= thisDXCoil.NumDehumidModes; ++DehumidModeNum) {
int CapacityStageNum; // Loop index for 1,Number of capacity stages
for (CapacityStageNum = 1; CapacityStageNum <= thisDXCoil.NumCapacityStages; ++CapacityStageNum) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete lines 7044 and 7045 and update line 7046 with for (int DehumidModeNum and line 7047 with for (int CapacityStageNum. Same for lines 14665 and 15083 below.

@github-actions
Copy link

github-actions bot commented Dec 7, 2025

⚠️ Regressions detected on macos-14 for commit 3361890

Regression Summary
  • EDD: 2
  • ESO Big Diffs: 3
  • ESO Small Diffs: 4
  • EIO: 1
  • ERR: 1
  • MTR Big Diffs: 1
  • Table Big Diffs: 1
  • Table String Diffs: 1

@github-actions
Copy link

github-actions bot commented Dec 7, 2025

⚠️ Regressions detected on ubuntu-24.04 for commit 3361890

Regression Summary
  • EDD: 3
  • ESO Big Diffs: 3
  • ESO Small Diffs: 4
  • EIO: 1
  • ERR: 1
  • MTR Big Diffs: 1
  • Table Big Diffs: 1
  • Table String Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit e7b191c

Regression Summary
  • EDD: 3
  • ESO Big Diffs: 3
  • ESO Small Diffs: 4
  • EIO: 1
  • ERR: 1
  • MTR Big Diffs: 1
  • Table Big Diffs: 1
  • Table String Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit e7b191c

Regression Summary
  • EDD: 2
  • ESO Big Diffs: 3
  • ESO Small Diffs: 4
  • EIO: 1
  • ERR: 1
  • MTR Big Diffs: 1
  • Table Big Diffs: 1
  • Table String Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 4601006

Regression Summary
  • ESO Small Diffs: 4
  • Audit: 1
  • MDD: 1
  • MTD: 1
  • Table Big Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit 4601006

Regression Summary
  • ESO Small Diffs: 4
  • Audit: 1
  • MDD: 1
  • MTD: 1
  • Table Big Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 40b2776

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit 40b2776

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit f7b8abb

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit f7b8abb

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit e6ea74b

Regression Summary
  • ESO Small Diffs: 4

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit e6ea74b

Regression Summary
  • ESO Small Diffs: 4

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

Labels

Defect Includes code to repair a defect in EnergyPlus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants