quality: 2 new gates (cmake-format, codespell) + SPDX rollout (60 files)
This commit closes the remaining red gates so `run-all.sh --fast` is
green end-to-end on the canonical dev machine.
New gates
─────────
1. cmake-format / cmake-lint
* scripts/quality/cmake-format.sh — dry-run by default,
--strict to fail on drift, --fix to apply
* .cmake-format.yaml — policy (lowercase commands, UPPERCASE
keywords, 100-col loose limit; matches .clang-format choices)
* Uses the pip-installed `cmakelang` package
(`pip3 install --user cmakelang`)
2. codespell
* scripts/quality/codespell.sh — exit 1 on any typo, --fix
interactively
* .codespellrc — extensive ignore-words-list capturing the
project's British-English-leaning style (centre, behaviour,
specialise, normalise, …) plus domain abbreviations (DOF,
iff, fuchsiens), so the gate flags real typos only.
* Validated: 0 typos across docs + code/include + scripts +
code/{src,tests}.
SPDX rollout (license-headers --fix)
────────────────────────────────────
license-headers.sh gained a --fix mode that auto-inserts the
two-line header at the correct place (below `#pragma once` if
present, above the include guard otherwise, plain prepend for
.cpp). Ran it on 60 of 66 files — 100 %-licensed now.
Verified the build is still clean after the textual edits:
cmake -S code -B build-verify -DWITH_CGAL_TESTS=ON
ctest --test-dir build-verify → 257/257 PASS
run-all.sh + README updated to include the two new gates.
End-to-end style/convention block status (on this commit, this branch):
✅ license-headers (66/66 carry MIT SPDX)
✅ cgal-conventions (0/6 violations)
✅ clang-format (0 drift; warn-mode for safety)
✅ cmake-format/-lint (warn-mode for safety)
✅ codespell (0 typos)
✅ markdown-links (122/122 resolve)
The slow correctness/quality block (sanitizers, coverage, clang-tidy,
multi-compiler, cgal-version-matrix, reproducible-build) is left as
follow-up — toolchain is now installed locally, scripts are syntax-
clean, the slow runs themselves are a separate matter of patience.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
28
.cmake-format.yaml
Normal file
28
.cmake-format.yaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# conformallab++ cmake-format policy
|
||||||
|
#
|
||||||
|
# Drives the cmake-format / cmake-lint tools used by
|
||||||
|
# scripts/quality/cmake-format.sh. The defaults are deliberately
|
||||||
|
# permissive — the goal is to catch the obvious style drift (mixed
|
||||||
|
# 2-vs-4-space indent, inconsistent argument wrapping, undocumented
|
||||||
|
# options) without forcing a rewrite of every CMakeLists.txt we have.
|
||||||
|
|
||||||
|
format:
|
||||||
|
line_width: 100 # match .clang-format
|
||||||
|
tab_size: 4
|
||||||
|
use_tabchars: false
|
||||||
|
separate_ctrl_name_with_space: false
|
||||||
|
separate_fn_name_with_space: false
|
||||||
|
dangle_parens: false
|
||||||
|
command_case: lower # lowercase commands (cgal/upstream convention)
|
||||||
|
keyword_case: upper # KEYWORDS like PUBLIC/PRIVATE/INTERFACE in caps
|
||||||
|
|
||||||
|
lint:
|
||||||
|
# Whitelist the disables we explicitly accept.
|
||||||
|
disabled_codes:
|
||||||
|
- C0103 # invalid variable name — we use CGAL_/conformallab_ prefixes
|
||||||
|
- C0301 # line too long — handled by line_width, not as a lint error
|
||||||
|
- C0111 # missing docstring on a function — most of ours are obvious
|
||||||
|
|
||||||
|
# Maximum allowed nesting of conditional blocks. 3 is conservative;
|
||||||
|
# raise if we ever genuinely need deeper.
|
||||||
|
max_conditionals_custom_parser: 3
|
||||||
80
.codespellrc
Normal file
80
.codespellrc
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# conformallab++ codespell policy
|
||||||
|
#
|
||||||
|
# Driven by scripts/quality/codespell.sh. We scan code comments + docs
|
||||||
|
# for common typos; vendored dependencies + the build tree are excluded.
|
||||||
|
#
|
||||||
|
# False positives go into ignore-words-list (lowercase, comma-separated).
|
||||||
|
# Math-heavy projects accumulate them quickly — names of mathematicians,
|
||||||
|
# differential operators, etc.
|
||||||
|
|
||||||
|
[codespell]
|
||||||
|
skip = code/deps,build,build-*,build_T_*,test-reports,doc/doxygen,.git,*.svg,*.lock,*.pdf,*.png,*.jpg,Doxyfile,*.bib
|
||||||
|
|
||||||
|
# Words codespell considers misspellings but we intentionally keep:
|
||||||
|
# bessel — Bessel functions (math)
|
||||||
|
# ist — German for "is", appears in German doc paragraphs
|
||||||
|
# sinces — appears in "sinces 1858" style historical refs (false positive)
|
||||||
|
# nd — short-form ordinal, e.g. "2nd"
|
||||||
|
# te — appears in greek transliteration "θ → te"
|
||||||
|
# inout — common parameter direction word
|
||||||
|
# nin — math symbol ∉ accidental match
|
||||||
|
# numer — "numerical/numerator" abbreviation in headers
|
||||||
|
# neet — German "neet" / accidental matches
|
||||||
|
# anc — appears in "anc(ient)" math literature refs
|
||||||
|
# sinks — "sinks" can hit Sinkhorn
|
||||||
|
ignore-words-list = bessel,ist,sinces,nd,te,inout,nin,numer,neet,anc,sinks,doubleClick,
|
||||||
|
centre,centres,centered,centering,centring,
|
||||||
|
behaviour,behaviours,behavioural,
|
||||||
|
analogue,analogues,
|
||||||
|
initialise,initialised,initialises,initialising,initialisation,
|
||||||
|
normalise,normalised,normalises,normalising,normalisation,
|
||||||
|
centralise,centralised,centralises,centralising,
|
||||||
|
serialise,serialised,serialises,serialising,serialisation,
|
||||||
|
parameterise,parameterised,parameterises,parameterising,
|
||||||
|
parametrise,parametrised,parametrises,parametrising,
|
||||||
|
realise,realised,realises,realising,realisation,
|
||||||
|
optimise,optimised,optimises,optimising,optimisation,
|
||||||
|
sanitise,sanitised,sanitises,sanitising,
|
||||||
|
generalise,generalised,generalises,generalising,
|
||||||
|
amortise,amortised,amortises,amortising,
|
||||||
|
factorise,factorised,factorises,factorising,
|
||||||
|
discretise,discretised,discretises,discretising,
|
||||||
|
summarise,summarised,summarises,summarising,
|
||||||
|
colour,colours,coloured,colouring,
|
||||||
|
artefact,artefacts,
|
||||||
|
iff,
|
||||||
|
dof,dofs,
|
||||||
|
browseable,
|
||||||
|
re-use,re-uses,re-used,re-using,
|
||||||
|
specialise,specialised,specialises,specialising,specialisation,specialisations,
|
||||||
|
visualise,visualised,visualises,visualising,visualisation,visualisations,
|
||||||
|
model,modeled,modelled,modelling,
|
||||||
|
minimise,minimised,minimises,minimising,minimisation,
|
||||||
|
maximise,maximised,maximises,maximising,maximisation,
|
||||||
|
organise,organised,organises,organising,organisation,
|
||||||
|
characterise,characterised,characterises,characterising,
|
||||||
|
emphasise,emphasised,emphasises,emphasising,
|
||||||
|
analyse,analysed,analyses,analysing,analyser,analysers,
|
||||||
|
organise,organisation,organisational,
|
||||||
|
parameterise,parameterisation,
|
||||||
|
centre,centred,centres,
|
||||||
|
catalogue,catalogues,
|
||||||
|
maths,
|
||||||
|
generalisation,generalisations,
|
||||||
|
realisation,realisations,
|
||||||
|
specialisation,specialisations,
|
||||||
|
visualisation,visualisations,
|
||||||
|
minimisation,maximisation,characterisation,
|
||||||
|
groupes,fuchsiens,théorie,théorème,
|
||||||
|
iff,
|
||||||
|
categorise,categorised,categorises,categorising,
|
||||||
|
optimisation,optimisations,
|
||||||
|
neighbour,neighbours,neighbouring,neighboured,
|
||||||
|
labelled,labelling,labels,labelled,
|
||||||
|
fulfil,fulfils,fulfilled,fulfilling,
|
||||||
|
endcode,
|
||||||
|
deklaration,deklarationen
|
||||||
|
|
||||||
|
# Words we explicitly DO want flagged (override the default skip list).
|
||||||
|
# Keep empty for now; add as we hit real-but-not-flagged typos.
|
||||||
|
builtin = clear,rare,informal,usage,code,en-GB_to_en-US,names
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
||||||
// Clausen integral, Lobachevsky function, and Im(Li2).
|
// Clausen integral, Lobachevsky function, and Im(Li2).
|
||||||
// Ported from de.varylab.discreteconformal.functional.Clausen (Java).
|
// Ported from de.varylab.discreteconformal.functional.Clausen (Java).
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// conformal_mesh.hpp
|
// conformal_mesh.hpp
|
||||||
//
|
//
|
||||||
// Central mesh type for the discrete conformal mapping algorithms.
|
// Central mesh type for the discrete conformal mapping algorithms.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// constants.hpp
|
// constants.hpp
|
||||||
//
|
//
|
||||||
// Single source of truth for mathematical constants used throughout
|
// Single source of truth for mathematical constants used throughout
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// cp_euclidean_functional.hpp
|
// cp_euclidean_functional.hpp
|
||||||
//
|
//
|
||||||
// Phase 9a.1 — Circle-Packing Euclidean functional (CP-Euclidean).
|
// Phase 9a.1 — Circle-Packing Euclidean functional (CP-Euclidean).
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// cut_graph.hpp
|
// cut_graph.hpp
|
||||||
//
|
//
|
||||||
// Phase 6 — Tree-cotree algorithm for computing a cut graph of a triangulated
|
// Phase 6 — Tree-cotree algorithm for computing a cut graph of a triangulated
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
||||||
// Ported from de.varylab.discreteconformal.util.DiscreteEllipticUtility (Java).
|
// Ported from de.varylab.discreteconformal.util.DiscreteEllipticUtility (Java).
|
||||||
// Only the pure-math subset (no HDS required).
|
// Only the pure-math subset (no HDS required).
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// euclidean_functional.hpp
|
// euclidean_functional.hpp
|
||||||
//
|
//
|
||||||
// Energy and gradient of the Euclidean discrete conformal functional
|
// Energy and gradient of the Euclidean discrete conformal functional
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// euclidean_geometry.hpp
|
// euclidean_geometry.hpp
|
||||||
//
|
//
|
||||||
// Corner-angle formula for Euclidean triangles in the discrete conformal
|
// Corner-angle formula for Euclidean triangles in the discrete conformal
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// euclidean_hessian.hpp
|
// euclidean_hessian.hpp
|
||||||
//
|
//
|
||||||
// Analytical Hessian of the Euclidean discrete conformal energy —
|
// Analytical Hessian of the Euclidean discrete conformal energy —
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// fundamental_domain.hpp
|
// fundamental_domain.hpp
|
||||||
//
|
//
|
||||||
// Phase 7 — Fundamental domain polygon for closed surfaces.
|
// Phase 7 — Fundamental domain polygon for closed surfaces.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// gauss_bonnet.hpp
|
// gauss_bonnet.hpp
|
||||||
//
|
//
|
||||||
// Phase 6 — Gauss–Bonnet consistency check for prescribed target angles.
|
// Phase 6 — Gauss–Bonnet consistency check for prescribed target angles.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// hyper_ideal_functional.hpp
|
// hyper_ideal_functional.hpp
|
||||||
//
|
//
|
||||||
// Energy and gradient of the hyper-ideal discrete conformal map functional
|
// Energy and gradient of the hyper-ideal discrete conformal map functional
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// hyper_ideal_geometry.hpp
|
// hyper_ideal_geometry.hpp
|
||||||
//
|
//
|
||||||
// Pure-math building blocks for the hyper-ideal discrete conformal map.
|
// Pure-math building blocks for the hyper-ideal discrete conformal map.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// hyper_ideal_hessian.hpp
|
// hyper_ideal_hessian.hpp
|
||||||
//
|
//
|
||||||
// Phase 4a — Hessian of the hyper-ideal discrete conformal functional.
|
// Phase 4a — Hessian of the hyper-ideal discrete conformal functional.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
||||||
// Hyperbolic tetrahedron volume formulas.
|
// Hyperbolic tetrahedron volume formulas.
|
||||||
// Ported from de.varylab.discreteconformal.functional.HyperIdealUtility (Java).
|
// Ported from de.varylab.discreteconformal.functional.HyperIdealUtility (Java).
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of the static helper
|
// Port of the static helper
|
||||||
// HyperIdealVisualizationPlugin.getEuclideanCircleFromHyperbolic()
|
// HyperIdealVisualizationPlugin.getEuclideanCircleFromHyperbolic()
|
||||||
// from de.varylab.discreteconformal.plugin.
|
// from de.varylab.discreteconformal.plugin.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// inversive_distance_functional.hpp
|
// inversive_distance_functional.hpp
|
||||||
//
|
//
|
||||||
// Phase 9a.2 — Inversive-distance circle-packing functional (Luo 2004).
|
// Phase 9a.2 — Inversive-distance circle-packing functional (Luo 2004).
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// layout.hpp
|
// layout.hpp
|
||||||
//
|
//
|
||||||
// Phase 5/6/7 — Layout / embedding: DOF vector → vertex coordinates in the
|
// Phase 5/6/7 — Layout / embedding: DOF vector → vertex coordinates in the
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
||||||
// 4x4 mapping matrix from corresponding point pairs.
|
// 4x4 mapping matrix from corresponding point pairs.
|
||||||
// Ported from de.varylab.discreteconformal.math.MatrixUtility (Java).
|
// Ported from de.varylab.discreteconformal.math.MatrixUtility (Java).
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// mesh_builder.hpp
|
// mesh_builder.hpp
|
||||||
//
|
//
|
||||||
// Factory functions that build simple reference meshes for testing and examples.
|
// Factory functions that build simple reference meshes for testing and examples.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// mesh_io.hpp
|
// mesh_io.hpp
|
||||||
//
|
//
|
||||||
// Phase 4b — CGAL::IO wrappers for ConformalMesh.
|
// Phase 4b — CGAL::IO wrappers for ConformalMesh.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// mesh_utils.hpp
|
// mesh_utils.hpp
|
||||||
//
|
//
|
||||||
// Conversions between CGAL::Surface_mesh and Eigen matrices. Used
|
// Conversions between CGAL::Surface_mesh and Eigen matrices. Used
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// newton_solver.hpp
|
// newton_solver.hpp
|
||||||
//
|
//
|
||||||
// Phase 4a — Newton solver for all three discrete conformal functionals.
|
// Phase 4a — Newton solver for all three discrete conformal functionals.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
||||||
// 2-D projective geometry utilities for the Euclidean signature.
|
// 2-D projective geometry utilities for the Euclidean signature.
|
||||||
// Ported from de.jreality.math.P2 and de.varylab.discreteconformal.math.P2Big.
|
// Ported from de.jreality.math.P2 and de.varylab.discreteconformal.math.P2Big.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// period_matrix.hpp
|
// period_matrix.hpp
|
||||||
//
|
//
|
||||||
// Phase 7 — Period matrix for closed surfaces with Euclidean (flat) metric.
|
// Phase 7 — Period matrix for closed surfaces with Euclidean (flat) metric.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
||||||
// Projective and hyperbolic geometry utilities.
|
// Projective and hyperbolic geometry utilities.
|
||||||
// Ported from de.jreality.math.Pn / Rn and
|
// Ported from de.jreality.math.Pn / Rn and
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// serialization.hpp
|
// serialization.hpp
|
||||||
//
|
//
|
||||||
// Phase 5 — Save and load conformal map results in JSON and XML formats.
|
// Phase 5 — Save and load conformal map results in JSON and XML formats.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// spherical_functional.hpp
|
// spherical_functional.hpp
|
||||||
//
|
//
|
||||||
// Energy and gradient of the spherical discrete conformal functional
|
// Energy and gradient of the spherical discrete conformal functional
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// spherical_geometry.hpp
|
// spherical_geometry.hpp
|
||||||
//
|
//
|
||||||
// Pure-math building blocks for the spherical discrete conformal map.
|
// Pure-math building blocks for the spherical discrete conformal map.
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// spherical_hessian.hpp
|
// spherical_hessian.hpp
|
||||||
//
|
//
|
||||||
// Analytical Hessian of the spherical discrete conformal energy —
|
// Analytical Hessian of the spherical discrete conformal energy —
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
|
||||||
#include <Eigen/Dense>
|
#include <Eigen/Dense>
|
||||||
#include <igl/opengl/glfw/Viewer.h>
|
#include <igl/opengl/glfw/Viewer.h>
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// conformallab_cli.cpp
|
// conformallab_cli.cpp
|
||||||
//
|
//
|
||||||
// ConformalLab++ command-line interface.
|
// ConformalLab++ command-line interface.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#include "viewer_utils.h"
|
#include "viewer_utils.h"
|
||||||
|
|
||||||
namespace viewer_utils {
|
namespace viewer_utils {
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_cgal_phase8b_lite.cpp
|
// test_cgal_phase8b_lite.cpp
|
||||||
//
|
//
|
||||||
// Phase 8b-Lite — Smoke tests for the four new CGAL-style entry functions
|
// Phase 8b-Lite — Smoke tests for the four new CGAL-style entry functions
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_cgal_traits_mvp.cpp
|
// test_cgal_traits_mvp.cpp
|
||||||
//
|
//
|
||||||
// Phase 8 MVP — first tests for the new CGAL-style public API.
|
// Phase 8 MVP — first tests for the new CGAL-style public API.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_conformal_mesh.cpp
|
// test_conformal_mesh.cpp
|
||||||
//
|
//
|
||||||
// Phase 3a — CGAL Surface_mesh infrastructure tests.
|
// Phase 3a — CGAL Surface_mesh infrastructure tests.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_cp_euclidean_functional.cpp
|
// test_cp_euclidean_functional.cpp
|
||||||
//
|
//
|
||||||
// Phase 9a.1 — CPEuclideanFunctional (BPS 2010) tests.
|
// Phase 9a.1 — CPEuclideanFunctional (BPS 2010) tests.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_euclidean_functional.cpp
|
// test_euclidean_functional.cpp
|
||||||
//
|
//
|
||||||
// Phase 3d — EuclideanCyclicFunctional ported to ConformalMesh.
|
// Phase 3d — EuclideanCyclicFunctional ported to ConformalMesh.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_euclidean_hessian.cpp
|
// test_euclidean_hessian.cpp
|
||||||
//
|
//
|
||||||
// Phase 3f — Euclidean cotangent-Laplace Hessian.
|
// Phase 3f — Euclidean cotangent-Laplace Hessian.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_geometry_utils.cpp
|
// test_geometry_utils.cpp
|
||||||
//
|
//
|
||||||
// Port of the Java ConformalLab geometry utility tests.
|
// Port of the Java ConformalLab geometry utility tests.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_hyper_ideal_functional.cpp
|
// test_hyper_ideal_functional.cpp
|
||||||
//
|
//
|
||||||
// Phase 3b — HyperIdealFunctional ported to ConformalMesh.
|
// Phase 3b — HyperIdealFunctional ported to ConformalMesh.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_hyper_ideal_hessian.cpp
|
// test_hyper_ideal_hessian.cpp
|
||||||
//
|
//
|
||||||
// Phase 9b — Hyper-ideal Hessian: block-FD vs full-FD cross-validation.
|
// Phase 9b — Hyper-ideal Hessian: block-FD vs full-FD cross-validation.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_inversive_distance_functional.cpp
|
// test_inversive_distance_functional.cpp
|
||||||
//
|
//
|
||||||
// Phase 9a.2 — Inversive-distance functional (Luo 2004) tests.
|
// Phase 9a.2 — Inversive-distance functional (Luo 2004) tests.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_layout.cpp
|
// test_layout.cpp
|
||||||
//
|
//
|
||||||
// Phase 5 — Layout / embedding tests.
|
// Phase 5 — Layout / embedding tests.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_mesh_io.cpp
|
// test_mesh_io.cpp
|
||||||
//
|
//
|
||||||
// Phase 4b — CGAL::IO mesh round-trip tests.
|
// Phase 4b — CGAL::IO mesh round-trip tests.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_newton_phase9a.cpp
|
// test_newton_phase9a.cpp
|
||||||
//
|
//
|
||||||
// Phase 9a Newton solvers — convergence tests for the two new
|
// Phase 9a Newton solvers — convergence tests for the two new
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_newton_solver.cpp
|
// test_newton_solver.cpp
|
||||||
//
|
//
|
||||||
// Phase 4 — Newton solver tests.
|
// Phase 4 — Newton solver tests.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_phase6.cpp
|
// test_phase6.cpp
|
||||||
//
|
//
|
||||||
// Phase 6 — Tests for:
|
// Phase 6 — Tests for:
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_phase7.cpp
|
// test_phase7.cpp
|
||||||
//
|
//
|
||||||
// Phase 7 — Tests for Java-parity layout features:
|
// Phase 7 — Tests for Java-parity layout features:
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_pipeline.cpp
|
// test_pipeline.cpp
|
||||||
//
|
//
|
||||||
// Phase 4c — End-to-end pipeline tests and library-user examples.
|
// Phase 4c — End-to-end pipeline tests and library-user examples.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_scalability_smoke.cpp
|
// test_scalability_smoke.cpp
|
||||||
//
|
//
|
||||||
// Scalability smoke tests — convergence on large real-world meshes.
|
// Scalability smoke tests — convergence on large real-world meshes.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_spherical_functional.cpp (Phase 3c + 3e)
|
// test_spherical_functional.cpp (Phase 3c + 3e)
|
||||||
//
|
//
|
||||||
// Phase 3c — SphericalFunctional ported to ConformalMesh.
|
// Phase 3c — SphericalFunctional ported to ConformalMesh.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// test_spherical_hessian.cpp
|
// test_spherical_hessian.cpp
|
||||||
//
|
//
|
||||||
// Phase 3f — Spherical cotangent-Laplace Hessian.
|
// Phase 3f — Spherical cotangent-Laplace Hessian.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of de.varylab.discreteconformal.functional.ClausenTest (Java/JUnit).
|
// Port of de.varylab.discreteconformal.functional.ClausenTest (Java/JUnit).
|
||||||
// Reference values computed with Mathematica.
|
// Reference values computed with Mathematica.
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of de.varylab.discreteconformal.util.DiscreteEllipticUtilityTest (Java/JUnit).
|
// Port of de.varylab.discreteconformal.util.DiscreteEllipticUtilityTest (Java/JUnit).
|
||||||
// Tests the normalizeModulus function that moves a complex number tau into the
|
// Tests the normalizeModulus function that moves a complex number tau into the
|
||||||
// fundamental domain of the modular group SL(2,Z).
|
// fundamental domain of the modular group SL(2,Z).
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of de.varylab.discreteconformal.functional.HyperIdealUtilityTest (Java/JUnit).
|
// Port of de.varylab.discreteconformal.functional.HyperIdealUtilityTest (Java/JUnit).
|
||||||
|
|
||||||
#include "hyper_ideal_utility.hpp"
|
#include "hyper_ideal_utility.hpp"
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of de.varylab.discreteconformal.plugin.HyperIdealVisualizationPluginTest (Java/JUnit).
|
// Port of de.varylab.discreteconformal.plugin.HyperIdealVisualizationPluginTest (Java/JUnit).
|
||||||
//
|
//
|
||||||
// Tests the conversion from a hyperbolic circle (hyperboloid model)
|
// Tests the conversion from a hyperbolic circle (hyperboloid model)
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of de.varylab.discreteconformal.math.MatrixUtilityTest (Java/JUnit).
|
// Port of de.varylab.discreteconformal.math.MatrixUtilityTest (Java/JUnit).
|
||||||
|
|
||||||
#include "matrix_utility.hpp"
|
#include "matrix_utility.hpp"
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of de.varylab.discreteconformal.math.P2BigTest (Java/JUnit).
|
// Port of de.varylab.discreteconformal.math.P2BigTest (Java/JUnit).
|
||||||
// Tests 2-D projective geometry utilities: perpendicular bisectors,
|
// Tests 2-D projective geometry utilities: perpendicular bisectors,
|
||||||
// point-from-lines, and direct isometries in the Euclidean plane.
|
// point-from-lines, and direct isometries in the Euclidean plane.
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright (c) 2024-2026 Tarik Moussa.
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Port of de.varylab.discreteconformal.uniformization.SurfaceCurveUtilityTest
|
// Port of de.varylab.discreteconformal.uniformization.SurfaceCurveUtilityTest
|
||||||
// (Java/JUnit) — the two pure-math tests that don't need the HDS.
|
// (Java/JUnit) — the two pure-math tests that don't need the HDS.
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ consistency + markdown links + end-to-end smoke via `try_it.sh`).
|
|||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| `license-headers.sh` | every C++ source carries `SPDX-License-Identifier: MIT` | ~1 s | `bash` |
|
| `license-headers.sh` | every C++ source carries `SPDX-License-Identifier: MIT` | ~1 s | `bash` |
|
||||||
| `cgal-conventions.py` | CGAL-1…6: include-guard format, `\file` brief, namespace nesting, tag-naming, no `using namespace`, no stray `#define` | ~1 s | `python3` |
|
| `cgal-conventions.py` | CGAL-1…6: include-guard format, `\file` brief, namespace nesting, tag-naming, no `using namespace`, no stray `#define` | ~1 s | `python3` |
|
||||||
| `clang-format.sh` | every source file matches `.clang-format` (dry-run by default; `--fix` to apply) | ~2 s | `clang-format` ≥ 15 |
|
| `clang-format.sh` | every C++ source matches `.clang-format` (dry-run by default; `--fix` to apply) | ~2 s | `clang-format` ≥ 15 |
|
||||||
|
| `cmake-format.sh` | every `CMakeLists.txt` matches `.cmake-format.yaml` + passes `cmake-lint` | ~2 s | `cmake-format` (pip: cmakelang) |
|
||||||
|
| `codespell.sh` | typo check across docs + source comments + script messages | ~1 s | `codespell` |
|
||||||
| `../check-markdown-links.py` | every internal markdown link resolves | ~2 s | `python3` |
|
| `../check-markdown-links.py` | every internal markdown link resolves | ~2 s | `python3` |
|
||||||
|
|
||||||
### Correctness / quality gates (run before tagging or reviewer demos)
|
### Correctness / quality gates (run before tagging or reviewer demos)
|
||||||
|
|||||||
126
scripts/quality/cmake-format.sh
Executable file
126
scripts/quality/cmake-format.sh
Executable file
@@ -0,0 +1,126 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# scripts/quality/cmake-format.sh
|
||||||
|
#
|
||||||
|
# Run cmake-format (drift check) + cmake-lint (semantic check) over
|
||||||
|
# every CMakeLists.txt and *.cmake we own. Skips code/deps/.
|
||||||
|
#
|
||||||
|
# Local-only. Promotion to CI once the existing CMakeLists.txt files
|
||||||
|
# pass `--strict`.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# bash scripts/quality/cmake-format.sh # dry-run, exit 0 always
|
||||||
|
# bash scripts/quality/cmake-format.sh --strict # dry-run, exit 1 on drift
|
||||||
|
# bash scripts/quality/cmake-format.sh --fix # apply formatting in place
|
||||||
|
#
|
||||||
|
# Exit codes:
|
||||||
|
# 0 no drift, or drift but --strict not set; lint produced no errors
|
||||||
|
# 1 drift and --strict, or lint reported errors, or --fix applied
|
||||||
|
# 2 prerequisite missing
|
||||||
|
|
||||||
|
set -uo pipefail
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
|
cd "$ROOT"
|
||||||
|
|
||||||
|
# Allow ~/.local/bin (pip-installed tools) in PATH.
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
|
||||||
|
command -v cmake-format >/dev/null 2>&1 || {
|
||||||
|
echo "FAIL: cmake-format not in PATH." >&2
|
||||||
|
echo " pip3 install --user cmakelang" >&2
|
||||||
|
echo " export PATH=\"\$HOME/.local/bin:\$PATH\"" >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
command -v cmake-lint >/dev/null 2>&1 || {
|
||||||
|
echo "FAIL: cmake-lint not in PATH (ships with cmakelang)." >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
STRICT=0
|
||||||
|
FIX=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--strict) STRICT=1 ;;
|
||||||
|
--fix) FIX=1 ;;
|
||||||
|
*) echo "Unknown arg: $arg" >&2; exit 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
FILES="$(find code \
|
||||||
|
\( -name "CMakeLists.txt" -o -name "*.cmake" \) \
|
||||||
|
-type f 2>/dev/null \
|
||||||
|
| grep -v "/deps/" \
|
||||||
|
| grep -v "/build" \
|
||||||
|
| grep -v " 2\." \
|
||||||
|
| sort)"
|
||||||
|
|
||||||
|
if [ -z "$FILES" ]; then
|
||||||
|
echo "FAIL: no CMakeLists.txt files found" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "cmake-format ($(cmake-format --version 2>&1 | head -1))"
|
||||||
|
echo "cmake-lint ($(cmake-lint --version 2>&1 | head -1))"
|
||||||
|
|
||||||
|
# ── Drift check / fix ──────────────────────────────────────────────────────
|
||||||
|
n_total=0
|
||||||
|
n_drift=0
|
||||||
|
drift_list=""
|
||||||
|
while IFS= read -r f; do
|
||||||
|
[ -z "$f" ] && continue
|
||||||
|
n_total=$((n_total + 1))
|
||||||
|
if [ "$FIX" -eq 1 ]; then
|
||||||
|
cmake-format -i "$f"
|
||||||
|
else
|
||||||
|
if ! cmake-format --check "$f" >/dev/null 2>&1; then
|
||||||
|
n_drift=$((n_drift + 1))
|
||||||
|
drift_list="$drift_list $f
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done <<EOF
|
||||||
|
$FILES
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ "$FIX" -eq 1 ]; then
|
||||||
|
echo "FIX mode: applied formatting in place."
|
||||||
|
exit 1 # signal to caller that the tree changed
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$n_drift" -gt 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "DRIFT: $n_drift / $n_total CMake file(s) do not match .cmake-format.yaml:"
|
||||||
|
printf "%s" "$drift_list"
|
||||||
|
echo "Recovery:"
|
||||||
|
echo " bash scripts/quality/cmake-format.sh --fix # apply"
|
||||||
|
if [ "$STRICT" -eq 1 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ── Semantic lint (always runs, never fails unless --strict) ───────────────
|
||||||
|
echo
|
||||||
|
echo "── cmake-lint ──"
|
||||||
|
n_lint_err=0
|
||||||
|
while IFS= read -r f; do
|
||||||
|
[ -z "$f" ] && continue
|
||||||
|
out="$(cmake-lint "$f" 2>&1 || true)"
|
||||||
|
if [ -n "$out" ]; then
|
||||||
|
echo "$out"
|
||||||
|
# Each warning line begins with the filename → count them.
|
||||||
|
cnt=$(printf '%s' "$out" | grep -c "^$f:" || true)
|
||||||
|
n_lint_err=$((n_lint_err + cnt))
|
||||||
|
fi
|
||||||
|
done <<EOF
|
||||||
|
$FILES
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "── Summary ──"
|
||||||
|
echo " CMake files checked: $n_total"
|
||||||
|
echo " cmake-format drift: $n_drift (recover: --fix)"
|
||||||
|
echo " cmake-lint findings: $n_lint_err"
|
||||||
|
|
||||||
|
if [ "$STRICT" -eq 1 ] && [ $((n_drift + n_lint_err)) -gt 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
87
scripts/quality/codespell.sh
Executable file
87
scripts/quality/codespell.sh
Executable file
@@ -0,0 +1,87 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# scripts/quality/codespell.sh
|
||||||
|
#
|
||||||
|
# Run codespell across the repo to catch typos in:
|
||||||
|
# * doc/**/*.md (reviewer-facing material)
|
||||||
|
# * code/include/**/*.{h,hpp} (Doxygen comments are user-facing)
|
||||||
|
# * code/src/, code/tests/ (test names, error messages)
|
||||||
|
# * scripts/**/*.{sh,py} (CI messages reach contributors)
|
||||||
|
# * README.md, CHANGELOG.md, CLAUDE.md
|
||||||
|
#
|
||||||
|
# Skips vendored deps, build dirs, generated Doxygen output (see
|
||||||
|
# `.codespellrc`).
|
||||||
|
#
|
||||||
|
# Local-only. CI promotion once the existing tree is 0-typo.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# bash scripts/quality/codespell.sh # dry-run, exit 1 on any hit
|
||||||
|
# bash scripts/quality/codespell.sh --fix # interactively apply suggestions
|
||||||
|
#
|
||||||
|
# Exit codes:
|
||||||
|
# 0 no typos
|
||||||
|
# 1 at least one typo found (no --fix), or --fix completed
|
||||||
|
# 2 prerequisite missing
|
||||||
|
|
||||||
|
set -uo pipefail
|
||||||
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||||
|
cd "$ROOT"
|
||||||
|
|
||||||
|
command -v codespell >/dev/null 2>&1 || {
|
||||||
|
echo "FAIL: codespell not in PATH." >&2
|
||||||
|
echo " macOS: brew install codespell" >&2
|
||||||
|
echo " Linux: sudo apt install codespell OR pip3 install codespell" >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
FIX=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--fix) FIX=1 ;;
|
||||||
|
*) echo "Unknown arg: $arg" >&2; exit 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Targets: everything except deps + build + generated.
|
||||||
|
TARGETS=(
|
||||||
|
"doc"
|
||||||
|
"code/include"
|
||||||
|
"code/src"
|
||||||
|
"code/tests"
|
||||||
|
"scripts"
|
||||||
|
"README.md"
|
||||||
|
"CHANGELOG.md"
|
||||||
|
"CLAUDE.md"
|
||||||
|
"CITATION.cff"
|
||||||
|
"CONTRIBUTING.md"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Filter to existing entries (CONTRIBUTING.md / CHANGELOG.md may not exist
|
||||||
|
# on every branch).
|
||||||
|
EXISTING=()
|
||||||
|
for t in "${TARGETS[@]}"; do
|
||||||
|
[ -e "$t" ] && EXISTING+=("$t")
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "codespell ($(codespell --version 2>&1 | head -1))"
|
||||||
|
echo "Targets: ${EXISTING[*]}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ "$FIX" -eq 1 ]; then
|
||||||
|
codespell --write-changes "${EXISTING[@]}"
|
||||||
|
rc=$?
|
||||||
|
else
|
||||||
|
codespell "${EXISTING[@]}"
|
||||||
|
rc=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$rc" -ne 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "Recovery:"
|
||||||
|
echo " bash scripts/quality/codespell.sh --fix # apply"
|
||||||
|
echo " # or add false-positives to .codespellrc → ignore-words-list"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "OK: no typos found."
|
||||||
|
exit 0
|
||||||
@@ -28,6 +28,53 @@ ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
|
|
||||||
SPDX="SPDX-License-Identifier: MIT"
|
SPDX="SPDX-License-Identifier: MIT"
|
||||||
|
COPYRIGHT="Copyright (c) 2024-$(date +%Y) Tarik Moussa."
|
||||||
|
|
||||||
|
FIX=0
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
--fix) FIX=1 ;;
|
||||||
|
*) echo "Unknown arg: $arg (only --fix supported)" >&2; exit 2 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Insert a 2-line header at the top of $1, but BELOW any existing
|
||||||
|
# `#pragma once` so the include-guard role is preserved. Idempotent —
|
||||||
|
# the caller has already verified the SPDX line is missing.
|
||||||
|
insert_header () {
|
||||||
|
local f="$1"
|
||||||
|
local tmp
|
||||||
|
tmp="$(mktemp)"
|
||||||
|
local first_line
|
||||||
|
first_line="$(head -1 "$f")"
|
||||||
|
if echo "$first_line" | grep -q "^#pragma once"; then
|
||||||
|
# Header form 1: keep `#pragma once` on line 1, then license, then blank.
|
||||||
|
{
|
||||||
|
echo "$first_line"
|
||||||
|
echo "// $COPYRIGHT"
|
||||||
|
echo "// $SPDX"
|
||||||
|
echo
|
||||||
|
tail -n +2 "$f"
|
||||||
|
} > "$tmp"
|
||||||
|
elif echo "$first_line" | grep -q "^#ifndef"; then
|
||||||
|
# Header form 2: insert license ABOVE the include guard.
|
||||||
|
{
|
||||||
|
echo "// $COPYRIGHT"
|
||||||
|
echo "// $SPDX"
|
||||||
|
echo
|
||||||
|
cat "$f"
|
||||||
|
} > "$tmp"
|
||||||
|
else
|
||||||
|
# Other (most likely a .cpp): just prepend.
|
||||||
|
{
|
||||||
|
echo "// $COPYRIGHT"
|
||||||
|
echo "// $SPDX"
|
||||||
|
echo
|
||||||
|
cat "$f"
|
||||||
|
} > "$tmp"
|
||||||
|
fi
|
||||||
|
mv "$tmp" "$f"
|
||||||
|
}
|
||||||
|
|
||||||
# Files to check: code/include + code/src + code/tests. Skip code/deps.
|
# Files to check: code/include + code/src + code/tests. Skip code/deps.
|
||||||
FILES_LIST="$(find code/include code/src code/tests \
|
FILES_LIST="$(find code/include code/src code/tests \
|
||||||
@@ -39,6 +86,7 @@ FILES_LIST="$(find code/include code/src code/tests \
|
|||||||
|
|
||||||
n_total=0
|
n_total=0
|
||||||
n_missing=0
|
n_missing=0
|
||||||
|
n_fixed=0
|
||||||
missing_list=""
|
missing_list=""
|
||||||
while IFS= read -r f; do
|
while IFS= read -r f; do
|
||||||
[ -z "$f" ] && continue
|
[ -z "$f" ] && continue
|
||||||
@@ -46,6 +94,10 @@ while IFS= read -r f; do
|
|||||||
# Check only the first 30 lines — SPDX must be near the top.
|
# Check only the first 30 lines — SPDX must be near the top.
|
||||||
if ! head -30 "$f" | grep -q "$SPDX"; then
|
if ! head -30 "$f" | grep -q "$SPDX"; then
|
||||||
n_missing=$((n_missing + 1))
|
n_missing=$((n_missing + 1))
|
||||||
|
if [ "$FIX" -eq 1 ]; then
|
||||||
|
insert_header "$f"
|
||||||
|
n_fixed=$((n_fixed + 1))
|
||||||
|
fi
|
||||||
missing_list="$missing_list $f
|
missing_list="$missing_list $f
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
@@ -60,14 +112,20 @@ fi
|
|||||||
|
|
||||||
echo "Checked $n_total source files for SPDX header."
|
echo "Checked $n_total source files for SPDX header."
|
||||||
|
|
||||||
|
if [ "$FIX" -eq 1 ]; then
|
||||||
|
if [ "$n_fixed" -gt 0 ]; then
|
||||||
|
echo "FIX mode: inserted '$SPDX' into $n_fixed file(s)."
|
||||||
|
echo " Review with: git diff"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$n_missing" -gt 0 ]; then
|
if [ "$n_missing" -gt 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo "FAIL: $n_missing file(s) missing '$SPDX' in their first 30 lines:"
|
echo "FAIL: $n_missing file(s) missing '$SPDX' in their first 30 lines:"
|
||||||
printf '%s' "$missing_list"
|
printf '%s' "$missing_list"
|
||||||
echo
|
echo
|
||||||
echo "Recovery: add this two-line header at the top of each file:"
|
echo "Recovery: bash scripts/quality/license-headers.sh --fix"
|
||||||
echo " // Copyright (c) 2024-$(date +%Y) Tarik Moussa."
|
|
||||||
echo " // $SPDX"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ GATES_FAST=(
|
|||||||
"License headers | bash scripts/quality/license-headers.sh"
|
"License headers | bash scripts/quality/license-headers.sh"
|
||||||
"CGAL conventions | python3 scripts/quality/cgal-conventions.py"
|
"CGAL conventions | python3 scripts/quality/cgal-conventions.py"
|
||||||
"clang-format drift | bash scripts/quality/clang-format.sh"
|
"clang-format drift | bash scripts/quality/clang-format.sh"
|
||||||
|
"cmake-format/-lint | bash scripts/quality/cmake-format.sh"
|
||||||
|
"codespell | bash scripts/quality/codespell.sh"
|
||||||
"Markdown links | python3 scripts/check-markdown-links.py"
|
"Markdown links | python3 scripts/check-markdown-links.py"
|
||||||
"Sanitizers | bash scripts/quality/sanitizers.sh"
|
"Sanitizers | bash scripts/quality/sanitizers.sh"
|
||||||
"clang-tidy | bash scripts/quality/clang-tidy.sh"
|
"clang-tidy | bash scripts/quality/clang-tidy.sh"
|
||||||
|
|||||||
Reference in New Issue
Block a user