Update clang-tidy.yml

* Make sure clang-tidy action use .clang-tidy config file
Use add-paths to instruct create-pull-request to a sub folder to avoid diff from Qt and vcpkg

* Use empty() in macro to avoid clang-tidy warning
* Add NOLINT to CAF_ASSERT
* Add NOLINT to cvfAssert
This commit is contained in:
Magne Sjaastad
2023-10-03 09:04:08 +02:00
committed by GitHub
parent 8df4dd42eb
commit 21843820e6
51 changed files with 119 additions and 202 deletions

View File

@@ -80,7 +80,7 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::generateSurface( bool only
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createMeshDrawable()
{
if ( !( m_vertices.notNull() && m_vertices->size() != 0 ) ) return nullptr;
if ( !m_vertices.notNull() || m_vertices->size() == 0 ) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray( m_vertices.p() );
@@ -99,7 +99,7 @@ cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createMeshDrawable()
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivFaultGeometryGenerator::createOutlineMeshDrawable( double creaseAngle )
{
if ( !( m_vertices.notNull() && m_vertices->size() != 0 ) ) return nullptr;
if ( !m_vertices.notNull() || m_vertices->size() == 0 ) return nullptr;
cvf::OutlineEdgeExtractor ee( creaseAngle, *m_vertices );

View File

@@ -57,14 +57,7 @@ RivBoxIntersectionGeometryGenerator::~RivBoxIntersectionGeometryGenerator()
//--------------------------------------------------------------------------------------------------
bool RivBoxIntersectionGeometryGenerator::isAnyGeometryPresent() const
{
if ( m_triangleVxes->size() == 0 )
{
return false;
}
else
{
return true;
}
return m_triangleVxes->size() != 0;
}
//--------------------------------------------------------------------------------------------------
@@ -89,7 +82,7 @@ cvf::ref<cvf::DrawableGeo> RivBoxIntersectionGeometryGenerator::generateSurface(
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivBoxIntersectionGeometryGenerator::createMeshDrawable()
{
if ( !( m_cellBorderLineVxes.notNull() && m_cellBorderLineVxes->size() != 0 ) ) return nullptr;
if ( !m_cellBorderLineVxes.notNull() || m_cellBorderLineVxes->size() == 0 ) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray( m_cellBorderLineVxes.p() );

View File

@@ -68,7 +68,7 @@ bool RivEclipseIntersectionGrid::useCell( size_t cellIndex ) const
{
const RigCell& cell = m_mainGrid->globalCellArray()[cellIndex];
if ( m_showInactiveCells )
return !( cell.isInvalid() || ( cell.subGrid() != nullptr ) );
return !cell.isInvalid() && ( cell.subGrid() == nullptr );
else
return m_activeCellInfo->isActive( cellIndex ) && ( cell.subGrid() == nullptr );
}

View File

@@ -637,7 +637,7 @@ cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::genera
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::createMeshDrawable()
{
if ( !( m_cellBorderLineVxes.notNull() && m_cellBorderLineVxes->size() != 0 ) ) return nullptr;
if ( !m_cellBorderLineVxes.notNull() || m_cellBorderLineVxes->size() == 0 ) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray( m_cellBorderLineVxes.p() );
@@ -654,7 +654,7 @@ cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::create
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivExtrudedCurveIntersectionGeometryGenerator::createFaultMeshDrawable()
{
if ( !( m_faultCellBorderLineVxes.notNull() && m_faultCellBorderLineVxes->size() != 0 ) ) return nullptr;
if ( !m_faultCellBorderLineVxes.notNull() || m_faultCellBorderLineVxes->size() == 0 ) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray( m_faultCellBorderLineVxes.p() );
@@ -841,12 +841,7 @@ cvf::Mat4d RivExtrudedCurveIntersectionGeometryGenerator::unflattenTransformMatr
//--------------------------------------------------------------------------------------------------
bool RivExtrudedCurveIntersectionGeometryGenerator::isAnyGeometryPresent() const
{
if ( m_triangleVxes->size() == 0 )
{
return false;
}
return true;
return m_triangleVxes->size() != 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -110,7 +110,7 @@ void RivFemIntersectionGrid::cellCornerIndices( size_t globalCellIndex, size_t c
auto [part, elementIdx] = m_femParts->partAndElementIndex( globalCellIndex );
RigElementType elmType = part->elementType( elementIdx );
if ( !( elmType == HEX8 || elmType == HEX8P ) ) return;
if ( elmType != HEX8 && elmType != HEX8P ) return;
int elmIdx = static_cast<int>( elementIdx );
const int partId = part->elementPartId();

View File

@@ -273,9 +273,7 @@ bool Riv3dWellLogCurveGeometryGenerator::findClosestPointOnCurve( const cvf::Vec
}
}
if ( closestPoint->isUndefined() ) return false;
return true;
return !closestPoint->isUndefined();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -51,7 +51,7 @@ cvf::ref<cvf::Part> RivBoxGeometryGenerator::createBoxFromVertices( const std::v
cvf::ref<cvf::Vec3fArray> cvfVertices = new cvf::Vec3fArray;
cvfVertices->assign( boxVertices );
if ( !( cvfVertices.notNull() && cvfVertices->size() != 0 ) ) return nullptr;
if ( !cvfVertices.notNull() || cvfVertices->size() == 0 ) return nullptr;
geo->setVertexArray( cvfVertices.p() );

View File

@@ -275,7 +275,6 @@ void CellEdgeEffectGenerator::updateForShaderBasedRendering( cvf::Effect* effect
// Polygon offset
if ( true )
{
cvf::ref<cvf::RenderStatePolygonOffset> polyOffset = new cvf::RenderStatePolygonOffset;
polyOffset->configurePolygonPositiveOffset();

View File

@@ -78,7 +78,7 @@ void RivContourMapProjectionPartMgr::appendPickPointVisToModel( cvf::ModelBasicL
{
caf::MeshEffectGenerator meshEffectGen( cvf::Color3::MAGENTA );
meshEffectGen.setLineWidth( 1.0f );
meshEffectGen.createAndConfigurePolygonOffsetRenderState( caf::PO_2 );
caf::MeshEffectGenerator::createAndConfigurePolygonOffsetRenderState( caf::PO_2 );
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();
cvf::ref<cvf::Part> part = new cvf::Part;
@@ -153,7 +153,7 @@ void RivContourMapProjectionPartMgr::appendContourLinesToModel( const cvf::Camer
{
caf::MeshEffectGenerator meshEffectGen( lineColor );
meshEffectGen.setLineWidth( 1.0f );
meshEffectGen.createAndConfigurePolygonOffsetRenderState( caf::PO_1 );
caf::MeshEffectGenerator::createAndConfigurePolygonOffsetRenderState( caf::PO_1 );
cvf::ref<cvf::Effect> effect = meshEffectGen.generateCachedEffect();

View File

@@ -465,7 +465,7 @@ void RivTensorResultPartMgr::createResultColorTextureCoords( cvf::Vec2fArray*
//--------------------------------------------------------------------------------------------------
bool RivTensorResultPartMgr::isTensorAddress( RigFemResultAddress address )
{
if ( !( address.resultPosType == RIG_ELEMENT_NODAL || address.resultPosType == RIG_INTEGRATION_POINT ) )
if ( address.resultPosType != RIG_ELEMENT_NODAL && address.resultPosType != RIG_INTEGRATION_POINT )
{
return false;
}
@@ -509,12 +509,7 @@ bool RivTensorResultPartMgr::isValid( cvf::Vec3f resultVector )
//--------------------------------------------------------------------------------------------------
bool RivTensorResultPartMgr::isPressure( float principalValue )
{
if ( principalValue >= 0 )
{
return true;
}
return false;
return principalValue >= 0;
}
//--------------------------------------------------------------------------------------------------

View File

@@ -157,10 +157,8 @@ bool RivTextAnnotationPartMgr::isTextInBoundingBox( const cvf::BoundingBox& boun
if ( !coll ) return false;
auto effectiveBoundingBox = RiaBoundingBoxTools::inflate( boundingBox, 3 );
if ( effectiveBoundingBox.contains( getAnchorPointInDomain( coll->snapAnnotations(), coll->annotationPlaneZ() ) ) ||
effectiveBoundingBox.contains( getLabelPointInDomain( coll->snapAnnotations(), coll->annotationPlaneZ() ) ) )
return true;
return false;
return effectiveBoundingBox.contains( getAnchorPointInDomain( coll->snapAnnotations(), coll->annotationPlaneZ() ) ) ||
effectiveBoundingBox.contains( getLabelPointInDomain( coll->snapAnnotations(), coll->annotationPlaneZ() ) );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -63,12 +63,7 @@ RivTextureCoordsCreator::RivTextureCoordsCreator( RimEclipseCellColors*
//--------------------------------------------------------------------------------------------------
bool RivTextureCoordsCreator::isValid()
{
if ( m_quadMapper.isNull() || m_resultAccessor.isNull() || m_texMapper.isNull() )
{
return false;
}
return true;
return !( m_quadMapper.isNull() || m_resultAccessor.isNull() || m_texMapper.isNull() );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -152,7 +152,7 @@ bool RivWellPathPartMgr::isWellPathEnabled( const cvf::BoundingBox& wellPathClip
if ( wellPathCollection->wellPathVisibility() == RimWellPathCollection::FORCE_ALL_OFF ) return false;
if ( wellPathCollection->wellPathVisibility() == RimWellPathCollection::ALL_ON && m_rimWellPath->showWellPath() == false ) return false;
if ( wellPathCollection->wellPathVisibility() == RimWellPathCollection::ALL_ON && !m_rimWellPath->showWellPath() ) return false;
if ( !isWellPathWithinBoundingBox( wellPathClipBoundingBox ) ) return false;
@@ -236,7 +236,10 @@ void RivWellPathPartMgr::appendWellPathAttributesToModel( cvf::ModelBasicList*
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo( attribute );
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth( &parts, displayCoords, radii, attribute->defaultComponentColor() );
RivPipeGeometryGenerator::tubeWithCenterLinePartsAndVariableWidth( &parts,
displayCoords,
radii,
attribute->defaultComponentColor() );
for ( auto part : parts )
{
part->setSourceInfo( objectSourceInfo.p() );
@@ -268,7 +271,10 @@ void RivWellPathPartMgr::appendWellPathAttributesToModel( cvf::ModelBasicList*
cvf::ref<RivObjectSourceInfo> objectSourceInfo = new RivObjectSourceInfo( attribute );
cvf::Collection<cvf::Part> parts;
geoGenerator.tubeWithCenterLinePartsAndVariableWidth( &parts, displayCoords, radii, attribute->defaultComponentColor() );
RivPipeGeometryGenerator::tubeWithCenterLinePartsAndVariableWidth( &parts,
displayCoords,
radii,
attribute->defaultComponentColor() );
for ( auto part : parts )
{
part->setSourceInfo( objectSourceInfo.p() );
@@ -352,7 +358,7 @@ void RivWellPathPartMgr::appendWellMeasurementsToModel( cvf::ModelBasicList*
// Use the view legend config to find color, if only one type of measurement is selected.
cvf::Color3f color = cvf::Color3f( wellMeasurementInView->legendConfig()->scalarMapper()->mapToColor( wellMeasurement->value() ) );
geoGenerator.tubeWithCenterLinePartsAndVariableWidth( &parts, displayCoords, radii, color );
RivPipeGeometryGenerator::tubeWithCenterLinePartsAndVariableWidth( &parts, displayCoords, radii, color );
for ( auto part : parts )
{
part->setSourceInfo( objectSourceInfo.p() );

View File

@@ -312,7 +312,7 @@ cvf::ref<cvf::DrawableGeo> RivSurfaceIntersectionGeometryGenerator::generateSurf
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivSurfaceIntersectionGeometryGenerator::createMeshDrawable()
{
if ( !( m_cellBorderLineVxes.notNull() && m_cellBorderLineVxes->size() != 0 ) ) return nullptr;
if ( !m_cellBorderLineVxes.notNull() || m_cellBorderLineVxes->size() == 0 ) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray( m_cellBorderLineVxes.p() );
@@ -329,7 +329,7 @@ cvf::ref<cvf::DrawableGeo> RivSurfaceIntersectionGeometryGenerator::createMeshDr
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo> RivSurfaceIntersectionGeometryGenerator::createFaultMeshDrawable()
{
if ( !( m_faultCellBorderLineVxes.notNull() && m_faultCellBorderLineVxes->size() != 0 ) ) return nullptr;
if ( !m_faultCellBorderLineVxes.notNull() || m_faultCellBorderLineVxes->size() == 0 ) return nullptr;
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
geo->setVertexArray( m_faultCellBorderLineVxes.p() );
@@ -389,10 +389,5 @@ RimSurfaceInView* RivSurfaceIntersectionGeometryGenerator::intersection() const
//--------------------------------------------------------------------------------------------------
bool RivSurfaceIntersectionGeometryGenerator::isAnyGeometryPresent() const
{
if ( m_triangleVxes->size() == 0 )
{
return false;
}
return true;
return m_triangleVxes->size() != 0;
}