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

CppCheck WindowManager #10836

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open

CppCheck WindowManager #10836

wants to merge 23 commits into from

Conversation

rraustad
Copy link
Contributor

Pull request overview

  • Fixes CppCheck style
  • Use CppCheck as guide

NOTE: ENHANCEMENTS MUST FOLLOW A SUBMISSION PROCESS INCLUDING A FEATURE PROPOSAL AND DESIGN DOCUMENT PRIOR TO SUBMITTING CODE

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • 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

Reviewer

This will not be exhaustively relevant to every PR.

  • 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

@rraustad rraustad added the DoNotPublish Includes changes that shouldn't be reported in the changelog label Nov 27, 2024
BranchInputManager::GetBranchFanTypeName(state, BranchNum, FanType, FanName, ErrFound);
if (!ErrFound) {
BranchFanFlow = state.dataFans->fans(this->m_FanIndex)->maxAirFlowRate;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/UnitarySystem.cc:2986]:(style),[variableScope],The scope of the variable 'FanType' can be reduced.
[src/EnergyPlus/UnitarySystem.cc:2987]:(style),[variableScope],The scope of the variable 'm_FanName' can be reduced.

if (this->m_DesignSpecMSHPIndex == -1) {
std::string MultispeedType = "Fan:SystemModel";
}
std::string MultispeedType = (this->m_DesignSpecMSHPIndex == -1) ? "Fan:SystemModel" : "UnitarySystemPerformance:Multispeed";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/UnitarySystem.cc:6667]:(style),[variableScope],The scope of the variable 'MultispeedType' can be reduced.
[src/EnergyPlus/UnitarySystem.cc:6669]:(style),[shadowVariable],Local variable 'MultispeedType' shadows outer variable
[src/EnergyPlus/UnitarySystem.cc:6669]:(style),[unreadVariable],Variable 'MultispeedType' is assigned a value that is never used.

if (this->m_DesignSpecMSHPIndex == -1) {
std::string MultispeedType = "Fan:SystemModel";
}
std::string MultispeedType = (this->m_DesignSpecMSHPIndex == -1) ? "Fan:SystemModel" : "UnitarySystemPerformance:Multispeed";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/UnitarySystem.cc:6621]:(style),[variableScope],The scope of the variable 'MultispeedType' can be reduced.
[src/EnergyPlus/UnitarySystem.cc:6623]:(style),[shadowVariable],Local variable 'MultispeedType' shadows outer variable
[src/EnergyPlus/UnitarySystem.cc:6623]:(style),[unreadVariable],Variable 'MultispeedType' is assigned a value that is never used.

@@ -114,7 +114,6 @@ namespace UserDefinedComponents {

void UserPlantComponentStruct::onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation)
{
bool anyEMSRan;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/UserDefinedComponents.cc:117]:(style),[variableScope],The scope of the variable 'anyEMSRan' can be reduced.

@@ -489,7 +476,8 @@ void CalcCoPlanarNess(Array1D<Vector> &Surf, int const NSides, bool &IsCoPlanar,
if (std::abs(MaxDist) > Constant::SmallDistance) IsCoPlanar = false;
}

std::vector<int> PointsInPlane(Array1D<Vector> &BaseSurf, int const BaseSides, Array1D<Vector> &QuerySurf, int const QuerySides, bool &ErrorFound)
std::vector<int>
PointsInPlane(Array1D<Vector> &BaseSurf, int const BaseSides, Array1D<Vector> const &QuerySurf, int const QuerySides, bool &ErrorFound)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/Vectors.cc:492]:(style),[constParameterReference],Parameter 'QuerySurf' can be declared as reference to const

int Loop; // loop counter
Real64 QToCoolSetPt; // sensible load to cooling setpoint (W)
Real64 NoCompOutput; // sensible load delivered with compressor off (W)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/WindowAC.cc:735]:(style),[variableScope],The scope of the variable 'InNode' can be reduced.
[src/EnergyPlus/WindowAC.cc:736]:(style),[variableScope],The scope of the variable 'OutNode' can be reduced.
[src/EnergyPlus/WindowAC.cc:741]:(style),[variableScope],The scope of the variable 'Loop' can be reduced.

MaxAirVolFlowDes = 0.0;
MaxAirVolFlowUser = 0.0;
OutAirVolFlowDes = 0.0;
OutAirVolFlowUser = 0.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/WindowAC.cc:912]:(style),[variableScope],The scope of the variable 'SizingString' can be reduced.
[src/EnergyPlus/WindowAC.cc:914]:(style),[variableScope],The scope of the variable 'FieldNum' can be reduced.
[src/EnergyPlus/WindowAC.cc:915]:(style),[variableScope],The scope of the variable 'SizingMethod' can be reduced.
[src/EnergyPlus/WindowAC.cc:917]:(style),[variableScope],The scope of the variable 'PrintFlag' can be reduced.
[src/EnergyPlus/WindowAC.cc:918]:(style),[variableScope],The scope of the variable 'zoneHVACIndex' can be reduced.
[src/EnergyPlus/WindowAC.cc:919]:(style),[variableScope],The scope of the variable 'SAFMethod' can be reduced.
[src/EnergyPlus/WindowAC.cc:921]:(style),[variableScope],The scope of the variable 'CapSizingMethod' can be reduced.
[src/EnergyPlus/WindowAC.cc:924]:(style),[unreadVariable],Variable 'IsAutoSize' is assigned a value that is never used.

@@ -1925,7 +1923,7 @@ namespace Window {
return num / denom; // dangerous, doesn't check for zero denominator
}

Real64 visibleSpectrumAverage(EnergyPlusData &state, gsl::span<Real64 const> p)
Real64 visibleSpectrumAverage(EnergyPlusData const &state, gsl::span<Real64 const> p)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/WindowManager.cc:1928]:(style),[constParameterReference],Parameter 'state' can be declared as reference to const

@@ -4534,7 +4515,7 @@ namespace Window {
fcon[i - 1] = wmgas.con.c0 + wmgas.con.c1 * tmean + wmgas.con.c2 * tmean_2;
fvis[i - 1] = wmgas.vis.c0 + wmgas.vis.c1 * tmean + wmgas.vis.c2 * tmean_2;
fcp[i - 1] = wmgas.cp.c0 + wmgas.cp.c1 * tmean + wmgas.cp.c2 * tmean_2;
fdens[i - 1] = pres * wmgas.wght / (gaslaw * tmean);
// fdens[i - 1] = pres * wmgas.wght / (gaslaw * tmean);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/WindowManager.cc:4537]:(style),[unreadVariable],Variable 'fdens[i-1]' is assigned a value that is never used.

@@ -4591,7 +4572,7 @@ namespace Window {

//******************************************************************************

void WindowGasPropertiesAtTemp(EnergyPlusData &state,
void WindowGasPropertiesAtTemp(EnergyPlusData const &state,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[src/EnergyPlus/WindowManager.cc:4594]:(style),[constParameterReference],Parameter 'state' can be declared as reference to const

Copy link

⚠️ Regressions detected on macos-14 for commit 8e57e24

Regression Summary
  • EIO: 7
  • ESO Big Diffs: 3
  • Table Big Diffs: 7
  • ERR: 1
  • ESO Small Diffs: 1
  • MTR Small Diffs: 1
  • SSZ Small Diffs: 1
  • ZSZ Small Diffs: 1
  • Table String Diffs: 1

@rraustad
Copy link
Contributor Author

@Myoldmopar can you confirm the RelWithDebugInfo failure? The RelWithDebugInfo build runs on Windows.

@rraustad rraustad changed the title Cpp check window manager2 CppCheck WindowManager Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DoNotPublish Includes changes that shouldn't be reported in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants