rigortype 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/docs/handbook/01-getting-started.md +1 -1
- data/docs/handbook/04-tuples-and-shapes.md +6 -1
- data/docs/handbook/12-lightweight-hkt.md +1 -1
- data/docs/handbook/appendix-typescript.md +28 -17
- data/docs/manual/02-cli-reference.md +10 -0
- data/docs/manual/03-configuration.md +1 -1
- data/docs/manual/04-diagnostics.md +1 -1
- data/docs/manual/10-mcp-server.md +122 -10
- data/docs/manual/plugins/rigor-activerecord.md +7 -0
- data/lib/rigor/analysis/check_rules/always_raises.rb +95 -0
- data/lib/rigor/analysis/check_rules/always_truthy_condition_collector.rb +32 -2
- data/lib/rigor/analysis/check_rules/argument_type.rb +802 -0
- data/lib/rigor/analysis/check_rules/call_facts.rb +2 -2
- data/lib/rigor/analysis/check_rules/dead_assignment_collector.rb +30 -1
- data/lib/rigor/analysis/check_rules/declaration_sourced_guard.rb +4 -5
- data/lib/rigor/analysis/check_rules/duplicate_hash_key_collector.rb +34 -0
- data/lib/rigor/analysis/check_rules/ivar_write_collector.rb +131 -4
- data/lib/rigor/analysis/check_rules/nil_receiver.rb +195 -0
- data/lib/rigor/analysis/check_rules/override_param_narrowed.rb +111 -0
- data/lib/rigor/analysis/check_rules/override_return_widened.rb +88 -0
- data/lib/rigor/analysis/check_rules/override_support.rb +246 -0
- data/lib/rigor/analysis/check_rules/override_visibility.rb +135 -0
- data/lib/rigor/analysis/check_rules/published_constant_guard.rb +75 -31
- data/lib/rigor/analysis/check_rules/raise_non_exception.rb +198 -0
- data/lib/rigor/analysis/check_rules/receiver_predicates.rb +576 -0
- data/lib/rigor/analysis/check_rules/return_in_ensure_collector.rb +52 -4
- data/lib/rigor/analysis/check_rules/return_type.rb +225 -0
- data/lib/rigor/analysis/check_rules/rigor_testing.rb +119 -0
- data/lib/rigor/analysis/check_rules/rule_ids.rb +7 -7
- data/lib/rigor/analysis/check_rules/rule_walk.rb +4 -3
- data/lib/rigor/analysis/check_rules/self_closedness_scanner.rb +2 -0
- data/lib/rigor/analysis/check_rules/self_undefined_method.rb +165 -0
- data/lib/rigor/analysis/check_rules/shadowed_rescue_collector.rb +34 -0
- data/lib/rigor/analysis/check_rules/source_arity.rb +2 -2
- data/lib/rigor/analysis/check_rules/special_global_write.rb +256 -0
- data/lib/rigor/analysis/check_rules/suppression.rb +275 -0
- data/lib/rigor/analysis/check_rules/undefined_method.rb +882 -0
- data/lib/rigor/analysis/check_rules/unreachable_branch.rb +97 -0
- data/lib/rigor/analysis/check_rules/unreachable_clause_collector.rb +42 -0
- data/lib/rigor/analysis/check_rules/unresolved_toplevel.rb +140 -0
- data/lib/rigor/analysis/check_rules/visibility_mismatch.rb +252 -0
- data/lib/rigor/analysis/check_rules/void_value_use_collector.rb +27 -0
- data/lib/rigor/analysis/check_rules/wrong_arity.rb +303 -0
- data/lib/rigor/analysis/check_rules.rb +66 -4931
- data/lib/rigor/analysis/dependency_recorder.rb +1 -1
- data/lib/rigor/analysis/dependency_source_inference/builder.rb +2 -4
- data/lib/rigor/analysis/dependency_source_inference/gem_resolver.rb +1 -2
- data/lib/rigor/analysis/dependency_source_inference/walker.rb +15 -15
- data/lib/rigor/analysis/incremental_session.rb +4 -4
- data/lib/rigor/analysis/path_expansion.rb +1 -1
- data/lib/rigor/analysis/plugin_fact_fingerprint.rb +5 -5
- data/lib/rigor/analysis/reachability/graph.rb +2 -3
- data/lib/rigor/analysis/reachability/plugin_roots.rb +2 -2
- data/lib/rigor/analysis/reachability/scan.rb +2 -2
- data/lib/rigor/analysis/rule_catalog.rb +2 -1
- data/lib/rigor/analysis/run_cache_key.rb +9 -8
- data/lib/rigor/analysis/runner/buffer_pool_dispatcher.rb +2 -2
- data/lib/rigor/analysis/runner/dependency_rows.rb +206 -0
- data/lib/rigor/analysis/runner/diagnostic_aggregator.rb +24 -22
- data/lib/rigor/analysis/runner/effect_cache_entries.rb +69 -0
- data/lib/rigor/analysis/runner/pool_coordinator.rb +6 -8
- data/lib/rigor/analysis/runner/project_pre_passes.rb +3 -5
- data/lib/rigor/analysis/runner/scope_seed.rb +144 -0
- data/lib/rigor/analysis/runner.rb +49 -296
- data/lib/rigor/analysis/template_unit_collector.rb +1 -1
- data/lib/rigor/analysis/template_units.rb +10 -10
- data/lib/rigor/analysis/worker_session.rb +7 -7
- data/lib/rigor/bleeding_edge.rb +3 -2
- data/lib/rigor/builtins/hkt_builtins.rb +17 -17
- data/lib/rigor/builtins/imported_refinements.rb +8 -16
- data/lib/rigor/builtins/regex_refinement.rb +3 -3
- data/lib/rigor/builtins/static_return_refinements.rb +143 -19
- data/lib/rigor/cache/incremental_snapshot.rb +21 -8
- data/lib/rigor/cache/rbs_descriptor.rb +18 -1
- data/lib/rigor/cli/coverage_renderer.rb +15 -1
- data/lib/rigor/cli/coverage_report.rb +19 -1
- data/lib/rigor/cli/diagnostic_formats.rb +3 -2
- data/lib/rigor/cli/docs_command.rb +5 -5
- data/lib/rigor/cli/effects_command.rb +7 -6
- data/lib/rigor/cli/fused_protection_report.rb +7 -7
- data/lib/rigor/cli/lsp_command.rb +1 -1
- data/lib/rigor/cli/mcp_command.rb +5 -2
- data/lib/rigor/cli/options.rb +4 -0
- data/lib/rigor/cli/plugins_command.rb +1 -1
- data/lib/rigor/cli/sig_gen_command.rb +1 -1
- data/lib/rigor/cli/skill_command.rb +5 -4
- data/lib/rigor/cli/triage_renderer.rb +3 -2
- data/lib/rigor/cli/unused_command.rb +4 -4
- data/lib/rigor/cli.rb +14 -0
- data/lib/rigor/configuration/coercion.rb +418 -0
- data/lib/rigor/configuration/defaults.rb +248 -0
- data/lib/rigor/configuration/dependencies.rb +1 -1
- data/lib/rigor/configuration/loader.rb +354 -0
- data/lib/rigor/configuration/severity_profile.rb +4 -4
- data/lib/rigor/configuration.rb +51 -860
- data/lib/rigor/effects/attribution.rb +1 -1
- data/lib/rigor/effects/effect_table.rb +1 -1
- data/lib/rigor/effects/identity.rb +3 -3
- data/lib/rigor/effects/local_ownership.rb +2 -2
- data/lib/rigor/effects/snapshot.rb +1 -1
- data/lib/rigor/effects/summary.rb +5 -4
- data/lib/rigor/environment/member_consistency.rb +10 -0
- data/lib/rigor/environment/rbs_loader.rb +19 -22
- data/lib/rigor/environment/reflection.rb +1 -1
- data/lib/rigor/environment/unreadable_signature.rb +21 -0
- data/lib/rigor/environment.rb +8 -8
- data/lib/rigor/flow_contribution/merger.rb +1 -0
- data/lib/rigor/hashing/xxh3.rb +1 -1
- data/lib/rigor/inference/acceptance.rb +23 -2
- data/lib/rigor/inference/alias_mutation_floor/site_collector.rb +5 -0
- data/lib/rigor/inference/alias_mutation_floor.rb +0 -5
- data/lib/rigor/inference/anonymous_meta_class.rb +2 -2
- data/lib/rigor/inference/block_call_timing.rb +6 -0
- data/lib/rigor/inference/budget_trace.rb +3 -2
- data/lib/rigor/inference/builtins/date_catalog.rb +3 -3
- data/lib/rigor/inference/builtins/method_catalog.rb +3 -3
- data/lib/rigor/inference/builtins/time_catalog.rb +3 -3
- data/lib/rigor/inference/call_ladder/literal_send.rb +98 -0
- data/lib/rigor/inference/call_ladder/overriding_def.rb +98 -0
- data/lib/rigor/inference/call_ladder/project_singleton.rb +362 -0
- data/lib/rigor/inference/call_ladder/refined.rb +212 -0
- data/lib/rigor/inference/call_ladder/top_level_def.rb +222 -0
- data/lib/rigor/inference/call_ladder/user_method.rb +247 -0
- data/lib/rigor/inference/call_ladder.rb +219 -0
- data/lib/rigor/inference/callee_write_census.rb +2 -2
- data/lib/rigor/inference/captured_locals.rb +2 -2
- data/lib/rigor/inference/clause_widening.rb +63 -1
- data/lib/rigor/inference/declaration_walk/context.rb +12 -12
- data/lib/rigor/inference/declaration_walk/rules.rb +750 -0
- data/lib/rigor/inference/declaration_walk/traversal.rb +9 -8
- data/lib/rigor/inference/declaration_walk.rb +4 -3
- data/lib/rigor/inference/def_node_resolver.rb +2 -2
- data/lib/rigor/inference/def_return_typer.rb +14 -6
- data/lib/rigor/inference/deferred_mutation.rb +120 -0
- data/lib/rigor/inference/define_method_block_self.rb +1 -1
- data/lib/rigor/inference/definer_resolution.rb +4 -4
- data/lib/rigor/inference/error_info.rb +8 -8
- data/lib/rigor/inference/expression_typer/composites.rb +348 -0
- data/lib/rigor/inference/expression_typer/per_element_assemblers.rb +233 -0
- data/lib/rigor/inference/expression_typer/writes.rb +218 -0
- data/lib/rigor/inference/expression_typer.rb +275 -1825
- data/lib/rigor/inference/external_ancestor_resolution.rb +2 -2
- data/lib/rigor/inference/fallback.rb +1 -0
- data/lib/rigor/inference/for_yield_slots.rb +126 -0
- data/lib/rigor/inference/genuine_send.rb +92 -0
- data/lib/rigor/inference/global_write_census.rb +2 -2
- data/lib/rigor/inference/hkt_body.rb +2 -0
- data/lib/rigor/inference/in_effect_refinements/walk.rb +2 -2
- data/lib/rigor/inference/index_write_widening.rb +4 -4
- data/lib/rigor/inference/indexed_narrowing.rb +1 -1
- data/lib/rigor/inference/intervening_ivar_reset.rb +46 -9
- data/lib/rigor/inference/ivar_writer_census.rb +1 -1
- data/lib/rigor/inference/loop_store_sites.rb +239 -0
- data/lib/rigor/inference/macro_block_self_type.rb +4 -3
- data/lib/rigor/inference/method_dispatcher/block_folding.rb +3 -2
- data/lib/rigor/inference/method_dispatcher/call_context.rb +84 -14
- data/lib/rigor/inference/method_dispatcher/composite_receiver.rb +144 -0
- data/lib/rigor/inference/method_dispatcher/constant_folding.rb +7 -5
- data/lib/rigor/inference/method_dispatcher/declared_constructor.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/dependency_source.rb +90 -0
- data/lib/rigor/inference/method_dispatcher/discovered_method.rb +78 -0
- data/lib/rigor/inference/method_dispatcher/file_folding.rb +2 -2
- data/lib/rigor/inference/method_dispatcher/hkt_builtin_return.rb +40 -0
- data/lib/rigor/inference/method_dispatcher/iterator_dispatch.rb +1 -6
- data/lib/rigor/inference/method_dispatcher/literal_string_folding.rb +4 -2
- data/lib/rigor/inference/method_dispatcher/match_data_folding.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/meta_introspection.rb +506 -0
- data/lib/rigor/inference/method_dispatcher/overload_selector.rb +2 -0
- data/lib/rigor/inference/method_dispatcher/plugin_contribution.rb +134 -0
- data/lib/rigor/inference/method_dispatcher/project_patched.rb +134 -0
- data/lib/rigor/inference/method_dispatcher/rbs_dispatch.rb +125 -43
- data/lib/rigor/inference/method_dispatcher/reduce_folding.rb +3 -4
- data/lib/rigor/inference/method_dispatcher/regexp_folding.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/set_folding.rb +1 -1
- data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +19 -6
- data/lib/rigor/inference/method_dispatcher/singleton_folding.rb +3 -3
- data/lib/rigor/inference/method_dispatcher/singleton_mixin_dispatch.rb +7 -4
- data/lib/rigor/inference/method_dispatcher/static_refinement.rb +106 -0
- data/lib/rigor/inference/method_dispatcher/synthesized_stub.rb +41 -0
- data/lib/rigor/inference/method_dispatcher/synthetic_method_dispatch.rb +133 -0
- data/lib/rigor/inference/method_dispatcher/universal_object_dispatch.rb +2 -1
- data/lib/rigor/inference/method_dispatcher/user_class_fallback.rb +216 -0
- data/lib/rigor/inference/method_dispatcher.rb +175 -1361
- data/lib/rigor/inference/method_parameter_binder.rb +18 -18
- data/lib/rigor/inference/module_function_state.rb +5 -4
- data/lib/rigor/inference/mutation_widening.rb +20 -7
- data/lib/rigor/inference/narrowing/case_literals.rb +58 -0
- data/lib/rigor/inference/narrowing/class_dispatch.rb +302 -0
- data/lib/rigor/inference/narrowing/complements.rb +322 -0
- data/lib/rigor/inference/narrowing/presence_predicates.rb +205 -0
- data/lib/rigor/inference/narrowing/regex_match.rb +499 -0
- data/lib/rigor/inference/narrowing.rb +86 -1269
- data/lib/rigor/inference/object_mixins.rb +2 -2
- data/lib/rigor/inference/opaque_mutation.rb +214 -0
- data/lib/rigor/inference/optimistic_origin.rb +52 -14
- data/lib/rigor/inference/parameter_inference_collector.rb +1 -1
- data/lib/rigor/inference/pre_eval_constants.rb +11 -9
- data/lib/rigor/inference/precision_scanner.rb +27 -2
- data/lib/rigor/inference/project_patched_methods.rb +3 -3
- data/lib/rigor/inference/range_constant.rb +3 -3
- data/lib/rigor/inference/rbs_type_translator.rb +2 -2
- data/lib/rigor/inference/refine_self.rb +8 -7
- data/lib/rigor/inference/refined_dispatch.rb +2 -2
- data/lib/rigor/inference/return_barrier.rb +24 -9
- data/lib/rigor/inference/scope_indexer/alias_def_nodes.rb +311 -0
- data/lib/rigor/inference/scope_indexer/census_scope.rb +47 -0
- data/lib/rigor/inference/scope_indexer/certainty.rb +2 -2
- data/lib/rigor/inference/scope_indexer/class_cvar_census.rb +282 -0
- data/lib/rigor/inference/scope_indexer/class_cvars_collector.rb +12 -5
- data/lib/rigor/inference/scope_indexer/class_declarations.rb +228 -0
- data/lib/rigor/inference/scope_indexer/class_ivar_index.rb +2028 -0
- data/lib/rigor/inference/scope_indexer/constant_ivar_value.rb +4 -3
- data/lib/rigor/inference/scope_indexer/constant_tables.rb +844 -0
- data/lib/rigor/inference/scope_indexer/cvar_hierarchy.rb +159 -0
- data/lib/rigor/inference/scope_indexer/declaration_artifacts.rb +219 -0
- data/lib/rigor/inference/scope_indexer/declaration_signature.rb +212 -0
- data/lib/rigor/inference/scope_indexer/def_nestings_collector.rb +2 -2
- data/lib/rigor/inference/scope_indexer/factory_call_resolver.rb +53 -0
- data/lib/rigor/inference/scope_indexer/literal_receiver_mutations.rb +266 -0
- data/lib/rigor/inference/scope_indexer/member_layouts_collector.rb +8 -7
- data/lib/rigor/inference/scope_indexer/mixin_accumulator.rb +1 -1
- data/lib/rigor/inference/scope_indexer/mixin_effects.rb +470 -0
- data/lib/rigor/inference/scope_indexer/mixin_tables.rb +388 -0
- data/lib/rigor/inference/scope_indexer/mutated_carrier_widening.rb +163 -0
- data/lib/rigor/inference/scope_indexer/mutated_element_census.rb +211 -0
- data/lib/rigor/inference/scope_indexer/node_propagation.rb +520 -0
- data/lib/rigor/inference/scope_indexer/program_globals.rb +154 -0
- data/lib/rigor/inference/scope_indexer/published_constant_cvars.rb +146 -0
- data/lib/rigor/inference/scope_indexer/published_constant_ivars.rb +181 -0
- data/lib/rigor/inference/scope_indexer/shared_walk_tables.rb +823 -0
- data/lib/rigor/inference/scope_indexer/singleton_class_sources.rb +85 -0
- data/lib/rigor/inference/scope_indexer/superclasses_collector.rb +5 -5
- data/lib/rigor/inference/scope_indexer.rb +2657 -9558
- data/lib/rigor/inference/self_call_ivar_writes.rb +22 -3
- data/lib/rigor/inference/set_mutation.rb +2 -2
- data/lib/rigor/inference/singleton_hook_definers.rb +185 -0
- data/lib/rigor/inference/statement_evaluator/def_arguments_and_assertions.rb +365 -0
- data/lib/rigor/inference/statement_evaluator/pattern_bindings.rb +581 -0
- data/lib/rigor/inference/statement_evaluator.rb +201 -1008
- data/lib/rigor/inference/synthetic_method_scanner.rb +0 -3
- data/lib/rigor/language_server/completion_provider.rb +8 -8
- data/lib/rigor/language_server/diagnostic_publisher.rb +6 -7
- data/lib/rigor/language_server/document_symbol_provider.rb +4 -6
- data/lib/rigor/language_server/folding_range_provider.rb +3 -3
- data/lib/rigor/language_server/hover_provider.rb +2 -2
- data/lib/rigor/language_server/loop.rb +2 -2
- data/lib/rigor/language_server/server.rb +3 -2
- data/lib/rigor/language_server/signature_help_provider.rb +7 -9
- data/lib/rigor/lens/document.rb +10 -1
- data/lib/rigor/lens/file_reader.rb +2 -1
- data/lib/rigor/mcp/loop.rb +48 -6
- data/lib/rigor/mcp/server.rb +248 -23
- data/lib/rigor/mcp/skill_catalog.rb +157 -0
- data/lib/rigor/plugin/base.rb +22 -4
- data/lib/rigor/plugin/effect_attribution.rb +1 -1
- data/lib/rigor/plugin/inflector.rb +2 -2
- data/lib/rigor/plugin/io_boundary.rb +1 -1
- data/lib/rigor/plugin/loader.rb +4 -4
- data/lib/rigor/plugin/macro/heredoc_template.rb +4 -3
- data/lib/rigor/plugin/optimistic_return.rb +20 -0
- data/lib/rigor/plugin/registry.rb +2 -2
- data/lib/rigor/plugin/template_unit.rb +4 -2
- data/lib/rigor/plugin/trust_policy.rb +2 -1
- data/lib/rigor/plugin.rb +1 -1
- data/lib/rigor/protection/mutator.rb +8 -9
- data/lib/rigor/rbs_extended/reporter.rb +2 -2
- data/lib/rigor/rbs_extended.rb +2 -2
- data/lib/rigor/reflection/constant_ancestors.rb +1 -1
- data/lib/rigor/reflection/project_method.rb +2 -2
- data/lib/rigor/reflection.rb +4 -4
- data/lib/rigor/scope/discovery_index.rb +15 -10
- data/lib/rigor/scope/resolution_chain.rb +29 -6
- data/lib/rigor/scope.rb +89 -32
- data/lib/rigor/sig_gen/generator.rb +5 -4
- data/lib/rigor/sig_gen/renderer.rb +3 -3
- data/lib/rigor/sig_gen/writer.rb +8 -6
- data/lib/rigor/source/parameter_envelope.rb +1 -1
- data/lib/rigor/triage/catalogue.rb +4 -4
- data/lib/rigor/type/combinator.rb +2 -2
- data/lib/rigor/type/data_instance.rb +2 -2
- data/lib/rigor/type/struct_instance.rb +3 -3
- data/lib/rigor/type_node/generic.rb +2 -1
- data/lib/rigor/type_of_memo.rb +2 -1
- data/lib/rigor/typing_state.rb +3 -2
- data/lib/rigor/version.rb +1 -1
- data/plugins/rigor-actioncable/lib/rigor/plugin/actioncable/analyzer.rb +2 -2
- data/plugins/rigor-actioncable/lib/rigor/plugin/actioncable/channel_discoverer.rb +1 -1
- data/plugins/rigor-actionmailer/lib/rigor/plugin/actionmailer/mailer_discoverer.rb +4 -4
- data/plugins/rigor-actionmailer/lib/rigor/plugin/actionmailer.rb +1 -1
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/controller_discoverer.rb +4 -3
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/effects.rb +7 -5
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/erb_compiler.rb +4 -2
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/render_locals.rb +1 -1
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/view_assigns.rb +3 -2
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack.rb +7 -7
- data/plugins/rigor-activejob/lib/rigor/plugin/activejob/job_discoverer.rb +1 -1
- data/plugins/rigor-activejob/lib/rigor/plugin/activejob.rb +2 -2
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/model_discoverer.rb +9 -8
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/model_index.rb +3 -2
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/schema_parser.rb +15 -7
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/schema_table.rb +10 -3
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/structure_sql_parser.rb +12 -1
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord.rb +20 -5
- data/plugins/rigor-activestorage/lib/rigor/plugin/activestorage/attachment_discoverer.rb +1 -1
- data/plugins/rigor-activestorage/lib/rigor/plugin/activestorage.rb +3 -2
- data/plugins/rigor-activesupport-core-ext/lib/rigor/plugin/activesupport_core_ext/effects.rb +1 -1
- data/plugins/rigor-activesupport-core-ext/lib/rigor/plugin/activesupport_core_ext.rb +8 -7
- data/plugins/rigor-dry-schema/lib/rigor/plugin/dry_schema.rb +1 -1
- data/plugins/rigor-dry-types/lib/rigor/plugin/dry_types/alias_scanner.rb +1 -1
- data/plugins/rigor-dry-types/lib/rigor/plugin/dry_types.rb +6 -7
- data/plugins/rigor-factorybot/lib/rigor/plugin/factorybot/factory_discoverer.rb +3 -2
- data/plugins/rigor-graphql/lib/rigor/plugin/graphql/type_scanner.rb +4 -3
- data/plugins/rigor-hanami/lib/rigor/plugin/hanami.rb +4 -2
- data/plugins/rigor-minitest/lib/rigor/plugin/minitest.rb +1 -1
- data/plugins/rigor-pundit/lib/rigor/plugin/pundit.rb +1 -1
- data/plugins/rigor-rails-i18n/lib/rigor/plugin/rails_i18n/analyzer.rb +5 -3
- data/plugins/rigor-rails-i18n/lib/rigor/plugin/rails_i18n.rb +1 -1
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/devise_routes.rb +4 -5
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/doorkeeper_routes.rb +2 -2
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/helper_discoverer.rb +5 -4
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/helper_table.rb +3 -2
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/routes_parser.rb +30 -31
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes.rb +13 -15
- data/plugins/rigor-rbnacl/lib/rigor/plugin/rbnacl.rb +1 -1
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/let_scope_index.rb +4 -3
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/matcher_analyzer.rb +16 -13
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/scope_walker.rb +3 -2
- data/plugins/rigor-shoulda-matchers/lib/rigor/plugin/shoulda_matchers/analyzer.rb +6 -6
- data/plugins/rigor-sidekiq/lib/rigor/plugin/sidekiq/analyzer.rb +3 -3
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/assertion_recognizer.rb +2 -2
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/catalog.rb +3 -2
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/catalog_walker.rb +6 -5
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/sig_parser.rb +2 -2
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/sigil_detector.rb +4 -5
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/type_translator.rb +1 -1
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet.rb +3 -4
- data/sig/rigor/analysis/check_rules/suppression.rbs +9 -0
- data/sig/rigor/analysis/dependency_recorder.rbs +9 -0
- data/sig/rigor/inference.rbs +275 -11
- data/sig/rigor/plugin/base.rbs +14 -5
- data/sig/rigor/plugin/optimistic_return.rbs +16 -0
- data/sig/rigor/scope.rbs +7 -1
- data/sig/rigor/source.rbs +4 -0
- data/skills/rigor-mcp-setup/SKILL.md +20 -6
- data/skills/rigor-plugin-review/SKILL.md +3 -3
- data/skills/rigor-type-oracle/references/01-oracle-commands.md +1 -1
- metadata +90 -3
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "dependencies"
|
|
4
|
+
|
|
5
|
+
module Rigor
|
|
6
|
+
class Configuration
|
|
7
|
+
# `Configuration`'s defaults and the constants that describe its keys, kept apart from the class that reads
|
|
8
|
+
# them. The class reaches each one as `Configuration::NAME`: `configuration.rb` binds every public constant
|
|
9
|
+
# here to the same object under that name, so `Configuration::DEFAULTS` stays the one defaults table for
|
|
10
|
+
# {Configuration}, {Configuration::Coercion} and {Configuration::Loader} alike.
|
|
11
|
+
module Defaults
|
|
12
|
+
# File-discovery order for `Configuration.load(nil)`.
|
|
13
|
+
#
|
|
14
|
+
# The first file present is loaded; the others are NOT implicitly merged. To extend a base config
|
|
15
|
+
# explicitly the winning file MUST list the base via `includes:`.
|
|
16
|
+
#
|
|
17
|
+
# `.rigor.yml` is a developer-local override (typically gitignored); `.rigor.dist.yml` is the project
|
|
18
|
+
# default (committed to the repo). When both are present the developer's local override wins outright —
|
|
19
|
+
# there is no implicit auto-merge.
|
|
20
|
+
DISCOVERY_ORDER = %w[.rigor.yml .rigor.dist.yml].freeze
|
|
21
|
+
# Back-compat alias. Keep here so external callers that read `Configuration::DEFAULT_PATH` for help text /
|
|
22
|
+
# fixture paths still work; the discovery list is the canonical source.
|
|
23
|
+
DEFAULT_PATH = DISCOVERY_ORDER.first
|
|
24
|
+
|
|
25
|
+
# ADR-103 WD7 — where `rigor effects update` writes when `effects.snapshot.path:` is unset. Public
|
|
26
|
+
# because the schema pins its own `default` against it.
|
|
27
|
+
DEFAULT_EFFECTS_SNAPSHOT_PATH = ".rigor-effects.yml"
|
|
28
|
+
|
|
29
|
+
# Built-in exclusion patterns appended to `exclude:` so vendored dependencies, Bundler artefacts, and
|
|
30
|
+
# JavaScript node_modules are never analysed by accident when a directory glob expands. Users cannot
|
|
31
|
+
# disable these defaults; the trade-off is that analysing any of these paths is essentially never what
|
|
32
|
+
# the user wants (they're build outputs / external dependencies, not source).
|
|
33
|
+
#
|
|
34
|
+
# We deliberately keep this list narrow. `tmp/` and similar directories vary across project layouts
|
|
35
|
+
# (Rails has `tmp/`, libraries usually don't); user-supplied `exclude:` entries in `.rigor.yml` cover the
|
|
36
|
+
# project-specific cases.
|
|
37
|
+
BUILTIN_EXCLUDES = %w[
|
|
38
|
+
**/vendor/bundle/**
|
|
39
|
+
**/.bundle/**
|
|
40
|
+
**/node_modules/**
|
|
41
|
+
].freeze
|
|
42
|
+
|
|
43
|
+
# The conventional test roots `test_paths: nil` auto-detects, in this order.
|
|
44
|
+
CONVENTIONAL_TEST_PATHS = %w[spec test].freeze
|
|
45
|
+
|
|
46
|
+
DEFAULTS = {
|
|
47
|
+
"target_ruby" => "4.0",
|
|
48
|
+
"paths" => ["lib"],
|
|
49
|
+
"exclude" => [],
|
|
50
|
+
"plugins" => [],
|
|
51
|
+
"disable" => [],
|
|
52
|
+
"libraries" => [],
|
|
53
|
+
"signature_paths" => nil,
|
|
54
|
+
# Issue #2517 — a core signature directory loaded IN PLACE OF the `rbs` gem's `core/` (a provider such as
|
|
55
|
+
# rbs-shifter writes one for an older CRuby). `nil` (the default) loads the gem's core. Unlike
|
|
56
|
+
# `signature_paths:`, which only adds, this replaces: the default core is not loaded beside it.
|
|
57
|
+
"core_root" => nil,
|
|
58
|
+
# The project's test roots: the directories (or files) holding its tests. `nil` (the default) auto-detects
|
|
59
|
+
# whichever of `spec/` and `test/` exist, the same way `signature_paths: nil` auto-detects `sig/`; `[]`
|
|
60
|
+
# declares that the project has none. `rigor sig-gen --params=observed` harvests call-site observations
|
|
61
|
+
# from them when no `--observe=PATH` is given. See {Configuration#resolved_test_paths}.
|
|
62
|
+
"test_paths" => nil,
|
|
63
|
+
# ADR-112 WD4 — `rigor sig-gen` settings. `inline_declared:` decides what happens to a method the inline
|
|
64
|
+
# reader (`rigor-rbs-inline`) already declares from `# @rbs` / `#:`. `write` (the default) copies the
|
|
65
|
+
# inline declaration into `sig/`, so the generated signature is the complete contract a gem ships;
|
|
66
|
+
# `skip` leaves every member that reader declares out of `sig/`, for a project whose Steep reads the
|
|
67
|
+
# same annotations (`inline: true` beside `signature "sig"`), where the copy would be a second
|
|
68
|
+
# declaration of one method (`DuplicatedMethodDefinition`). See {Configuration#sig_gen_inline_declared}.
|
|
69
|
+
"sig_gen" => {
|
|
70
|
+
"inline_declared" => "write"
|
|
71
|
+
},
|
|
72
|
+
# ADR-17 — project-side monkey-patch pre-evaluation. Empty by default; users opt in by listing explicit
|
|
73
|
+
# files (or globs) that the analyzer walks before per-file inference so patched-method declarations are
|
|
74
|
+
# visible across the project (e.g. `lib/core_ext/string_extensions.rb`). A missing literal path surfaces
|
|
75
|
+
# as `pre-eval.file-not-found`.
|
|
76
|
+
"pre_eval" => [],
|
|
77
|
+
# ADR-22 — baseline file path. nil (default) means no baseline is loaded; the `false` literal is
|
|
78
|
+
# treated as the explicit-disable form for `.rigor.yml`-side override of an upstream `.rigor.dist.yml`
|
|
79
|
+
# `baseline:` declaration. The presence of `.rigor-baseline.yml` on disk alone does NOT activate
|
|
80
|
+
# filtering — the path must be named here (WD2 (b) of ADR-22).
|
|
81
|
+
"baseline" => nil,
|
|
82
|
+
"fold_platform_specific_paths" => false,
|
|
83
|
+
# ADR-67 WD6a — opt-in call-site parameter type inference on the `check` walk. When `true`, `rigor
|
|
84
|
+
# check` runs the {Inference::ParameterInferenceCollector} as a one-round pre-pass into the discovery
|
|
85
|
+
# seed, so an undeclared `def` / `initialize` / setter parameter is typed to the union of its resolved
|
|
86
|
+
# call-site argument types (precision-additive only — the in-body negative rules decline on the inferred
|
|
87
|
+
# lower bound, WD6b). `false` (the default, resolved off by every severity profile) keeps the table empty
|
|
88
|
+
# and the run byte-identical to today. Composes with `--incremental` (the WD6c mutual exclusion is
|
|
89
|
+
# lifted): the incremental session recomputes the table each run and diffs it against its snapshot,
|
|
90
|
+
# re-checking any callee whose seeds moved.
|
|
91
|
+
"parameter_inference" => false,
|
|
92
|
+
# ADR-103 WD13 — the effect-labels opt-in, and the ONLY thing that turns effect collection on
|
|
93
|
+
# besides running `rigor effects`. **Presence is the switch**: `effects: {}` — or the bare key, which
|
|
94
|
+
# YAML parses as nil — enables collection with every sub-key at its default, because an annotation in
|
|
95
|
+
# a project's RBS must never create a project-wide cost cliff (that case earns a `:info` residual
|
|
96
|
+
# instead, #384).
|
|
97
|
+
#
|
|
98
|
+
# The default is `false` rather than `nil` precisely because presence is the switch and
|
|
99
|
+
# `Configuration.load` merges these DEFAULTS UNDER the loaded file: a `nil` default would be
|
|
100
|
+
# indistinguishable from a user's bare `effects:` key and would turn collection on for every project
|
|
101
|
+
# in existence. `false` is also the explicit-disable form a `.rigor.yml` uses to override an upstream
|
|
102
|
+
# `.rigor.dist.yml`'s `effects:` block — the same shape `baseline:` uses.
|
|
103
|
+
#
|
|
104
|
+
# The sub-keys are declared in `schemas/rigor-config.schema.json`. `check` (#383,
|
|
105
|
+
# {Configuration#effects_check?}), `snapshot.{path,reach,gate}`, `tolerated` (#381) and the policy trio
|
|
106
|
+
# `labels` / `attribution` / `envelopes` (#385, {Configuration#coerce_effects_policy}) are read; `views` lands
|
|
107
|
+
# with the slice that implements it (#390). Reserving a sub-key's shape before a reader exists is
|
|
108
|
+
# the same discipline the schema applies to a sibling implementation's namespace (ADR-99).
|
|
109
|
+
"effects" => false,
|
|
110
|
+
"cache" => {
|
|
111
|
+
"path" => ".rigor/cache",
|
|
112
|
+
# LRU eviction cap in bytes (ADR-54 WD3). The least-recently-used entries are removed at the end of a
|
|
113
|
+
# run when the total exceeds this limit. The 256 MB default exists to reap orphans — entries whose
|
|
114
|
+
# content key nothing references any more (an rbs gem bump, a signature change) and that no run
|
|
115
|
+
# would otherwise ever delete; a full active per-project set is ~2 MB, so the cap never touches live
|
|
116
|
+
# entries. Set explicitly to `null` to disable eviction (pre-WD3 behaviour: the cache grows until
|
|
117
|
+
# `--clear-cache`).
|
|
118
|
+
"max_bytes" => 268_435_456,
|
|
119
|
+
# ADR-87 WD1 — file-freshness validation strategy. `"stat"` validates a recorded file
|
|
120
|
+
# dependency by stat-ing it first and re-hashing only when the `(size, mtime_ns, ctime_ns, inode)`
|
|
121
|
+
# tuple moved (or the racy window fires), so an unchanged monorepo hashes ~0 bytes on a warm run.
|
|
122
|
+
# `"digest"` restores the pre-ADR-87 behaviour of SHA-256'ing every recorded file on every run — the
|
|
123
|
+
# per-run escape hatch is the `RIGOR_STRICT_VALIDATION=1` env var, which wins over this setting.
|
|
124
|
+
# `"auto"` (default, #190) resolves per environment: `"digest"` when {CiDetector} recognises a CI
|
|
125
|
+
# provider — a fresh checkout regenerates every stat tuple, so the stat tier can never short-circuit
|
|
126
|
+
# there and stat-signature glob slots would recompute on every run — and `"stat"` everywhere else.
|
|
127
|
+
# A self-hosted runner with a persistent workspace opts back into the stat floor with an explicit
|
|
128
|
+
# `"stat"` (or `RIGOR_CI_DETECT=0`).
|
|
129
|
+
"validation" => "auto"
|
|
130
|
+
},
|
|
131
|
+
# ADR-39 slice 5 / #911 — the plugin-isolation strategy for target-library invocation. `nil` (the
|
|
132
|
+
# default) names nothing, leaving the choice to `RIGOR_PLUGIN_ISOLATION` and then to
|
|
133
|
+
# `Plugin::Isolation::DEFAULT`. The environment variable WINS over this key: it is the
|
|
134
|
+
# one-invocation operator override (`RIGOR_PLUGIN_ISOLATION=none rigor check` on a platform where
|
|
135
|
+
# the fork worker misbehaves), and an override a committed file can veto is not an override.
|
|
136
|
+
# Only `none` and `process` are selectable here — `ruby_box` needs `RUBY_BOX=1` set before Ruby
|
|
137
|
+
# boots, which is what `exe/rigor` re-execs for, and the launcher deliberately does not parse YAML
|
|
138
|
+
# before that re-exec (ADR-87 / ADR-104 boot-slim), so naming it here raises instead of silently
|
|
139
|
+
# resolving to a different strategy.
|
|
140
|
+
"plugins_isolation" => nil,
|
|
141
|
+
"plugins_io" => {
|
|
142
|
+
"network" => "disabled",
|
|
143
|
+
"allowed_paths" => [],
|
|
144
|
+
"allowed_url_hosts" => []
|
|
145
|
+
},
|
|
146
|
+
"severity_profile" => "balanced",
|
|
147
|
+
"severity_overrides" => {},
|
|
148
|
+
# ADR-50 § WD2 — bleeding-edge overlay opt-in. Selects which of the *next major's* queued changes
|
|
149
|
+
# ({Rigor::BleedingEdge}) this project adopts early. Orthogonal to `severity_profile:`. Accepts `false`
|
|
150
|
+
# (default — adopt none), `true` (adopt the whole overlay), a list of feature ids (adopt only those),
|
|
151
|
+
# or `{ all: true, except: [ids] }` (adopt all but the named). A queued change is either a severity
|
|
152
|
+
# promotion (composed by {SeverityProfile.resolve}) or a behaviour switch (read at its call site
|
|
153
|
+
# through {Configuration#bleeding_edge_active?}); `bleeding_edge:` selects both kinds the same way.
|
|
154
|
+
"bleeding_edge" => false,
|
|
155
|
+
"dependencies" => {
|
|
156
|
+
"source_inference" => [],
|
|
157
|
+
"budget_per_gem" => Configuration::Dependencies::DEFAULT_BUDGET_PER_GEM
|
|
158
|
+
},
|
|
159
|
+
"parallel" => {
|
|
160
|
+
# ADR-15 Phase 4c — when greater than zero, `rigor check` dispatches per-file analysis across N
|
|
161
|
+
# Ractor workers built around {Rigor::Analysis::WorkerSession}. `0` (default) keeps the sequential
|
|
162
|
+
# coordinator path bit-for-bit unchanged. The CLI's `--workers=N` flag and the `RIGOR_RACTOR_WORKERS`
|
|
163
|
+
# env var both override this setting; precedence is CLI > env > config > 0.
|
|
164
|
+
"workers" => 0
|
|
165
|
+
},
|
|
166
|
+
"bundler" => {
|
|
167
|
+
# Open item O4 — target-project Bundler awareness. When `bundle_path:` is set (or auto-detected),
|
|
168
|
+
# Rigor walks `<bundle_path>/ruby/*/gems/*/sig/` (RubyGems-sourced gems) and
|
|
169
|
+
# `<bundle_path>/ruby/*/bundler/gems/*/sig/` (`git:`-sourced gems) and adds each gem-shipped sig
|
|
170
|
+
# directory to `signature_paths:`. A `path:`-sourced gem is not under either — Bundler uses the
|
|
171
|
+
# `path:` directory in place rather than copying it into the bundle root — so add its `sig/` directly
|
|
172
|
+
# via `signature_paths:` instead. With O7's failure-memo in place, conflicts (a vendored sig already
|
|
173
|
+
# declares the same constant) degrade gracefully to "no RBS env" with a single-line warning naming
|
|
174
|
+
# the offending file, rather than hanging.
|
|
175
|
+
#
|
|
176
|
+
# `bundle_path:` (String, optional): explicit path to the bundler install root (e.g.,
|
|
177
|
+
# "vendor/bundle" or an absolute path). Resolved relative to the project root (`paths:`'s base) when
|
|
178
|
+
# relative.
|
|
179
|
+
#
|
|
180
|
+
# `auto_detect:` (Boolean, default true): when no explicit `bundle_path:` is set, try
|
|
181
|
+
# `.bundle/config`'s `BUNDLE_PATH:` first; fall back to `vendor/bundle/` under the project root if it
|
|
182
|
+
# exists. When neither is found, no extra sigs are added — the analyzer sees only rigor's vendored
|
|
183
|
+
# RBS and the user's `signature_paths:`.
|
|
184
|
+
#
|
|
185
|
+
# O4 Layer 3 keys:
|
|
186
|
+
#
|
|
187
|
+
# `lockfile:` (String, optional): explicit path to a `Gemfile.lock`. Resolved relative to the
|
|
188
|
+
# project root when relative. When set (or auto-detected via the `auto_detect:` flag below) Rigor
|
|
189
|
+
# parses the lockfile and uses it to FILTER the bundle-discovered `sig/` directories: only gems whose
|
|
190
|
+
# `(name, version, platform)` matches a lockfile entry are admitted to `signature_paths:`. Stale or
|
|
191
|
+
# out-of-band gems sitting in the bundle install tree are silently dropped.
|
|
192
|
+
#
|
|
193
|
+
# `auto_detect:` (Boolean, also gates the lockfile search): when true and `lockfile:` is nil, look
|
|
194
|
+
# for `<project_root>/Gemfile.lock`.
|
|
195
|
+
"bundle_path" => nil,
|
|
196
|
+
"auto_detect" => true,
|
|
197
|
+
"lockfile" => nil
|
|
198
|
+
},
|
|
199
|
+
"rbs_collection" => {
|
|
200
|
+
# Open item O4 Layer 3 slice 2 — `rbs collection install` awareness. When the target project has been
|
|
201
|
+
# set up with `rbs collection install`, the resulting `rbs_collection.lock.yaml` carries the resolved
|
|
202
|
+
# (gem, version, source) triples and `.gem_rbs_collection/` holds the downloaded `.rbs` files. Rigor
|
|
203
|
+
# parses the lockfile and auto-feeds each gem's `<collection_root>/<name>/<version>/` directory into
|
|
204
|
+
# `RbsLoader`'s `signature_paths:`. Sources of type `stdlib` install no directory; issue #2946 — they
|
|
205
|
+
# load as RBS libraries, appended to `DEFAULT_LIBRARIES + libraries:`, as the `rbs` CLI loads them.
|
|
206
|
+
#
|
|
207
|
+
# `lockfile:` (String, optional): explicit path to `rbs_collection.lock.yaml`. Resolved relative to
|
|
208
|
+
# the project root when relative.
|
|
209
|
+
#
|
|
210
|
+
# `auto_detect:` (Boolean, default true): when no explicit `lockfile:` is set, look for
|
|
211
|
+
# `<project_root>/rbs_collection.lock.yaml`.
|
|
212
|
+
"lockfile" => nil,
|
|
213
|
+
"auto_detect" => true
|
|
214
|
+
}
|
|
215
|
+
}.freeze
|
|
216
|
+
Ractor.make_shareable(DEFAULTS)
|
|
217
|
+
|
|
218
|
+
# The isolation strategies a `.rigor.yml` may name (ADR-39 slice 5 / #911). `ruby_box` is
|
|
219
|
+
# deliberately absent: it is a boot-time decision the config file is read too late to make.
|
|
220
|
+
CONFIGURABLE_PLUGIN_ISOLATIONS = %w[none process].freeze
|
|
221
|
+
|
|
222
|
+
# Top-level keys this implementation DECLARES but never reads — see `docs/internal-spec/config.md`
|
|
223
|
+
# § "Reserved namespaces" and ADR-99.
|
|
224
|
+
#
|
|
225
|
+
# A sibling implementation (`rigor-rs`, which vendors our schema rather than keeping its own)
|
|
226
|
+
# groups keys for concepts we do not have under its own namespace, so one `.rigor.yml` feeds both.
|
|
227
|
+
# Such a key answers to the SCHEMA TIER ONLY: it is type-checked where it is written, and here it
|
|
228
|
+
# is never read, never validated, never coerced, and never an error however invalid its value.
|
|
229
|
+
#
|
|
230
|
+
# That is already the emergent behaviour — `#initialize` fetches each key it owns and never
|
|
231
|
+
# enumerates the rest — so this constant does not gate the runtime. It exists to make the
|
|
232
|
+
# reservation FINDABLE by the next person adding config validation (#166 is exactly that), and to
|
|
233
|
+
# give the schema-parity spec something to key on: a reserved namespace is by definition absent
|
|
234
|
+
# from DEFAULTS, so the DEFAULTS-driven schema gate can never see it.
|
|
235
|
+
RESERVED_NAMESPACES = %w[rigor_rs].freeze
|
|
236
|
+
|
|
237
|
+
# Every top-level key a conforming `.rigor.yml` may carry: the keys this implementation owns, plus
|
|
238
|
+
# `includes:`, plus the namespaces reserved for another implementation. Anything else is recorded in
|
|
239
|
+
# {Configuration#unknown_keys} and warned about by {ConfigAudit}, and is also the did-you-mean dictionary for a
|
|
240
|
+
# near-miss.
|
|
241
|
+
#
|
|
242
|
+
# `includes:` is a load-time directive — {load_with_includes} `delete`s it while merging, so it never
|
|
243
|
+
# reaches `#initialize` and could not be seen as unknown regardless. It is listed because a user
|
|
244
|
+
# legitimately writes it, so a typo like `include:` must be able to suggest it.
|
|
245
|
+
KNOWN_KEYS = (DEFAULTS.keys + %w[includes] + RESERVED_NAMESPACES).freeze
|
|
246
|
+
end
|
|
247
|
+
end
|
|
248
|
+
end
|
|
@@ -96,7 +96,7 @@ module Rigor
|
|
|
96
96
|
|
|
97
97
|
class << self
|
|
98
98
|
# ADR-10 § "config-conflict diagnostic" — merges a potentially-duplicated entry list (the `includes:`
|
|
99
|
-
# chain produces concatenated arrays via `Configuration.deep_merge`'s special-case for
|
|
99
|
+
# chain produces concatenated arrays via `Configuration::Loader.deep_merge`'s special-case for
|
|
100
100
|
# `dependencies.source_inference`) into a single canonical entry per gem name. The merge rules:
|
|
101
101
|
#
|
|
102
102
|
# - Same gem, same all fields → idempotent collapse (no warning).
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "yaml"
|
|
4
|
+
|
|
5
|
+
require_relative "../config_path"
|
|
6
|
+
require_relative "../configuration_error"
|
|
7
|
+
require_relative "defaults"
|
|
8
|
+
|
|
9
|
+
module Rigor
|
|
10
|
+
class Configuration
|
|
11
|
+
# The class-level loader behind `Configuration.load`: file discovery, `includes:` resolution, the per-file path
|
|
12
|
+
# resolution and the YAML read. `Configuration` keeps `load`, `discover`, `load_with_includes`,
|
|
13
|
+
# `autowire_default_plugins`, `rbs_inline_plugin_entry?` and `rbs_inline_library_resolvable?` as one-line
|
|
14
|
+
# delegates to the methods of the same name here; the rest are this module's own.
|
|
15
|
+
#
|
|
16
|
+
# It calls back into `Configuration` for exactly four things: `Configuration.new` and the two `with_*` siblings
|
|
17
|
+
# {load} chains on the result, and `Configuration.rbs_inline_library_resolvable?`, which the auto-wire gate asks
|
|
18
|
+
# through `Configuration` so a spec that stubs the probe there reaches it.
|
|
19
|
+
module Loader
|
|
20
|
+
# Top-level keys whose values are file/directory paths that MUST be resolved relative to the config
|
|
21
|
+
# file's directory. `exclude:` is intentionally NOT in this list — its entries are glob patterns
|
|
22
|
+
# (`**/vendor/**`), not paths.
|
|
23
|
+
PATH_KEYS = %w[paths signature_paths test_paths pre_eval].freeze
|
|
24
|
+
private_constant :PATH_KEYS
|
|
25
|
+
|
|
26
|
+
# The single-path sibling of {PATH_KEYS}: resolved the same way, but kept a String rather than wrapped in an
|
|
27
|
+
# Array.
|
|
28
|
+
SCALAR_PATH_KEYS = %w[core_root].freeze
|
|
29
|
+
private_constant :SCALAR_PATH_KEYS
|
|
30
|
+
|
|
31
|
+
# ADR-93 WD2 — the one bundled plugin default-wired without a `plugins:` entry. `rigor-rbs-inline` is the
|
|
32
|
+
# gem; `rbs-inline` is its manifest id (the loader raises on a duplicate id, so both forms count as
|
|
33
|
+
# "already listed").
|
|
34
|
+
AUTOWIRED_RBS_INLINE_GEM = "rigor-rbs-inline"
|
|
35
|
+
AUTOWIRED_RBS_INLINE_ID = "rbs-inline"
|
|
36
|
+
|
|
37
|
+
# Loads a configuration file.
|
|
38
|
+
#
|
|
39
|
+
# `path == nil` triggers auto-discovery against {DISCOVERY_ORDER}. The first present file in that list is
|
|
40
|
+
# loaded; if none exist the built-in {DEFAULTS} are used.
|
|
41
|
+
#
|
|
42
|
+
# When a path is supplied (whether by auto-discovery or by the caller) the YAML body is processed for
|
|
43
|
+
# `includes:` recursively, and every relative path inside path-bearing keys (`paths:`,
|
|
44
|
+
# `signature_paths:`, `plugins_io.allowed_paths:`, `includes:`) is resolved against THAT file's
|
|
45
|
+
# directory. The resolution is per-file: an included file's relative paths resolve against the included
|
|
46
|
+
# file's directory, not the top-level file. Path resolution mirrors
|
|
47
|
+
# [PHPStan](https://phpstan.org/config-reference#paths).
|
|
48
|
+
def self.load(path = nil)
|
|
49
|
+
resolved = path || discover
|
|
50
|
+
loaded = resolved && File.exist?(resolved) ? resolved : nil
|
|
51
|
+
if loaded.nil?
|
|
52
|
+
data = Defaults::DEFAULTS
|
|
53
|
+
effects_key_present = false
|
|
54
|
+
target_ruby_key_present = false
|
|
55
|
+
else
|
|
56
|
+
# ADR-103 WD15 — captured from the RAW, pre-`DEFAULTS.merge` file (+ its `includes:` chain) because
|
|
57
|
+
# `DEFAULTS` itself carries an `"effects" => false` entry: once merged, "the file never wrote
|
|
58
|
+
# `effects:`" and "the file wrote `effects: false`" collapse to the same value and become
|
|
59
|
+
# indistinguishable to {Configuration#initialize}. This is the only place that distinction still exists.
|
|
60
|
+
raw = load_with_includes(loaded)
|
|
61
|
+
effects_key_present = raw.key?("effects")
|
|
62
|
+
target_ruby_key_present = raw.key?("target_ruby")
|
|
63
|
+
data = Defaults::DEFAULTS.merge(raw)
|
|
64
|
+
end
|
|
65
|
+
Configuration.new(autowire_default_plugins(data), effects_key_present, target_ruby_key_present || false)
|
|
66
|
+
.with_exclude_base(loaded && File.dirname(loaded))
|
|
67
|
+
.with_config_path(loaded)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# ADR-93 WD2 — default-wire the bundled `rigor-rbs-inline` plugin, in WD1's annotation-gated,
|
|
71
|
+
# magic-comment-free mode, when the upstream `rbs-inline` library is resolvable and the user has not
|
|
72
|
+
# already listed the plugin. Runs from {load} only — the real-project route — never from a bare
|
|
73
|
+
# {Configuration.new}, so the suite's unit constructions do not auto-wire. The gate is presence-based
|
|
74
|
+
# (ADR-72's shape): an annotation-free project pays only a comment scan and contributes nothing, so
|
|
75
|
+
# wiring it on cannot regress the run. This partially reverses the ADR-27/ADR-31 auto-load deferral for
|
|
76
|
+
# this one bundled plugin (the executed code is already vendored, not arbitrary third-party plugin code).
|
|
77
|
+
# Opt out with a `plugins:` entry disabling it (`enabled: false`), or per-file `# rbs_inline: disabled`.
|
|
78
|
+
def self.autowire_default_plugins(data)
|
|
79
|
+
entries = Array(data["plugins"])
|
|
80
|
+
return data if entries.any? { |entry| rbs_inline_plugin_entry?(entry) }
|
|
81
|
+
return data unless Configuration.rbs_inline_library_resolvable?
|
|
82
|
+
|
|
83
|
+
merged = data.dup
|
|
84
|
+
merged["plugins"] = entries + [{
|
|
85
|
+
"gem" => AUTOWIRED_RBS_INLINE_GEM,
|
|
86
|
+
"id" => AUTOWIRED_RBS_INLINE_ID,
|
|
87
|
+
"config" => { "require_magic_comment" => false }
|
|
88
|
+
}]
|
|
89
|
+
merged
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# True when a `plugins:` entry (String or Hash, string- or symbol-keyed) already references the
|
|
93
|
+
# `rigor-rbs-inline` plugin by gem name or by manifest id. Single-homed here so the CLI's
|
|
94
|
+
# `--treat-all-as-inline-rbs` injection and the WD2 auto-wire gate agree on what "already listed" means.
|
|
95
|
+
def self.rbs_inline_plugin_entry?(entry)
|
|
96
|
+
case entry
|
|
97
|
+
when String
|
|
98
|
+
entry == AUTOWIRED_RBS_INLINE_GEM
|
|
99
|
+
when Hash
|
|
100
|
+
string_keyed = entry.to_h { |k, v| [k.to_s, v] }
|
|
101
|
+
string_keyed["gem"] == AUTOWIRED_RBS_INLINE_GEM || string_keyed["id"] == AUTOWIRED_RBS_INLINE_ID
|
|
102
|
+
else
|
|
103
|
+
false
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# A probe with no load side effect: it does not `require` the library, only asks whether RubyGems can
|
|
108
|
+
# resolve the name. `Gem::Specification.find_by_name` raises `Gem::MissingSpecError` (a `Gem::LoadError`)
|
|
109
|
+
# when the gem is absent — the standalone `gem install rigortype` case, WD3's residual. ADR-90's
|
|
110
|
+
# project-bundle fallback resolves the same name at the plugin's own `require` time.
|
|
111
|
+
def self.rbs_inline_library_resolvable?
|
|
112
|
+
Gem::Specification.find_by_name("rbs-inline")
|
|
113
|
+
true
|
|
114
|
+
rescue Gem::LoadError
|
|
115
|
+
false
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Returns the path to the config file Rigor would load under auto-discovery, or `nil` when neither
|
|
119
|
+
# candidate exists. Public so the CLI / spec drift checks can introspect the resolved file.
|
|
120
|
+
#
|
|
121
|
+
# A candidate that is a directory is the same usage error an explicit `--config=<dir>` is (#3432), not a
|
|
122
|
+
# silent skip to the next candidate: the user named that file by creating it, and a skip would analyse under
|
|
123
|
+
# a configuration they did not write.
|
|
124
|
+
def self.discover
|
|
125
|
+
found = Defaults::DISCOVERY_ORDER.find { |candidate| File.exist?(candidate) }
|
|
126
|
+
raise ConfigurationError, "config path is a directory: #{found}" if found && File.directory?(found)
|
|
127
|
+
|
|
128
|
+
found
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# #3432 — under `rigor mcp` the process's stdin is the JSON-RPC channel, so a configuration file that is not a
|
|
132
|
+
# regular file (a FIFO, a device, `/dev/stdin`) would read the protocol stream or block the server. Inside this
|
|
133
|
+
# block every file {read_yaml} reads — the `config` argument, the session default, an auto-discovered file and
|
|
134
|
+
# every include — MUST be a regular file. The CLI runs outside it and keeps reading pipes and devices
|
|
135
|
+
# (`--config=<(generate)`, `--config=/dev/null`), which its user asked for.
|
|
136
|
+
#
|
|
137
|
+
# The restriction is process-wide, not thread-local, so a command that loads its configuration on another
|
|
138
|
+
# thread is still covered. It is a depth count rather than a saved-and-restored flag, so two blocks that overlap
|
|
139
|
+
# and end out of order leave it off once both have ended.
|
|
140
|
+
@regular_files_only_lock = Mutex.new
|
|
141
|
+
@regular_files_only_depth = 0
|
|
142
|
+
|
|
143
|
+
def self.regular_files_only
|
|
144
|
+
@regular_files_only_lock.synchronize { @regular_files_only_depth += 1 }
|
|
145
|
+
begin
|
|
146
|
+
yield
|
|
147
|
+
ensure
|
|
148
|
+
@regular_files_only_lock.synchronize { @regular_files_only_depth -= 1 }
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def self.regular_files_only?
|
|
153
|
+
@regular_files_only_lock.synchronize { @regular_files_only_depth.positive? }
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# Reads `path` (which MUST exist) plus every file listed in its `includes:` chain, merging them under the
|
|
157
|
+
# order: included files first (in declaration order), then the current file's own keys override.
|
|
158
|
+
# Relative paths inside each file are resolved against that file's directory. Public so the CLI can run
|
|
159
|
+
# the include-aware load before applying `--treat-all-as-inline-rbs`'s plugin injection (see
|
|
160
|
+
# {CLI::CheckCommand#load_check_configuration}).
|
|
161
|
+
def self.load_with_includes(path, visited: Set.new)
|
|
162
|
+
absolute = File.absolute_path(path)
|
|
163
|
+
raise ConfigurationError, "circular include: #{absolute}" if visited.include?(absolute)
|
|
164
|
+
|
|
165
|
+
raw = read_yaml(absolute)
|
|
166
|
+
raise ConfigurationError, "config file must be a YAML mapping: #{absolute}" unless raw.is_a?(Hash)
|
|
167
|
+
|
|
168
|
+
base_dir = File.dirname(absolute)
|
|
169
|
+
includes = Array(raw.delete("includes") || [])
|
|
170
|
+
reject_nul!(raw, absolute)
|
|
171
|
+
data = resolve_paths_in(raw, base_dir)
|
|
172
|
+
next_visited = visited + [absolute]
|
|
173
|
+
merge_includes(data, includes, base_dir, next_visited)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# #433's sibling: a typo in the file the user is about to be told to fix is a configuration mistake
|
|
177
|
+
# like any other, and escaped as a `Psych::SyntaxError` backtrace naming a file inside Ruby's stdlib.
|
|
178
|
+
# Psych's own `#message` embeds the path in a parenthesised prefix that reads badly after `rigor: `,
|
|
179
|
+
# so the position is re-rendered in the `path:line:column` form the rest of Rigor's output uses.
|
|
180
|
+
#
|
|
181
|
+
# #3432 — an alias (`*x`) or a tag/type `safe_load` refuses (`!ruby/object:…`, a `:symbol`) is the same kind of
|
|
182
|
+
# mistake. Psych raises those without a position, so they name the file only. A directory or an unreadable
|
|
183
|
+
# file reaching the read (an include, or a file whose mode changed after the CLI's check) is reported in the
|
|
184
|
+
# words `--config` uses for it.
|
|
185
|
+
def self.read_yaml(absolute)
|
|
186
|
+
read_config_yaml(absolute, restricted: regular_files_only?) || {}
|
|
187
|
+
rescue Psych::SyntaxError => e
|
|
188
|
+
detail = [e.problem, e.context].compact.join(" ")
|
|
189
|
+
raise ConfigurationError, "#{absolute}:#{e.line}:#{e.column}: not valid YAML: #{detail}"
|
|
190
|
+
rescue Psych::BadAlias
|
|
191
|
+
raise ConfigurationError, "#{absolute}: YAML aliases are not allowed in a Rigor configuration"
|
|
192
|
+
rescue Psych::DisallowedClass => e
|
|
193
|
+
raise ConfigurationError, "#{absolute}: YAML value not allowed in a Rigor configuration: #{e.message}"
|
|
194
|
+
rescue Errno::EISDIR
|
|
195
|
+
raise ConfigurationError, "config path is a directory: #{absolute}"
|
|
196
|
+
rescue Errno::EACCES
|
|
197
|
+
raise ConfigurationError, "config file not readable: #{absolute}"
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# The one YAML read both routes share: the CLI's `--config` and auto-discovered files, and `rigor mcp`. The open
|
|
201
|
+
# is binary and reads nothing: a `bom|utf-8` open sniffs the BOM at open time, which fails on a UTF-16 file (the
|
|
202
|
+
# CLI's `safe_load_file` did, #3473) and blocks on a pipe a writer holds (`/dev/stdin` under `rigor mcp`) while
|
|
203
|
+
# consuming its bytes. libyaml detects the encoding and skips a BOM itself. The YAML options are
|
|
204
|
+
# `safe_load_file`'s.
|
|
205
|
+
#
|
|
206
|
+
# When `restricted`, the file type is checked on the open descriptor, not on the path beforehand, so a file
|
|
207
|
+
# swapped for a FIFO between a check and the read is still refused; `O_NONBLOCK` keeps the open of a FIFO with
|
|
208
|
+
# no writer from blocking. The CLI passes `restricted: false`, keeps reading pipes and devices, and opens them
|
|
209
|
+
# blocking: a named FIFO whose writer has not opened yet must wait for it, not read as an empty file (#3484).
|
|
210
|
+
def self.read_config_yaml(absolute, restricted:)
|
|
211
|
+
flags = restricted ? File::RDONLY | File::NONBLOCK : File::RDONLY
|
|
212
|
+
File.open(absolute, flags, binmode: true) do |io|
|
|
213
|
+
if restricted
|
|
214
|
+
stat = io.stat
|
|
215
|
+
raise ConfigurationError, "config path is a directory: #{absolute}" if stat.directory?
|
|
216
|
+
unless stat.file?
|
|
217
|
+
raise ConfigurationError,
|
|
218
|
+
"config path is not a regular file: #{absolute} (rigor mcp reads only regular files)"
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
YAML.safe_load(io, filename: absolute, aliases: false)
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
def self.merge_includes(data, includes, base_dir, visited)
|
|
227
|
+
return data if includes.empty?
|
|
228
|
+
|
|
229
|
+
accumulated = {}
|
|
230
|
+
includes.each do |inc|
|
|
231
|
+
inc_path = check_include(inc, base_dir)
|
|
232
|
+
|
|
233
|
+
accumulated = deep_merge(accumulated, load_with_includes(inc_path, visited: visited))
|
|
234
|
+
end
|
|
235
|
+
deep_merge(accumulated, data)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# The checks `CLI::Options.config_path` makes for `--config`, made for an include and naming the file that
|
|
239
|
+
# references it (#3432). The NUL check comes before the path is made absolute, which raises on one. Answers the
|
|
240
|
+
# include's absolute path.
|
|
241
|
+
def self.check_include(inc, base_dir)
|
|
242
|
+
where = "#{inc.inspect} (referenced from #{base_dir})"
|
|
243
|
+
raise ConfigurationError, "include not found: #{where}" if inc.to_s.include?("\0")
|
|
244
|
+
|
|
245
|
+
inc_path = ConfigPath.absolute(inc.to_s, base_dir)
|
|
246
|
+
raise ConfigurationError, "include not found: #{where}" unless File.exist?(inc_path)
|
|
247
|
+
raise ConfigurationError, "include is a directory: #{where}" if File.directory?(inc_path)
|
|
248
|
+
raise ConfigurationError, "include not readable: #{where}" unless File.readable?(inc_path)
|
|
249
|
+
|
|
250
|
+
inc_path
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# #3471 — a NUL byte is never a legitimate part of a Rigor configuration, and a key that is read later as a path
|
|
254
|
+
# or a name reaches a file-system or gem-name call that raises on it (`File.absolute_path`, `File.fnmatch?`,
|
|
255
|
+
# `File.join`, `File.exist?`). So every string in the file's mapping, a key or a value at any depth, is checked
|
|
256
|
+
# here, once per file read, before anything is resolved. The error names the dotted key path (`plugins[0]`,
|
|
257
|
+
# `effects.snapshot.path`) and the file. `includes:` is removed from the mapping before this runs and is checked
|
|
258
|
+
# by {check_include}, which names the file that references it.
|
|
259
|
+
def self.reject_nul!(node, absolute, path = nil)
|
|
260
|
+
case node
|
|
261
|
+
when Hash
|
|
262
|
+
node.each do |key, value|
|
|
263
|
+
key_path = path ? "#{path}.#{key}" : key.to_s
|
|
264
|
+
reject_nul_string!(key.to_s, key_path, absolute)
|
|
265
|
+
reject_nul!(value, absolute, key_path)
|
|
266
|
+
end
|
|
267
|
+
when Array
|
|
268
|
+
node.each_with_index { |item, index| reject_nul!(item, absolute, "#{path}[#{index}]") }
|
|
269
|
+
when String
|
|
270
|
+
reject_nul_string!(node, path, absolute)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def self.reject_nul_string!(text, key_path, absolute)
|
|
275
|
+
return unless text.include?("\0")
|
|
276
|
+
|
|
277
|
+
raise ConfigurationError,
|
|
278
|
+
"config key `#{key_path.gsub("\0") { '\0' }}` contains a NUL byte: #{absolute}"
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Per-file path resolution. Each path-bearing key listed in {PATH_KEYS} plus the nested
|
|
282
|
+
# `plugins_io.allowed_paths:` entries get their relative paths expanded against the config file's
|
|
283
|
+
# directory. `cache.path:` is intentionally left as-is so end-user messages (e.g. `--cache-stats` output)
|
|
284
|
+
# keep the project-relative form the user wrote.
|
|
285
|
+
def self.resolve_paths_in(data, base_dir)
|
|
286
|
+
return data unless data.is_a?(Hash)
|
|
287
|
+
|
|
288
|
+
out = data.dup
|
|
289
|
+
PATH_KEYS.each { |key| resolve_path_key!(out, key, base_dir) }
|
|
290
|
+
SCALAR_PATH_KEYS.each { |key| resolve_scalar_path_key!(out, key, base_dir) }
|
|
291
|
+
resolve_plugins_io_paths!(out, base_dir)
|
|
292
|
+
out
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def self.resolve_path_key!(out, key, base_dir)
|
|
296
|
+
return unless out.key?(key) && !out[key].nil?
|
|
297
|
+
|
|
298
|
+
out[key] = Array(out[key]).map { |p| ConfigPath.absolute(p.to_s, base_dir) }
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def self.resolve_scalar_path_key!(out, key, base_dir)
|
|
302
|
+
return unless out.key?(key) && out[key].is_a?(String)
|
|
303
|
+
|
|
304
|
+
out[key] = ConfigPath.absolute(out[key], base_dir)
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
def self.resolve_plugins_io_paths!(out, base_dir)
|
|
308
|
+
plugins_io = out["plugins_io"]
|
|
309
|
+
return unless plugins_io.is_a?(Hash) && plugins_io["allowed_paths"]
|
|
310
|
+
|
|
311
|
+
duped = plugins_io.dup
|
|
312
|
+
duped["allowed_paths"] = Array(plugins_io["allowed_paths"]).map { |p| ConfigPath.absolute(p.to_s, base_dir) }
|
|
313
|
+
out["plugins_io"] = duped
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
def self.deep_merge(left, right)
|
|
317
|
+
return right unless left.is_a?(Hash) && right.is_a?(Hash)
|
|
318
|
+
|
|
319
|
+
merged = left.dup
|
|
320
|
+
right.each do |key, value|
|
|
321
|
+
merged[key] = merge_value(key, merged, value)
|
|
322
|
+
end
|
|
323
|
+
merged
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# Most keys are right-wins (override) or recursively merged hashes. ADR-10 § "config-conflict
|
|
327
|
+
# diagnostic" carves out `dependencies.source_inference[]`: the per-gem merge across `includes:` chains
|
|
328
|
+
# needs union behaviour with mode-conflict detection. The Hash itself still merges deeply; only the
|
|
329
|
+
# inner array gets concatenated so {Dependencies.from_h} sees every contributor's entries and can dedupe
|
|
330
|
+
# them.
|
|
331
|
+
def self.merge_value(key, merged, value)
|
|
332
|
+
if key == "dependencies" && merged[key].is_a?(Hash) && value.is_a?(Hash)
|
|
333
|
+
merge_dependencies_hash(merged[key], value)
|
|
334
|
+
elsif merged.key?(key) && merged[key].is_a?(Hash) && value.is_a?(Hash)
|
|
335
|
+
deep_merge(merged[key], value)
|
|
336
|
+
else
|
|
337
|
+
value
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def self.merge_dependencies_hash(left, right)
|
|
342
|
+
out = deep_merge(left, right)
|
|
343
|
+
left_si = Array(left["source_inference"])
|
|
344
|
+
right_si = Array(right["source_inference"])
|
|
345
|
+
both_empty = left_si.empty? && right_si.empty?
|
|
346
|
+
out["source_inference"] = left_si + right_si unless both_empty
|
|
347
|
+
out
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
private_class_method :merge_includes, :check_include, :read_config_yaml, :reject_nul!, :reject_nul_string!,
|
|
351
|
+
:resolve_paths_in, :deep_merge, :merge_value, :merge_dependencies_hash
|
|
352
|
+
end
|
|
353
|
+
end
|
|
354
|
+
end
|
|
@@ -13,7 +13,8 @@ module Rigor
|
|
|
13
13
|
# Useful for incremental adoption on legacy code.
|
|
14
14
|
# - `balanced` (**default**): Current Rigor stance — most rules `:error`; `dump.type` `:info`; uncertain
|
|
15
15
|
# rules `:warning`.
|
|
16
|
-
# - `strict`:
|
|
16
|
+
# - `strict`: Rules report at `:error`, except the few the table below deliberately holds lower
|
|
17
|
+
# (`flow.unreachable-clause`, `effect.unknown-label`, the suppression rules, `:off` opt-ins). CI-friendly.
|
|
17
18
|
#
|
|
18
19
|
# The resolution order, first match wins:
|
|
19
20
|
#
|
|
@@ -111,9 +112,8 @@ module Rigor
|
|
|
111
112
|
"flow.dead-assignment" => :warning,
|
|
112
113
|
"flow.always-truthy-condition" => :warning,
|
|
113
114
|
# ADR-47 WD4: stays :info (not :warning like its siblings) in the
|
|
114
|
-
# default balanced profile
|
|
115
|
-
#
|
|
116
|
-
# to zero net false positives.
|
|
115
|
+
# default balanced profile. The 16-corpus sweep fired zero times, which is not
|
|
116
|
+
# evidence for a louder default; promotion waits for a real firing to triage.
|
|
117
117
|
"flow.unreachable-clause" => :info,
|
|
118
118
|
"flow.duplicate-hash-key" => :warning,
|
|
119
119
|
"flow.return-in-ensure" => :warning,
|