Skip to content

Cleanout UtilityRoutines#11438

Open
mitchute wants to merge 5 commits intodevelopfrom
cleanout-utility-routines
Open

Cleanout UtilityRoutines#11438
mitchute wants to merge 5 commits intodevelopfrom
cleanout-utility-routines

Conversation

@mitchute
Copy link
Collaborator

Pull request overview

Reviewing PR #11411 prompted me to look at UtilityRoutines, where it appears we have a number of obsolete functions. This PR cleans these out in lieu of better approaches.

  • FindItemInSortedList was used in one place, and we have a number of other ways that are used more commonly to do this.
  • VerifyName was used in five places to verify object names are not duplicated or blank. I believe this is all now enforced through the IDD/epJSON schema validation methods, so I suspect this separate step is unnecessary and can be removed.
  • IsNameEmpty was used in about 110 places; however, like VerifyName I think nearly all of this is handled already by the epJSON schema, and whatever is left can be handled by the .empty() string method.

Description of the purpose of this PR

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 changed the title Cleanout utility routines Cleanout UtilityRoutines Feb 26, 2026
@mitchute mitchute added the Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring label Feb 26, 2026
@mitchute mitchute self-assigned this Feb 26, 2026
if (Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), state.dataHeatBalMgr->CurrentModuleObject, ErrorsFound)) {
if (state.dataIPShortCut->cAlphaArgs(1).empty()) {
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need this check because:

Zone,
  A1 , \field Name
       \required-field

This test:

Zone,
  ,                !- Name
  0,                       !- Direction of Relative North {deg}

gives this error from the InputProcessor:

** Severe  ** <root>[Zone] - Object name is required and cannot be blank or whitespace

if (Util::IsNameEmpty(state, cAlphas(1), CurrentModuleObject, localErrorsFound)) {
if (cAlphas(1).empty()) {
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

NodeList,
  A1 , \field Name
       \required-field

if (Util::IsNameEmpty(state, s_ipsc->cAlphaArgs(1), s_ipsc->cCurrentModuleObject, ErrorsFound)) {
if (s_ipsc->cAlphaArgs(1).empty()) {
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one should be required (because it is checked as such) but it's not so this is OK. I suspect all object names should be required-field but there may be exceptions. i.e., be careful which one of these checks get deleted. I always check the idd when adding/removing input checks.

PhotovoltaicPerformance:Simple,
   A1 , \field Name
        \reference PVModules

Copy link
Collaborator

Choose a reason for hiding this comment

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

The next 2 are OK as-is (Name is not a required field).

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

Labels

Refactoring Includes code changes that don't change the functionality of the program, just perform refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants