Skip to content

fix(Library): better handle exception and library#37

Merged
BotellaA merged 5 commits intonextfrom
feat/exception-library
May 7, 2026
Merged

fix(Library): better handle exception and library#37
BotellaA merged 5 commits intonextfrom
feat/exception-library

Conversation

@BotellaA
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v20.1.8) reports: 611 concern(s)
  • include/geode/stochastic/sampling/direct/object_set_sampler/point_set_sampler.hpp:39:9: warning: [google-explicit-constructor]

    single-argument constructors must be marked explicit to avoid unintentional implicit conversions

       39 |         UniformPointSetSampler( const SpatialDomain< dimension >& domain )
          |         ^
          |         explicit 
  • include/geode/stochastic/sampling/direct/object_set_sampler/point_set_sampler.hpp:48:13: warning: [cppcoreguidelines-prefer-member-initializer]

    'step_move_' should be initialized in a member initializer of the constructor

       40 |             : ObjectSetSampler< Point< dimension > >{}, domain_( domain )
          |                                                                          
          |                                                                          , step_move_(define_step_for_move())
       41 |         {
       42 |             auto volume = domain_.extended_n_volume();
       43 |             OpenGeodeStochasticStochasticException::check_exception(
       44 |                 volume != 0., nullptr, OpenGeodeException::TYPE::data,
       45 |                 "[PointSetSampler] - Undefined Extended Bounding "
       46 |                 "Box (volume ==0)." );
       47 |             this->log_pdf_ = -std::log( volume );
       48 |             step_move_ = define_step_for_move();
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • include/geode/stochastic/sampling/direct/object_set_sampler/point_set_sampler.hpp:68:31: warning: [readability-identifier-naming]

    invalid case style for constexpr variable 'max_try'

       68 |             constexpr index_t max_try{ 100 };
          |                               ^~~~~~~
          |                               MAX_TRY
       69 |             for( const auto try_id : geode::Range{ max_try } )
          |                                                    ~~~~~~~
          |                                                    MAX_TRY
  • include/geode/stochastic/sampling/direct/object_set_sampler/point_set_sampler.hpp:87:28: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.1 is a magic number; consider replacing it with a named constant

       87 |             double ratio = 0.1;
          |                            ^
  • include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:40:13: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'UniformSegmentSetSampler' of similar type ('const DoubleSampler::Distribution &') are easily swapped by mistake

       40 |             const DoubleSampler::Distribution& length,
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       41 |             const DoubleSampler::Distribution& azimuth )
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:40:48: note: the first parameter in the range is 'length'
       40 |             const DoubleSampler::Distribution& length,
          |                                                ^~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:41:48: note: the last parameter in the range is 'azimuth'
       41 |             const DoubleSampler::Distribution& azimuth )
          |                                                ^~~~~~~
  • include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:65:28: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.1 is a magic number; consider replacing it with a named constant

       65 |             double ratio = 0.1;
          |                            ^
  • include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:75:31: warning: [readability-identifier-naming]

    invalid case style for constexpr variable 'max_try'

       75 |             constexpr index_t max_try{ 100 };
          |                               ^~~~~~~
          |                               MAX_TRY
       76 |             for( const auto try_id : geode::Range{ max_try } )
          |                                                    ~~~~~~~
          |                                                    MAX_TRY
  • include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:76:29: warning: [clang-analyzer-deadcode.DeadStores]

    Value stored to 'try_id' during its initialization is never read

       76 |             for( const auto try_id : geode::Range{ max_try } )
          |                             ^~~~~~ ~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:76:29: note: Value stored to 'try_id' during its initialization is never read
       76 |             for( const auto try_id : geode::Range{ max_try } )
          |                             ^~~~~~ ~
  • include/geode/stochastic/sampling/direct/object_set_sampler/segment_set_sampler.hpp:94:9: warning: [modernize-use-nodiscard]

    function 'is_valid_object' should be marked [[nodiscard]]

       94 |         bool is_valid_object( const OwnerSegment2D& obj ) const override
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/energy_terms/energy_term_collection.hpp:99:24: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

       99 |             const auto it = set_to_terms_.find( set_id );
          |                        ^
  • include/geode/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp:60:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

       60 |         std::string string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp:87:9: warning: [google-explicit-constructor]

    single-argument constructors must be marked explicit to avoid unintentional implicit conversions

       87 |         FractureSimulationRunner( const SpatialDomain< 2 >& domain )
          |         ^
          |         explicit 
  • include/geode/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp:219:25: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

      219 |                         0.5 * this->domain_.smallest_length(),
          |                         ^
  • include/geode/stochastic/sampling/mcmc/helpers/fracture_simulation_runner.hpp:249:41: warning: [readability-identifier-length]

    variable name 'id' is too short, expected at least 3 characters

      249 |                 for( const auto& [name, id] : set_name_to_uuid_ )
          |                                         ^
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:31:11: warning: [cppcoreguidelines-special-member-functions]

    class 'StatisticsMonitor' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

       31 |     class StatisticsMonitor
          |           ^
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:40:9: warning: [google-explicit-constructor]

    single-argument constructors must be marked explicit to avoid unintentional implicit conversions

       40 |         StatisticsMonitor( const index_t nb_energy_terms )
          |         ^
          |         explicit 
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:58:33: warning: [google-readability-braces-around-statements]

    statement should be inside braces

       58 |                 if( count_ > 1 )
          |                                 ^
          |                                  {
       59 |                     variances_[i] = ( ( count_ - 2 ) * variances_[i]
       60 |                                         + delta * ( values[i] - means_[i] ) )
       61 |                                     / ( count_ - 1 );
          |                                                      
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:65:9: warning: [modernize-use-nodiscard]

    function 'statiscal_count' should be marked [[nodiscard]]

       65 |         const index_t statiscal_count() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:65:9: warning: [readability-const-return-type]

    return type 'const index_t' (aka 'const unsigned int') is 'const'-qualified at the top level, which may reduce code readability without improving const correctness

       65 |         const index_t statiscal_count() const
          |         ^~~~~
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:70:9: warning: [modernize-use-nodiscard]

    function 'means' should be marked [[nodiscard]]

       70 |         const std::vector< double >& means() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_monitor.hpp:75:9: warning: [modernize-use-nodiscard]

    function 'variances' should be marked [[nodiscard]]

       75 |         const std::vector< double >& variances() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:47:47: warning: [cppcoreguidelines-avoid-magic-numbers]

    100 is a magic number; consider replacing it with a named constant

       47 |         index_t realisations_print_frequency{ 100 };
          |                                               ^
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:51:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

       51 |         std::string string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:81:9: warning: [google-explicit-constructor]

    single-argument constructors must be marked explicit to avoid unintentional implicit conversions

       81 |         SimulationPrinter( const SimulationPrinterConfigurator& config )
          |         ^
          |         explicit 
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:81:28: warning: [modernize-pass-by-value]

    pass by value and use std::move

       34 |         SimulationPrinter( const SimulationPrinterConfigurator& config )
          |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                            SimulationPrinterConfigurator 
       35 |             : config_( config )
          |                       std::move( )
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:90:44: warning: [google-readability-braces-around-statements]

    statement should be inside braces

       90 |             if( !config_.print_statistics )
          |                                            ^
          |                                             {
       91 |                 return;
          |                        
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:104:80: warning: [google-readability-braces-around-statements]

    statement should be inside braces

      104 |                 || realization_id % config_.realisations_print_frequency != 0 )
          |                                                                                ^
          |                                                                                 {
      105 |                 return;
          |                        
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:128:52: warning: [google-readability-braces-around-statements]

    statement should be inside braces

      128 |             if( !config_.print_statistics_summary )
          |                                                    ^
          |                                                     {
      129 |                 return;
          |                        
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:149:13: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'write_header_if_new' of similar type ('absl::string_view') are easily swapped by mistake

      149 |             absl::string_view filename, absl::string_view header ) const
          |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:149:31: note: the first parameter in the range is 'filename'
      149 |             absl::string_view filename, absl::string_view header ) const
          |                               ^~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:149:59: note: the last parameter in the range is 'header'
      149 |             absl::string_view filename, absl::string_view header ) const
          |                                                           ^~~~~~
  • include/geode/stochastic/sampling/mcmc/helpers/simulation_printer.hpp:194:61: warning: [bugprone-suspicious-stringview-data-usage]

    result of a data() call may not be null terminated, provide size information to the callee to prevent potential issues

      194 |                         "# Simulation Statistics\n", header.data(), "\n" ) );
          |                                                      ~~~~~~~^~~~
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:32:17: warning: [performance-enum-size]

    enum 'MHDecision' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       32 |     enum struct MHDecision
          |                 ^
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:32:17: warning: [readability-identifier-naming]

    invalid case style for enum 'MHDecision'

       32 |     enum struct MHDecision
          |                 ^~~~~~~~~~
          |                 MH_DECISION
       33 |     {
       34 |         Accepted,
       35 |         Rejected,
       36 |         Undecided
       37 |     };
       38 | 
       39 |     template < typename ObjectType >
       40 |     struct StepResult
       41 |     {
       42 |         MHDecision decision{ MHDecision::Undecided };
          |         ~~~~~~~~~~           ~~~~~~~~~~
          |         MH_DECISION          MH_DECISION
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:34:9: warning: [readability-identifier-naming]

    invalid case style for enum constant 'Accepted'

       34 |         Accepted,
          |         ^~~~~~~~
          |         accepted
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:35:9: warning: [readability-identifier-naming]

    invalid case style for enum constant 'Rejected'

       35 |         Rejected,
          |         ^~~~~~~~
          |         rejected
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:36:9: warning: [readability-identifier-naming]

    invalid case style for enum constant 'Undecided'

       36 |         Undecided
          |         ^~~~~~~~~
          |         undecided
       37 |     };
       38 | 
       39 |     template < typename ObjectType >
       40 |     struct StepResult
       41 |     {
       42 |         MHDecision decision{ MHDecision::Undecided };
          |                                          ~~~~~~~~~
          |                                          undecided
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:103:9: warning: [modernize-use-nodiscard]

    function 'beta' should be marked [[nodiscard]]

      103 |         double beta() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:108:31: warning: [readability-identifier-length]

    parameter name 'b' is too short, expected at least 3 characters

      108 |         void set_beta( double b )
          |                               ^
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:143:43: warning: [google-readability-braces-around-statements]

    statement should be inside braces

      143 |             if( std::isnan( log_accept ) )
          |                                           ^
          |                                            {
      144 |                 return 0.0;
          |                            
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:145:36: warning: [google-readability-braces-around-statements]

    statement should be inside braces

      145 |             if( log_accept >= 0.0 )
          |                                    ^
          |                                     {
      146 |                 return 1.0;
          |                            
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:149:39: warning: [google-readability-braces-around-statements]

    statement should be inside braces

      149 |             if( log_accept < LOG_MIN )
          |                                       ^
          |                                        {
      150 |                 return 0.0;
          |                            
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:155:9: warning: [modernize-use-nodiscard]

    function 'compute_log_accept' should be marked [[nodiscard]]

      155 |         const double compute_log_accept( const double deltaU,
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:155:9: warning: [readability-const-return-type]

    return type 'const double' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness

      155 |         const double compute_log_accept( const double deltaU,
          |         ^~~~~
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:158:20: warning: [readability-math-missing-parentheses]

    '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations

      158 |             return -beta_ * deltaU + proposal_probas.transition_probability();
          |                    ^~~~~~~~~~~~~~~
          |                    (              )
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:162:34: warning: [readability-function-size]

    function 'accept_or_reject' exceeds recommended size/complexity thresholds

      162 |         StepResult< ObjectType > accept_or_reject(
          |                                  ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:162:34: note: 5 parameters (threshold 4)
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:167:25: warning: [cppcoreguidelines-missing-std-forward]

    forwarding reference parameter 'apply_move' is never forwarded inside the function body

      167 |             ApplyMove&& apply_move ) const
          |                         ^
  • include/geode/stochastic/sampling/mcmc/metropolis_hasting_sampler.hpp:180:63: warning: [google-readability-braces-around-statements]

    statement should be inside braces

      180 |             if( step_result.decision == MHDecision::Accepted )
          |                                                               ^
          |                                                                {
      181 |                 apply_move( state, proposal );
          |                                               
  • include/geode/stochastic/sampling/mcmc/proposal/classical_proposals.hpp:34:10: warning: [readability-function-size]

    function 'add_birth_death_change_moves' exceeds recommended size/complexity thresholds

       34 |     void add_birth_death_change_moves(
          |          ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/proposal/classical_proposals.hpp:34:10: note: 6 parameters (threshold 4)
  • include/geode/stochastic/sampling/mcmc/proposal/classical_proposals.hpp:39:9: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'add_birth_death_change_moves' of similar type ('double') are easily swapped by mistake

       39 |         double death_ratio,
          |         ^~~~~~~~~~~~~~~~~~~
       40 |         double change_ratio )
          |         ~~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/proposal/classical_proposals.hpp:39:16: note: the first parameter in the range is 'death_ratio'
       39 |         double death_ratio,
          |                ^~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/proposal/classical_proposals.hpp:40:16: note: the last parameter in the range is 'change_ratio'
       40 |         double change_ratio )
          |                ^~~~~~~~~~~~
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:31:16: warning: [performance-enum-size]

    enum 'MoveType' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size

       31 |     enum class MoveType
          |                ^
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:31:16: warning: [readability-identifier-naming]

    invalid case style for enum 'MoveType'

       31 |     enum class MoveType
          |                ^~~~~~~~
          |                MOVE_TYPE
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:33:9: warning: [readability-identifier-naming]

    invalid case style for enum constant 'Invalid'

       33 |         Invalid,
          |         ^~~~~~~
          |         invalid
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:34:9: warning: [readability-identifier-naming]

    invalid case style for enum constant 'Birth'

       34 |         Birth,
          |         ^~~~~
          |         birth
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:35:9: warning: [readability-identifier-naming]

    invalid case style for enum constant 'Death'

       35 |         Death,
          |         ^~~~~
          |         death
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:36:9: warning: [readability-identifier-naming]

    invalid case style for enum constant 'Change'

       36 |         Change
          |         ^~~~~~
          |         change
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:43:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

       43 |         std::string string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:51:9: warning: [modernize-use-nodiscard]

    function 'transition_probability' should be marked [[nodiscard]]

       51 |         double transition_probability() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:72:9: warning: [modernize-use-nodiscard]

    function 'type_string' should be marked [[nodiscard]]

       72 |         std::string type_string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:92:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

       92 |         std::string string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:112:11: warning: [cppcoreguidelines-special-member-functions]

    class 'Move' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator

      112 |     class Move
          |           ^
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:133:9: warning: [modernize-use-nodiscard]

    function 'proportion_weight' should be marked [[nodiscard]]

      133 |         double proportion_weight() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:143:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

      143 |         virtual std::string string() const = 0;
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:161:47: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'sampler_' has protected visibility

      161 |         const ObjectSetSampler< ObjectType >& sampler_;
          |                                               ^
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:162:16: warning: [cppcoreguidelines-non-private-member-variables-in-classes]

    member variable 'proportion_weight_' has protected visibility

      162 |         double proportion_weight_{ 1.0 };
          |                ^
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:170:13: warning: [bugprone-easily-swappable-parameters]

    2 adjacent parameters of 'BirthDeathMove' of similar type ('double') are easily swapped by mistake

      170 |             double probability,
          |             ^~~~~~~~~~~~~~~~~~~
      171 |             double birth_ratio )
          |             ~~~~~~~~~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:170:20: note: the first parameter in the range is 'probability'
      170 |             double probability,
          |                    ^~~~~~~~~~~
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:171:20: note: the last parameter in the range is 'birth_ratio'
      171 |             double birth_ratio )
          |                    ^~~~~~~~~~~
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:199:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

      199 |         std::string string() const override
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:247:30: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

      247 |         double birth_ratio_{ 0.5 };
          |                              ^
  • include/geode/stochastic/sampling/mcmc/proposal/moves.hpp:283:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

      283 |         std::string string() const override
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/proposal_kernel.hpp:57:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

       57 |         std::string string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/proposal_kernel.hpp:65:11: warning: [cppcoreguidelines-special-member-functions]

    class 'ProposalKernel' defines a default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator

       65 |     class ProposalKernel
          |           ^
  • include/geode/stochastic/sampling/mcmc/proposal/proposal_kernel.hpp:100:9: warning: [modernize-use-nodiscard]

    function 'string' should be marked [[nodiscard]]

      100 |         std::string string() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/proposal_kernel.hpp:119:9: warning: [modernize-use-nodiscard]

    function 'compute_probabilities' should be marked [[nodiscard]]

      119 |         std::vector< double > compute_probabilities() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/sampling/mcmc/proposal/proposal_kernel.hpp:142:56: warning: [readability-identifier-length]

    parameter name 'p' is too short, expected at least 3 characters

      142 |                 probabilities.begin(), [total]( double p ) {
          |                                                        ^
  • include/geode/stochastic/sampling/mcmc/proposal/proposal_kernel.hpp:158:45: warning: [google-readability-braces-around-statements]

    statement should be inside braces

      158 |             if( !cumulative_probs_.empty() )
          |                                             ^
          |                                              {
      159 |                 cumulative_probs_.back() = 1.0; // ensure exact 1.0
          |                                                                    
  • include/geode/stochastic/spatial/spatial_domain.hpp:43:13: error: [clang-diagnostic-error]

    use of undeclared identifier 'OpenGeodeStochasticStochasticException'

       43 |             OpenGeodeStochasticStochasticException::check_exception(
          |             ^
  • include/geode/stochastic/spatial/spatial_domain.hpp:47:13: error: [clang-diagnostic-error]

    use of undeclared identifier 'OpenGeodeStochasticStochasticException'

       47 |             OpenGeodeStochasticStochasticException::check_exception(
          |             ^
  • include/geode/stochastic/spatial/spatial_domain.hpp:58:9: warning: [modernize-use-nodiscard]

    function 'box' should be marked [[nodiscard]]

       58 |         const BoundingBox< dimension > box() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/spatial_domain.hpp:58:9: warning: [readability-const-return-type]

    return type 'const BoundingBox<2U>' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness

       58 |         const BoundingBox< dimension > box() const
          |         ^~~~~
    note: this fix will not be applied because it overlaps with another fix
  • include/geode/stochastic/spatial/spatial_domain.hpp:58:9: warning: [readability-const-return-type]

    return type 'const BoundingBox' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness

       58 |         const BoundingBox< dimension > box() const
          |         ^~~~~
    note: this fix will not be applied because it overlaps with another fix
  • include/geode/stochastic/spatial/spatial_domain.hpp:63:9: warning: [modernize-use-nodiscard]

    function 'contains' should be marked [[nodiscard]]

       63 |         bool contains( const Point< dimension >& point ) const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/spatial_domain.hpp:68:9: warning: [modernize-use-nodiscard]

    function 'n_volume' should be marked [[nodiscard]]

       68 |         double n_volume() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/spatial_domain.hpp:73:9: warning: [modernize-use-nodiscard]

    function 'smallest_length' should be marked [[nodiscard]]

       73 |         double smallest_length() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/spatial_domain.hpp:78:9: warning: [modernize-use-nodiscard]

    function 'extended_contains' should be marked [[nodiscard]]

       78 |         bool extended_contains( const Point< dimension >& point ) const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/spatial_domain.hpp:83:9: warning: [modernize-use-nodiscard]

    function 'extended_n_volume' should be marked [[nodiscard]]

       83 |         double extended_n_volume() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/spatial_domain.hpp:88:9: warning: [modernize-use-nodiscard]

    function 'extended_box' should be marked [[nodiscard]]

       88 |         const BoundingBox< dimension > extended_box() const
          |         ^
          |         [[nodiscard]] 
  • include/geode/stochastic/spatial/spatial_domain.hpp:88:9: warning: [readability-const-return-type]

    return type 'const BoundingBox' is 'const'-qualified at the top level, which may reduce code readability without improving const correctness

       88 |         const BoundingBox< dimension > extended_box() const
          |         ^~~~~
  • src/geode/stochastic/sampling/direct/double_sampler.cpp:35:57: warning: [readability-identifier-length]

    parameter name 'd' is too short, expected at least 3 characters

       35 |         std::size_t operator()( const DistributionType& d ) const noexcept
          |                                                         ^
  • src/geode/stochastic/sampling/direct/double_sampler.cpp:45:18: error: [clang-diagnostic-error]

    no template named 'flat_hash_map' in namespace 'absl'

       45 |     static absl::flat_hash_map< DistributionType, // key type
          |            ~~~~~~^
  • src/geode/stochastic/sampling/direct/double_sampler.cpp:49:9: warning: [cert-err58-cpp]

    initialization of 'distribution_registry' with static storage duration may throw an exception that cannot be caught

       49 |         distribution_registry = {
          |         ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/any:189:7: note: possibly throwing constructor declared here
      189 |       any(_Tp&& __value)
          |       ^
  • src/geode/stochastic/sampling/direct/double_sampler.cpp:49:9: warning: [cppcoreguidelines-avoid-non-const-global-variables]

    variable 'distribution_registry' is non-const and globally accessible, consider making it const

       49 |         distribution_registry = {
          |         ^
  • src/geode/stochastic/sampling/direct/double_sampler.cpp:49:9: warning: [misc-use-anonymous-namespace]

    variable 'distribution_registry' declared 'static', move to anonymous namespace instead

  • src/geode/stochastic/sampling/direct/double_sampler.cpp:153:14: warning: [readability-identifier-length]

    variable name 'it' is too short, expected at least 3 characters

      153 |         auto it = distribution_registry.find( desc.distribution_type );
          |              ^
  • src/geode/stochastic/sampling/direct/double_sampler.cpp:198:27: warning: [readability-function-cognitive-complexity]

    function 'sample' has cognitive complexity of 14 (threshold 10)

      198 |     double DoubleSampler::sample(
          |                           ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:202:13: note: nesting level increased to 1
      202 |             [&engine]( auto&& d ) {
          |             ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:204:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      204 |                 if constexpr( std::is_same_v< D, UniformClosed< double > > )
          |                 ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:208:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      208 |                 if constexpr( std::is_same_v< D, UniformClosedOpen< double > > )
          |                 ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:212:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      212 |                 if constexpr( std::is_same_v< D, Gaussian > )
          |                 ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:216:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      216 |                 if constexpr( std::is_same_v< D, TruncatedGaussian > )
          |                 ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:220:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      220 |                 if constexpr( std::is_same_v< D, VonMises > )
          |                 ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:224:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      224 |                 if constexpr( std::is_same_v< D, TruncatedLogNormal > )
          |                 ^
    /__w/OpenGeode-Stochastic/OpenGeode-Stochastic/src/geode/stochastic/sampling/direct/double_sampler.cpp:228:17: note: +2, including nesting penalty of 1, nesting level increased to 2
      228 |                 if constexpr( std::is_same_v< D, TruncatedPowerLaw > )
          |                 ^
  • src/geode/stochastic/sampling/direct/double_sampler.cpp:202:31: warning: [readability-identifier-length]

    parameter name 'd' is too short, expected at least 3 characters

      202 |             [&engine]( auto&& d ) {
          |                               ^
  • src/geode/stochastic/sampling/random_engine.cpp:41:31: warning: [readability-identifier-length]

    parameter name 'x' is too short, expected at least 3 characters

       41 |     double normal_cdf( double x )
          |                               ^
  • src/geode/stochastic/sampling/random_engine.cpp:43:16: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

       43 |         return 0.5 * std::erfc( -x / std::sqrt( 2.0 ) );
          |                ^
  • src/geode/stochastic/sampling/random_engine.cpp:43:49: warning: [cppcoreguidelines-avoid-magic-numbers]

    2.0 is a magic number; consider replacing it with a named constant

       43 |         return 0.5 * std::erfc( -x / std::sqrt( 2.0 ) );
          |                                                 ^
  • src/geode/stochastic/sampling/random_engine.cpp:50:36: warning: [readability-identifier-length]

    parameter name 'p' is too short, expected at least 3 characters

       50 |     double normal_quantile( double p )
          |                                    ^
  • src/geode/stochastic/sampling/random_engine.cpp:58:29: warning: [readability-identifier-length]

    variable name 'a1' is too short, expected at least 3 characters

       58 |         static const double a1 = -3.969683028665376e+01;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:59:29: warning: [readability-identifier-length]

    variable name 'a2' is too short, expected at least 3 characters

       59 |         static const double a2 = 2.209460984245205e+02;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:60:29: warning: [readability-identifier-length]

    variable name 'a3' is too short, expected at least 3 characters

       60 |         static const double a3 = -2.759285104469687e+02;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:61:29: warning: [readability-identifier-length]

    variable name 'a4' is too short, expected at least 3 characters

       61 |         static const double a4 = 1.383577518672690e+02;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:62:29: warning: [readability-identifier-length]

    variable name 'a5' is too short, expected at least 3 characters

       62 |         static const double a5 = -3.066479806614716e+01;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:63:29: warning: [readability-identifier-length]

    variable name 'a6' is too short, expected at least 3 characters

       63 |         static const double a6 = 2.506628277459239e+00;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:65:29: warning: [readability-identifier-length]

    variable name 'b1' is too short, expected at least 3 characters

       65 |         static const double b1 = -5.447609879822406e+01;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:66:29: warning: [readability-identifier-length]

    variable name 'b2' is too short, expected at least 3 characters

       66 |         static const double b2 = 1.615858368580409e+02;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:67:29: warning: [readability-identifier-length]

    variable name 'b3' is too short, expected at least 3 characters

       67 |         static const double b3 = -1.556989798598866e+02;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:68:29: warning: [readability-identifier-length]

    variable name 'b4' is too short, expected at least 3 characters

       68 |         static const double b4 = 6.680131188771972e+01;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:69:29: warning: [readability-identifier-length]

    variable name 'b5' is too short, expected at least 3 characters

       69 |         static const double b5 = -1.328068155288572e+01;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:71:29: warning: [readability-identifier-length]

    variable name 'c1' is too short, expected at least 3 characters

       71 |         static const double c1 = -7.784894002430293e-03;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:72:29: warning: [readability-identifier-length]

    variable name 'c2' is too short, expected at least 3 characters

       72 |         static const double c2 = -3.223964580411365e-01;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:73:29: warning: [readability-identifier-length]

    variable name 'c3' is too short, expected at least 3 characters

       73 |         static const double c3 = -2.400758277161838e+00;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:74:29: warning: [readability-identifier-length]

    variable name 'c4' is too short, expected at least 3 characters

       74 |         static const double c4 = -2.549732539343734e+00;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:75:29: warning: [readability-identifier-length]

    variable name 'c5' is too short, expected at least 3 characters

       75 |         static const double c5 = 4.374664141464968e+00;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:76:29: warning: [readability-identifier-length]

    variable name 'c6' is too short, expected at least 3 characters

       76 |         static const double c6 = 2.938163982698783e+00;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:78:29: warning: [readability-identifier-length]

    variable name 'd1' is too short, expected at least 3 characters

       78 |         static const double d1 = 7.784695709041462e-03;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:79:29: warning: [readability-identifier-length]

    variable name 'd2' is too short, expected at least 3 characters

       79 |         static const double d2 = 3.224671290700398e-01;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:80:29: warning: [readability-identifier-length]

    variable name 'd3' is too short, expected at least 3 characters

       80 |         static const double d3 = 2.445134137142996e+00;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:81:29: warning: [readability-identifier-length]

    variable name 'd4' is too short, expected at least 3 characters

       81 |         static const double d4 = 3.754408661907416e+00;
          |                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:86:9: warning: [readability-isolate-declaration]

    multiple declarations in a single statement reduces readability

       86 |         double q, r;
          |         ^~~~~~~~~~~~
  • src/geode/stochastic/sampling/random_engine.cpp:86:16: warning: [cppcoreguidelines-init-variables]

    variable 'q' is not initialized

       86 |         double q, r;
          |                ^
    note: this fix will not be applied because it overlaps with another fix
  • src/geode/stochastic/sampling/random_engine.cpp:86:16: warning: [readability-identifier-length]

    variable name 'q' is too short, expected at least 3 characters

  • src/geode/stochastic/sampling/random_engine.cpp:86:19: warning: [cppcoreguidelines-init-variables]

    variable 'r' is not initialized

       86 |         double q, r;
          |                   ^
    note: this fix will not be applied because it overlaps with another fix
  • src/geode/stochastic/sampling/random_engine.cpp:86:19: warning: [readability-identifier-length]

    variable name 'r' is too short, expected at least 3 characters

  • src/geode/stochastic/sampling/random_engine.cpp:95:9: warning: [llvm-else-after-return]

    do not use 'else' after 'return'

       95 |         else if( p > phigh )
          |         ^~~~~~~~~~~~~~~~~~~~
       96 |         {
          |         ~
       97 |             // upper tail
          |             ~~~~~~~~~~~~~
       98 |             q = std::sqrt( -2 * std::log( 1 - p ) );
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       99 |             return -( ( ( ( ( c1 * q + c2 ) * q + c3 ) * q + c4 ) * q + c5 ) * q
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      100 |                        + c6 )
          |                        ~~~~~~
      101 |                    / ( ( ( ( d1 * q + d2 ) * q + d3 ) * q + d4 ) * q + 1 );
          |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      102 |         }
          |         ~
      103 |         else
          |         ~~~~
      104 |         {
          |         ~
      105 |             // central region
          |             ~~~~~~~~~~~~~~~~~
      106 |             q = p - 0.5;
          |             ~~~~~~~~~~~~
      107 |             r = q * q;
          |             ~~~~~~~~~~
      108 |             return ( ( ( ( ( a1 * r + a2 ) * r + a3 ) * r + a4 ) * r + a5 ) * r
          |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      109 |                        + a6 )
          |                        ~~~~~~
      110 |                    * q
          |                    ~~~
  • src/geode/stochastic/sampling/random_engine.cpp:99:23: warning: [readability-math-missing-parentheses]

    '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations

       99 |             return -( ( ( ( ( c1 * q + c2 ) * q + c3 ) * q + c4 ) * q + c5 ) * q
          |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    note: this fix will not be applied because it overlaps with another fix
  • src/geode/stochastic/sampling/random_engine.cpp:106:21: warning: [cppcoreguidelines-avoid-magic-numbers]

    0.5 is a magic number; consider replacing it with a named constant

      106 |             q = p - 0.5;
          |                     ^
  • src/geode/stochastic/sampling/random_engine.cpp:120:59: warning: [cppcoreguidelines-avoid-magic-numbers]

    32 is a magic number; consider replacing it with a named constant

      120 |                                                   seed >> 32 ),
          |                                                           ^
  • src/geode/stochastic/sampling/random_engine.cpp:120:59: warning: [hicpp-signed-bitwise]

    use of a signed integer operand with a binary bitwise operator

      120 |                                                   seed >> 32 ),
          |                                                        ~~ ^~
  • src/geode/stochastic/sampling/random_engine.cpp:121:45: warning: [cppcoreguidelines-avoid-magic-numbers]

    0xFFFFFFFF is a magic number; consider replacing it with a named constant

      121 |             static_cast< uint32_t >( seed & 0xFFFFFFFF ) };
          |                                             ^
  • src/geode/stochastic/sampling/random_engine.cpp:122:16: warning: [modernize-return-braced-init-list]

    avoid repeating the return type from the declaration; use a braced initializer list instead

      122 |         return std::seed_seq( seed_data.begin(), seed_data.end() );
          |                ^~~~~~~~~~~~~~                                    ~
          |                {                                                 }
  • src/geode/stochastic/sampling/random_engine.cpp:211:20: warning: [readability-identifier-naming]

    invalid case style for variable 'F_min'

      211 |             double F_min = std::isfinite( alpha ) ? normal_cdf( alpha ) : 0.0;
          |                    ^~~~~
          |                    f_min
      212 |             double F_max = std::isfinite( beta ) ? normal_cdf( beta ) : 1.0;
      213 | 
      214 |             // Clamp to avoid exact 0 or 1 (normal_quantile cannot handle them)
      215 |             F_min = std::max( F_min, geode::GLOBAL_EPSILON );
          |             ~~~~~             ~~~~~
          |             f_min             f_min
      216 |             F_max = std::min( F_max, 1.0 - geode::GLOBAL_EPSILON );
      217 | 
      218 |             OpenGeodeStochasticStochasticException::check_exception(
      219 |                 F_min < F_max, nullptr, OpenGeodeException::TYPE::data,
          |                 ~~~~~
          |                 f_min
      220 |                 "[Gaussian sampling] - truncation "
      221 |                 "range is extreme please check inputs" );
      222 | 
      223 |             // Sample uniform in [F_min, F_max]
      224 |             std::uniform_real_distribution< double > uniform( F_min, F_max );
          |                                                               ~~~~~
          |                                                               f_min
  • src/geode/stochastic/sampling/random_engine.cpp:228:31: warning: [readability-math-missing-parentheses]

    '*' has higher precedence than '+'; add parentheses to explicitly specify the order of operations

      228 |             return law.mean + law.standard_deviation * normal_quantile( u );
          |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          |                               (                                            )

Have any feedback or feature suggestions? Share it here.

@BotellaA BotellaA merged commit 19dfba4 into next May 7, 2026
28 of 30 checks passed
@BotellaA BotellaA deleted the feat/exception-library branch May 7, 2026 09:18
@BotellaA
Copy link
Copy Markdown
Member Author

BotellaA commented May 7, 2026

🎉 This PR is included in version 1.19.7-rc.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants