Skip to content

Conversation

@jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Apr 25, 2025

Pull request overview

Pull Request Author

  • Utilities API Changes / Additions
  • All new and existing tests passes

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • 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

jmarrec added 3 commits April 25, 2025 16:34
```
/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:517: Failure
Expected equality of these values:
  numFiles + addedFiles
    Which is: 13
  files.size()
    Which is: 14

/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:587: Failure
Value of: std::equal(newXMLPaths.begin(), newXMLPaths.end(), expectedAfterNewFilesAbsolutePaths.begin(), expectedAfterNewFilesAbsolutePaths.end())
  Actual: false
Expected: true

/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:598: Failure
Value of: paths.empty()
  Actual: false
Expected: true
There are 1 extra files in the XML:
* docs/.hidden_folder/subfolder/file.txt


/media/DataExt4/Software/Others/OpenStudio2/src/utilities/bcl/test/BCLMeasure_GTest.cpp:703: Failure
Value of: std::equal(xmlFilePaths.begin(), xmlFilePaths.end(), expectedAfterNewFilesAbsolutePaths.begin(), expectedAfterNewFilesAbsolutePaths.end())
  Actual: false
Expected: true
```
@jmarrec jmarrec added severity - Minor Bug component - Measures Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. component - Python bindings labels Apr 25, 2025
@jmarrec jmarrec self-assigned this Apr 25, 2025
Comment on lines +1018 to +1033
for (auto it = openstudio::filesystem::recursive_directory_iterator(approvedSubFolderAbsolutePath);
it != openstudio::filesystem::recursive_directory_iterator(); ++it) {
const auto& absoluteFilePath = it->path();

if (openstudio::filesystem::is_directory(absoluteFilePath)) {
const std::string name = absoluteFilePath.filename().string();
if (!name.empty() && (name[0] == '.' || name == "__pycache__")) {
// Skip this directory and all its children
it.disable_recursion_pending();
}
} else if (openstudio::filesystem::is_regular_file(absoluteFilePath)) {
if (!isApprovedFile(absoluteFilePath, m_directory)) {
continue;
}
const openstudio::path relativeFilePath = openstudio::filesystem::relative(absoluteFilePath, m_directory);
result |= addWithUsageTypeIfNotExisting(relativeFilePath, std::string(usageType));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

use a recursive_directory_iterator and use disable_recursion_pending to skip it and children if it's a hidden folder or named "pycache"

@ci-commercialbuildings
Copy link
Collaborator

ci-commercialbuildings commented Apr 29, 2025

CI Results for d063960:

Copy link
Collaborator

@joseph-robertson joseph-robertson left a comment

Choose a reason for hiding this comment

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

Do we want to generalize this a bit, and begin some sort of list of folder names to exclude? "pycache" would be the first entry in the list.

@jmarrec
Copy link
Collaborator Author

jmarrec commented Apr 30, 2025

Do we want to generalize this a bit, and begin some sort of list of folder names to exclude? "pycache" would be the first entry in the list.

I actually thought the same thing!
I started a constexpr std::array for it. But felt it was premature: now you're introducing a bunch of std::algorithm calls for 1 element, and kinda have to make a helper func or the code becomes harder to read.

If we find another one, then we'll do it

@joseph-robertson joseph-robertson self-requested a review April 30, 2025 13:53
@jmarrec jmarrec merged commit ebb0412 into develop Apr 30, 2025
2 of 6 checks passed
@jmarrec jmarrec deleted the 5401-BCL_Ignore_Python branch April 30, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component - Measures component - Python bindings Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. severity - Minor Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BCL measure update picks up subfolders like resources/__pycache__ or tests/.pytest_cache

5 participants