Skip to content

Commit

Permalink
ENH: Excessive Warning Cleanup (#1194)
Browse files Browse the repository at this point in the history
* Clean up top 3 most excessive warnings
* Repair broken test case
* Convert frequent warnings to preflight updated values
  • Loading branch information
nyoungbq authored Feb 19, 2025
1 parent c0067c7 commit f9ebabf
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,6 @@ IFilter::PreflightResult ArrayCalculatorFilter::preflightImpl(const DataStructur
if(const auto* attributeMatrix = dataStructure.getDataAs<AttributeMatrix>(outputGroupPath); attributeMatrix != nullptr)
{
calculatedTupleShape = attributeMatrix->getShape();
resultOutputActions.warnings().push_back(Warning{static_cast<int>(CalculatorItem::WarningCode::NumericValueWarning),
"The result of the chosen expression will be a numeric value. This numeric value will be used to initialize an "
"array with the number of tuples equal to the number of tuples in the destination group."});
}
else
{
resultOutputActions.warnings().push_back(
Warning{static_cast<int>(CalculatorItem::WarningCode::NumericValueWarning),
"The result of the chosen expression will be a numeric value or contain one tuple. This numeric value will be stored in an array with the number of tuples equal to 1"});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ IFilter::PreflightResult CropEdgeGeometryFilter::preflightImpl(const DataStructu
{
// Detected at least one vertex array, throw a warning
resultOutputActions.warnings().push_back(
{-100, "A vertex data array was detected in the selected edge geometry. This filter currently only interpolates vertex positions, associated vertex data values will not be interpolated."});
{-100, "A vertex data array was detected in the selected edge geometry. This filter currently only interpolates vertex positions, associated vertex data values will not be interpolated."});
}

for(const auto& [identifier, object] : selectedVertexData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,11 @@ IFilter::PreflightResult CropImageGeometryFilter::preflightImpl(const DataStruct
}
if(!warningMsg.empty())
{
resultOutputActions.m_Warnings.push_back(Warning(
{-55503,
preflightUpdatedValues.push_back(
{"Invalidated NeighborLists",
fmt::format(
"This filter will modify the Cell Level Array '{}' which causes all Feature level NeighborLists to become invalid. These NeighborLists will not be copied to the new geometry:{}",
featureIdsArrayPath.toString(), warningMsg)}));
"This filter will modify the Cell Level Array(s) '{}' which causes all feature level NeighborLists to become invalid. These NeighborLists will not be copied to the new geometry:{}",
featureIdsArrayPath.toString(), warningMsg)});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ IFilter::PreflightResult ResampleImageGeomFilter::preflightImpl(const DataStruct
}
if(!warningMsg.empty())
{
resultOutputActions.m_Warnings.push_back(Warning(
{-55503,
preflightUpdatedValues.push_back(
{"Invalidated NeighborLists",
fmt::format(
"This filter will modify the Cell Level Array '{}' which causes all Feature level NeighborLists to become invalid. These NeighborLists will not be copied to the new geometry:{}",
featureIdsArrayPath.toString(), warningMsg)}));
featureIdsArrayPath.toString(), warningMsg)});
}
}

Expand Down
152 changes: 73 additions & 79 deletions src/Plugins/SimplnxCore/test/ArrayCalculatorTest.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/simplnx/Parameters/FileSystemPathParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ Result<> ValidateOutputFile(const FileSystemPathParameter::ValueType& path)
{
return result;
}
if(!fs::exists(path))
if(fs::exists(path))
{
return MakeWarningVoidResult(-6, fmt::format("File System Path '{}' does not exist. It will be created during execution.", path.string()));
return MakeWarningVoidResult(-6, fmt::format("File System Path '{}' already exists. It will be OVERWRITTEN during execution.", path.string()));
}
} catch(const fs::filesystem_error& exception)
{
Expand All @@ -104,7 +104,7 @@ Result<> ValidateOutputDir(const FileSystemPathParameter::ValueType& path)
}
if(!fs::exists(path))
{
return MakeWarningVoidResult(-7, fmt::format("File System Path '{}' does not exist. It will be created during execution.", path.string()));
return MakeWarningVoidResult(-17, fmt::format("File System Directory Path '{}' does not exist. It will be created during execution.", path.string()));
}
} catch(const fs::filesystem_error& exception)
{
Expand Down
2 changes: 1 addition & 1 deletion src/simplnx/Utilities/FilterUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ IFilter::PreflightResult NeighborListRemovalPreflightCode(const DataStructure& d

// Throw a warning to inform the user that the neighbor list arrays could be deleted by this filter
std::string ss =
fmt::format("This filter WILL remove all arrays of type NeighborList from the feature Attribute Matrix '{}'. These arrays are:\n", featureIdsPath.toString(), featureGroupDataPath.toString());
fmt::format("This filter will REMOVE all arrays of type NeighborList from the feature Attribute Matrix '{}'. These arrays are:\n", featureIdsPath.toString(), featureGroupDataPath.toString());

auto result = nx::core::GetAllChildDataPaths(dataStructure, featureGroupDataPath, DataObject::Type::NeighborList);
if(!result.has_value())
Expand Down

0 comments on commit f9ebabf

Please sign in to comment.