Skip to content

Conversation

@plexoos
Copy link
Member

@plexoos plexoos commented Nov 23, 2024

Screenshot 2024-11-23 at 3 00 42 PM

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-format (v18.1.3) reports: 2 file(s) not formatted
  • sysrap/sn.h
  • u4/U4Solid.h

Have any feedback or feature suggestions? Share it here.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Cpp-linter Review

Used clang-format v18.1.3

Only 20 out of 24 clang-format concerns fit within this pull request's diff.

Click here for the full clang-format patch
diff --git a/sysrap/sn.h b/sysrap/sn.h
index 8b74e4a..bcb1b18 100644
--- a/sysrap/sn.h
+++ b/sysrap/sn.h
@@ -453,3 +453,2 @@ struct SYSRAP_API sn
-
-    static sn* Trapezoid(double z, double y, double x, double ltx);
-    static sn* Cone(double r1, double z1, double r2, double z2);
+    static sn *Trapezoid(double z, double y, double x, double ltx);
+    static sn *Cone(double r1, double z1, double r2, double z2);
@@ -3104,2 +3102,0 @@ inline void sn::CutCylinderZRange(
-
-
@@ -3114 +3111 @@ inline void sn::CutCylinderZRange(
-inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
+inline sn *sn::Trapezoid(double z, double y, double x, double ltx)
@@ -3116,2 +3113,2 @@ inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
-    assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x );
-    sn* nd = Create(CSG_TRAPEZOID);
+    assert(x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x);
+    sn *nd = Create(CSG_TRAPEZOID);
@@ -3119 +3116 @@ inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
-    nd->setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z);
+    nd->setBB(-0.5 * x, -0.5 * y, -0.5 * z, +0.5 * x, +0.5 * y, +0.5 * z);
@@ -3123 +3120 @@ inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
-inline sn* sn::Cone(double r1, double z1, double r2, double z2)  // static
+inline sn *sn::Cone(double r1, double z1, double r2, double z2) // static
@@ -5230 +5227 @@ inline void sn::setAABB_LeafFrame()
-    else if( typecode == CSG_TRAPEZOID )
+    else if (typecode == CSG_TRAPEZOID)
@@ -5234 +5231 @@ inline void sn::setAABB_LeafFrame()
-        setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z);
+        setBB(-0.5 * x, -0.5 * y, -0.5 * z, +0.5 * x, +0.5 * y, +0.5 * z);
@@ -5236 +5233 @@ inline void sn::setAABB_LeafFrame()
-    else if( typecode == CSG_DISC )
+    else if (typecode == CSG_DISC)
diff --git a/u4/U4Solid.h b/u4/U4Solid.h
index af4873e..0bddbaf 100644
--- a/u4/U4Solid.h
+++ b/u4/U4Solid.h
@@ -40,3 +39,0 @@ npy/NNodeUncoincide npy/NNodeNudger
-#include "G4Orb.hh"
-#include "G4Sphere.hh"
-#include "G4Ellipsoid.hh"
@@ -44,4 +40,0 @@ npy/NNodeUncoincide npy/NNodeNudger
-#include "G4Tubs.hh"
-#include "G4CutTubs.hh"
-#include "G4Trap.hh"
-#include "G4Polycone.hh"
@@ -48,0 +42,2 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4CutTubs.hh"
+#include "G4Ellipsoid.hh"
@@ -49,0 +45 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4IntersectionSolid.hh"
@@ -50,0 +47,4 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4Orb.hh"
+#include "G4Polycone.hh"
+#include "G4Sphere.hh"
+#include "G4SubtractionSolid.hh"
@@ -51,0 +52,2 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4Trap.hh"
+#include "G4Tubs.hh"
@@ -53,2 +54,0 @@ npy/NNodeUncoincide npy/NNodeNudger
-#include "G4IntersectionSolid.hh"
-#include "G4SubtractionSolid.hh"
@@ -92,2 +92,2 @@ struct U4Solid
-    static constexpr const char* G4Trap_              = "Trp" ;
-    static constexpr const char* G4Polycone_          = "Pol" ;
+    static constexpr const char *G4Trap_ = "Trp";
+    static constexpr const char *G4Polycone_ = "Pol";
@@ -290,2 +290,4 @@ inline int U4Solid::Type(const char* name)   // static
-    if( strcmp(name, "G4Trap") == 0 )              type = _G4Trap ;
-    if( strcmp(name, "G4Polycone") == 0 )          type = _G4Polycone ;
+    if (strcmp(name, "G4Trap") == 0)
+        type = _G4Trap;
+    if (strcmp(name, "G4Polycone") == 0)
+        type = _G4Polycone;
@@ -314,2 +316,6 @@ inline const char* U4Solid::Tag(int type)   // static
-        case _G4Trap:              tag = G4Trap_              ; break ;
-        case _G4Polycone:          tag = G4Polycone_          ; break ;
+        case _G4Trap:
+            tag = G4Trap_;
+            break;
+        case _G4Polycone:
+            tag = G4Polycone_;
+            break;
@@ -412,2 +418,6 @@ inline void U4Solid::init_Constituents()
-        case _G4Trap              : init_Trap()                  ; break ;
-        case _G4Polycone          : init_Polycone()              ; break ;
+        case _G4Trap:
+            init_Trap();
+            break;
+        case _G4Polycone:
+            init_Polycone();
+            break;
@@ -879,3 +888,0 @@ inline void U4Solid::init_CutTubs()
-
-
-
@@ -884 +891 @@ inline void U4Solid::init_Trap()
-    const G4Trap* trap = dynamic_cast<const G4Trap*>(solid);
+    const G4Trap *trap = dynamic_cast<const G4Trap *>(solid);
@@ -887,4 +894,4 @@ inline void U4Solid::init_Trap()
-    double z   = 2*trap->GetZHalfLength()/CLHEP::mm;
-    double y   = 2*trap->GetYHalfLength1()/CLHEP::mm;
-    double x   = 2*trap->GetXHalfLength1()/CLHEP::mm;
-    double ltx = 2*trap->GetXHalfLength2()/CLHEP::mm;
+    double z = 2 * trap->GetZHalfLength() / CLHEP::mm;
+    double y = 2 * trap->GetYHalfLength1() / CLHEP::mm;
+    double x = 2 * trap->GetXHalfLength1() / CLHEP::mm;
+    double ltx = 2 * trap->GetXHalfLength2() / CLHEP::mm;
@@ -895 +901,0 @@ inline void U4Solid::init_Trap()
-

Have any feedback or feature suggestions? Share it here.

Comment on lines +453 to 455

static sn* Trapezoid(double z, double y, double x, double ltx);
static sn* Cone(double r1, double z1, double r2, double z2);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Suggested change
static sn* Trapezoid(double z, double y, double x, double ltx);
static sn* Cone(double r1, double z1, double r2, double z2);
static sn *Trapezoid(double z, double y, double x, double ltx);
static sn *Cone(double r1, double z1, double r2, double z2);

Comment on lines 3104 to 3105


Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Please remove the line(s)

  • 3104
  • 3105

* https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html#constructed-solid-geometry-csg-solids
* https://github.com/Geant4/geant4/blob/master/source/geometry/solids/CSG/include/G4Trap.hh
*/
inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Suggested change
inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
inline sn *sn::Trapezoid(double z, double y, double x, double ltx)

Comment on lines +3116 to +3117
assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x );
sn* nd = Create(CSG_TRAPEZOID);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Suggested change
assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x );
sn* nd = Create(CSG_TRAPEZOID);
assert(x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x);
sn *nd = Create(CSG_TRAPEZOID);

assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x );
sn* nd = Create(CSG_TRAPEZOID);
nd->setPA(x, y, z, 0.f, ltx, 0.f);
nd->setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Suggested change
nd->setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z);
nd->setBB(-0.5 * x, -0.5 * y, -0.5 * z, +0.5 * x, +0.5 * y, +0.5 * z);

Comment on lines +412 to 413
case _G4Trap : init_Trap() ; break ;
case _G4Polycone : init_Polycone() ; break ;
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Suggested change
case _G4Trap : init_Trap() ; break ;
case _G4Polycone : init_Polycone() ; break ;
case _G4Trap:
init_Trap();
break;
case _G4Polycone:
init_Polycone();
break;

Comment on lines 879 to 881



Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Please remove the line(s)

  • 879
  • 880
  • 881


inline void U4Solid::init_Trap()
{
const G4Trap* trap = dynamic_cast<const G4Trap*>(solid);
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Suggested change
const G4Trap* trap = dynamic_cast<const G4Trap*>(solid);
const G4Trap *trap = dynamic_cast<const G4Trap *>(solid);

Comment on lines +887 to +890
double z = 2*trap->GetZHalfLength()/CLHEP::mm;
double y = 2*trap->GetYHalfLength1()/CLHEP::mm;
double x = 2*trap->GetXHalfLength1()/CLHEP::mm;
double ltx = 2*trap->GetXHalfLength2()/CLHEP::mm;
Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Suggested change
double z = 2*trap->GetZHalfLength()/CLHEP::mm;
double y = 2*trap->GetYHalfLength1()/CLHEP::mm;
double x = 2*trap->GetXHalfLength1()/CLHEP::mm;
double ltx = 2*trap->GetXHalfLength2()/CLHEP::mm;
double z = 2 * trap->GetZHalfLength() / CLHEP::mm;
double y = 2 * trap->GetYHalfLength1() / CLHEP::mm;
double x = 2 * trap->GetXHalfLength1() / CLHEP::mm;
double ltx = 2 * trap->GetXHalfLength2() / CLHEP::mm;

root = sn::Trapezoid(z, y, x, ltx);
}


Copy link
Contributor

Choose a reason for hiding this comment

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

clang-format suggestion

Please remove the line(s)

  • 895

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants