rigortype 0.1.19 → 0.2.1
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 +41 -6
- data/data/core_overlay/numeric.rbs +33 -0
- data/data/core_overlay/pathname.rbs +25 -0
- data/data/core_overlay/string_scanner.rbs +28 -0
- data/data/gem_overlay/activesupport/core_ext.rbs +473 -0
- data/data/vendored_gem_sigs/ast/ast.rbs +130 -0
- data/data/vendored_gem_sigs/bcrypt/bcrypt.rbs +47 -0
- data/data/vendored_gem_sigs/bundler/bundler.rbs +238 -0
- data/data/vendored_gem_sigs/cgi/cgi_extras.rbs +34 -0
- data/data/vendored_gem_sigs/did_you_mean/did_you_mean_extras.rbs +34 -0
- data/data/vendored_gem_sigs/idn-ruby/idn.rbs +54 -0
- data/data/vendored_gem_sigs/mysql2/client.rbs +55 -0
- data/data/vendored_gem_sigs/mysql2/error.rbs +5 -0
- data/data/vendored_gem_sigs/mysql2/result.rbs +31 -0
- data/data/vendored_gem_sigs/mysql2/statement.rbs +5 -0
- data/data/vendored_gem_sigs/nokogiri/nokogiri.rbs +2332 -0
- data/data/vendored_gem_sigs/nokogiri/nokogiri_html5.rbs +47 -0
- data/data/vendored_gem_sigs/pg/pg.rbs +212 -0
- data/data/vendored_gem_sigs/prism/prism_supplement.rbs +44 -0
- data/data/vendored_gem_sigs/redis/errors.rbs +50 -0
- data/data/vendored_gem_sigs/redis/future.rbs +5 -0
- data/data/vendored_gem_sigs/redis/redis.rbs +348 -0
- data/data/vendored_gem_sigs/redis/redis_extras.rbs +130 -0
- data/data/vendored_gem_sigs/rubygems/rubygems_extras.rbs +226 -0
- data/lib/rigor/analysis/check_rules/ivar_write_collector.rb +3 -23
- data/lib/rigor/analysis/check_rules/rule_walk.rb +3 -21
- data/lib/rigor/analysis/check_rules/self_closedness_scanner.rb +24 -15
- data/lib/rigor/analysis/check_rules.rb +492 -71
- data/lib/rigor/analysis/dependency_source_inference/index.rb +4 -7
- data/lib/rigor/analysis/dependency_source_inference/walker.rb +2 -18
- data/lib/rigor/analysis/dependency_source_inference.rb +3 -12
- data/lib/rigor/analysis/fact_store.rb +5 -4
- data/lib/rigor/analysis/rule_catalog.rb +153 -6
- data/lib/rigor/analysis/runner/diagnostic_aggregator.rb +17 -17
- data/lib/rigor/analysis/runner/project_pre_passes.rb +9 -8
- data/lib/rigor/analysis/runner.rb +17 -6
- data/lib/rigor/analysis/self_call_resolution_recorder.rb +3 -4
- data/lib/rigor/analysis/worker_session.rb +10 -14
- data/lib/rigor/builtins/predefined_constant_refinements.rb +151 -0
- data/lib/rigor/cache/store.rb +5 -3
- data/lib/rigor/cli/annotate_command.rb +28 -7
- data/lib/rigor/cli/baseline_command.rb +4 -3
- data/lib/rigor/cli/check_command.rb +138 -16
- data/lib/rigor/cli/coverage_command.rb +138 -31
- data/lib/rigor/cli/coverage_mutation.rb +149 -0
- data/lib/rigor/cli/coverage_scan.rb +57 -0
- data/lib/rigor/cli/explain_command.rb +2 -0
- data/lib/rigor/cli/fused_protection_renderer.rb +67 -0
- data/lib/rigor/cli/fused_protection_report.rb +76 -0
- data/lib/rigor/cli/lsp_command.rb +3 -7
- data/lib/rigor/cli/mutation_protection_renderer.rb +63 -0
- data/lib/rigor/cli/mutation_protection_report.rb +73 -0
- data/lib/rigor/cli/options.rb +9 -0
- data/lib/rigor/cli/plugins_command.rb +2 -1
- data/lib/rigor/cli/protection_renderer.rb +63 -0
- data/lib/rigor/cli/protection_report.rb +68 -0
- data/lib/rigor/cli/sig_gen_command.rb +2 -1
- data/lib/rigor/cli/trace_command.rb +2 -1
- data/lib/rigor/cli/triage_command.rb +2 -1
- data/lib/rigor/cli/type_of_command.rb +1 -1
- data/lib/rigor/cli/type_scan_command.rb +2 -1
- data/lib/rigor/cli.rb +3 -2
- data/lib/rigor/config_audit.rb +152 -0
- data/lib/rigor/configuration/dependencies.rb +2 -4
- data/lib/rigor/configuration.rb +57 -7
- data/lib/rigor/environment/bundle_sig_discovery.rb +61 -13
- data/lib/rigor/environment/class_registry.rb +4 -3
- data/lib/rigor/environment/constant_type_cache_holder.rb +43 -0
- data/lib/rigor/environment/lockfile_resolver.rb +1 -1
- data/lib/rigor/environment/rbs_collection_discovery.rb +1 -2
- data/lib/rigor/environment/rbs_coverage_report.rb +2 -1
- data/lib/rigor/environment/rbs_loader.rb +76 -5
- data/lib/rigor/environment.rb +66 -8
- data/lib/rigor/flow_contribution/fact.rb +1 -1
- data/lib/rigor/flow_contribution.rb +3 -5
- data/lib/rigor/inference/acceptance.rb +17 -9
- data/lib/rigor/inference/block_parameter_binder.rb +2 -3
- data/lib/rigor/inference/builtins/comparable_catalog.rb +2 -2
- data/lib/rigor/inference/builtins/enumerable_catalog.rb +2 -2
- data/lib/rigor/inference/builtins/method_catalog.rb +19 -0
- data/lib/rigor/inference/builtins/string_catalog.rb +9 -1
- data/lib/rigor/inference/expression_typer.rb +20 -28
- data/lib/rigor/inference/hkt_body.rb +8 -11
- data/lib/rigor/inference/hkt_body_parser.rb +10 -12
- data/lib/rigor/inference/hkt_registry.rb +10 -11
- data/lib/rigor/inference/method_dispatcher/call_context.rb +1 -4
- data/lib/rigor/inference/method_dispatcher/constant_folding.rb +169 -24
- data/lib/rigor/inference/method_dispatcher/data_folding.rb +9 -73
- data/lib/rigor/inference/method_dispatcher/file_folding.rb +6 -7
- data/lib/rigor/inference/method_dispatcher/iterator_dispatch.rb +10 -16
- data/lib/rigor/inference/method_dispatcher/kernel_dispatch.rb +25 -13
- data/lib/rigor/inference/method_dispatcher/member_shape_projection.rb +93 -0
- data/lib/rigor/inference/method_dispatcher/overload_selector.rb +1 -3
- data/lib/rigor/inference/method_dispatcher/rbs_dispatch.rb +24 -22
- data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +90 -15
- data/lib/rigor/inference/method_dispatcher/struct_folding.rb +303 -0
- data/lib/rigor/inference/method_dispatcher.rb +40 -48
- data/lib/rigor/inference/mutation_widening.rb +5 -11
- data/lib/rigor/inference/narrowing.rb +14 -16
- data/lib/rigor/inference/parameter_inference_collector.rb +367 -0
- data/lib/rigor/inference/project_patched_methods.rb +4 -7
- data/lib/rigor/inference/project_patched_scanner.rb +2 -13
- data/lib/rigor/inference/protection_scanner.rb +86 -0
- data/lib/rigor/inference/scope_indexer.rb +129 -55
- data/lib/rigor/inference/statement_evaluator.rb +271 -114
- data/lib/rigor/inference/struct_fold_safety.rb +181 -0
- data/lib/rigor/inference/synthetic_method.rb +7 -7
- data/lib/rigor/language_server/completion_provider.rb +6 -12
- data/lib/rigor/language_server/diagnostic_publisher.rb +4 -4
- data/lib/rigor/language_server/document_symbol_provider.rb +3 -3
- data/lib/rigor/language_server/hover_provider.rb +2 -3
- data/lib/rigor/language_server/hover_renderer.rb +2 -11
- data/lib/rigor/language_server/server.rb +9 -17
- data/lib/rigor/language_server.rb +4 -5
- data/lib/rigor/plugin/base.rb +10 -8
- data/lib/rigor/plugin/macro/block_as_method.rb +3 -4
- data/lib/rigor/plugin/macro/heredoc_template.rb +4 -7
- data/lib/rigor/plugin/macro/trait_registry.rb +3 -6
- data/lib/rigor/plugin/macro.rb +4 -5
- data/lib/rigor/plugin/manifest.rb +45 -66
- data/lib/rigor/plugin/registry.rb +6 -7
- data/lib/rigor/plugin/type_node_resolver.rb +6 -8
- data/lib/rigor/protection/diagnostic_oracle.rb +51 -0
- data/lib/rigor/protection/mutation_scanner.rb +180 -0
- data/lib/rigor/protection/mutator.rb +267 -0
- data/lib/rigor/protection/test_suite_oracle.rb +68 -0
- data/lib/rigor/rbs_extended.rb +24 -36
- data/lib/rigor/reflection.rb +4 -7
- data/lib/rigor/scope/discovery_index.rb +14 -2
- data/lib/rigor/scope.rb +54 -11
- data/lib/rigor/sig_gen/observed_call.rb +3 -3
- data/lib/rigor/sig_gen/writer.rb +40 -2
- data/lib/rigor/signature_path_audit.rb +92 -0
- data/lib/rigor/source/constant_path.rb +62 -0
- data/lib/rigor/source.rb +1 -0
- data/lib/rigor/type/bound_method.rb +2 -11
- data/lib/rigor/type/combinator.rb +16 -3
- data/lib/rigor/type/constant.rb +2 -11
- data/lib/rigor/type/data_class.rb +2 -11
- data/lib/rigor/type/data_instance.rb +2 -11
- data/lib/rigor/type/hash_shape.rb +2 -11
- data/lib/rigor/type/integer_range.rb +2 -11
- data/lib/rigor/type/intersection.rb +2 -11
- data/lib/rigor/type/nominal.rb +2 -11
- data/lib/rigor/type/plain_lattice.rb +37 -0
- data/lib/rigor/type/refined.rb +72 -13
- data/lib/rigor/type/singleton.rb +2 -11
- data/lib/rigor/type/struct_class.rb +75 -0
- data/lib/rigor/type/struct_instance.rb +93 -0
- data/lib/rigor/type/tuple.rb +5 -15
- data/lib/rigor/type.rb +2 -0
- data/lib/rigor/version.rb +1 -1
- data/plugins/rigor-actioncable/lib/rigor/plugin/actioncable/channel_discoverer.rb +1 -1
- data/plugins/rigor-actioncable/lib/rigor/plugin/actioncable/channel_index.rb +3 -3
- data/plugins/rigor-actioncable/lib/rigor/plugin/actioncable.rb +3 -3
- data/plugins/rigor-actionmailer/lib/rigor/plugin/actionmailer/mailer_discoverer.rb +5 -13
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack/analyzer.rb +11 -17
- data/plugins/rigor-actionpack/lib/rigor/plugin/actionpack.rb +7 -10
- data/plugins/rigor-activejob/lib/rigor/plugin/activejob/job_index.rb +3 -2
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord/model_discoverer.rb +4 -4
- data/plugins/rigor-activerecord/lib/rigor/plugin/activerecord.rb +6 -8
- data/plugins/rigor-activestorage/lib/rigor/plugin/activestorage/analyzer.rb +5 -7
- data/plugins/rigor-activestorage/lib/rigor/plugin/activestorage.rb +1 -2
- data/plugins/rigor-devise/lib/rigor/plugin/devise.rb +9 -11
- data/plugins/rigor-dry-struct/lib/rigor/plugin/dry_struct.rb +8 -9
- data/plugins/rigor-dry-types/lib/rigor/plugin/dry_types.rb +13 -12
- data/plugins/rigor-dry-validation/lib/rigor/plugin/dry_validation.rb +3 -4
- data/plugins/rigor-factorybot/lib/rigor/plugin/factorybot/analyzer.rb +8 -8
- data/plugins/rigor-factorybot/lib/rigor/plugin/factorybot/factory_discoverer.rb +9 -11
- data/plugins/rigor-factorybot/lib/rigor/plugin/factorybot/factory_index.rb +7 -8
- data/plugins/rigor-factorybot/lib/rigor/plugin/factorybot.rb +7 -9
- data/plugins/rigor-graphql/lib/rigor/plugin/graphql/type_scanner.rb +12 -13
- data/plugins/rigor-graphql/lib/rigor/plugin/graphql.rb +15 -23
- data/plugins/rigor-mangrove/lib/rigor/plugin/mangrove.rb +3 -3
- data/plugins/rigor-minitest/lib/rigor/plugin/minitest.rb +3 -3
- data/plugins/rigor-rails-i18n/lib/rigor/plugin/rails_i18n/analyzer.rb +2 -4
- data/plugins/rigor-rails-i18n/lib/rigor/plugin/rails_i18n/locale_loader.rb +27 -11
- 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 -6
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes/routes_parser.rb +12 -18
- data/plugins/rigor-rails-routes/lib/rigor/plugin/rails_routes.rb +5 -5
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/let_scope_index.rb +3 -4
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/let_type_resolver.rb +1 -1
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec/matcher_analyzer.rb +1 -1
- data/plugins/rigor-rspec/lib/rigor/plugin/rspec.rb +19 -14
- data/plugins/rigor-shoulda-matchers/lib/rigor/plugin/shoulda_matchers/analyzer.rb +0 -1
- data/plugins/rigor-sidekiq/lib/rigor/plugin/sidekiq/worker_index.rb +5 -4
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/assertion_recognizer.rb +2 -3
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/method_signature.rb +7 -11
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/sig_parser.rb +4 -5
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/sigil_detector.rb +6 -9
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet/type_translator.rb +5 -15
- data/plugins/rigor-sorbet/lib/rigor/plugin/sorbet.rb +28 -41
- data/sig/rigor/scope.rbs +9 -1
- data/sig/rigor/type.rbs +36 -1
- metadata +49 -1
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Hand-authored by Rigor maintainers. See LICENSE.upstream.
|
|
2
|
+
#
|
|
3
|
+
# Covers AST::Node, AST::Processor::Mixin, AST::Processor, and
|
|
4
|
+
# AST::Sexp from the `ast` gem (whitequark/ast v2.4.3).
|
|
5
|
+
#
|
|
6
|
+
# Design notes (ADR-5 robustness principle):
|
|
7
|
+
# - `children` is `Array[untyped]` — AST node children are
|
|
8
|
+
# heterogeneous (other Nodes, Symbols, Integers, Strings, nils).
|
|
9
|
+
# - `#==` / `#eql?` accept `untyped` — `#==` calls `to_ast` on the
|
|
10
|
+
# argument and `#eql?` does a class + field equality check.
|
|
11
|
+
# - `#updated` returns `AST::Node`, not `instance`, because concrete
|
|
12
|
+
# subclasses (Parser::AST::Node) override `initialize` via
|
|
13
|
+
# `original_dup` + `send(:initialize, ...)`, so the return type is
|
|
14
|
+
# always an instance of `self.class` at runtime — widening to
|
|
15
|
+
# `AST::Node` is the safe upper bound Rigor can check against.
|
|
16
|
+
# - `AST::Processor::Mixin#process` returns `AST::Node?` — the method
|
|
17
|
+
# returns `nil` when given `nil`, and handlers may return `nil` to
|
|
18
|
+
# preserve the original node (then `process` returns the original).
|
|
19
|
+
|
|
20
|
+
module AST
|
|
21
|
+
# Immutable AST node. The type and children are set at construction
|
|
22
|
+
# and the object is frozen. Subclasses add metadata (e.g. source
|
|
23
|
+
# location) via `#assign_properties`.
|
|
24
|
+
class Node
|
|
25
|
+
# Returns the node type (e.g. `:send`, `:begin`, `:int`).
|
|
26
|
+
attr_reader type: Symbol
|
|
27
|
+
|
|
28
|
+
# Returns the (frozen) children array. Elements are heterogeneous:
|
|
29
|
+
# either other AST::Node instances or plain Ruby values (Symbol,
|
|
30
|
+
# Integer, String, nil, …).
|
|
31
|
+
attr_reader children: Array[untyped]
|
|
32
|
+
|
|
33
|
+
# Precomputed hash based on type, children, and class.
|
|
34
|
+
attr_reader hash: Integer
|
|
35
|
+
|
|
36
|
+
# Constructs a new Node. `type` is coerced with `to_sym`;
|
|
37
|
+
# `children` is coerced with `to_a` and then frozen.
|
|
38
|
+
def initialize: (untyped type, ?untyped children, ?untyped properties) -> void
|
|
39
|
+
|
|
40
|
+
# Equality ignores metadata; only type and children are compared.
|
|
41
|
+
def ==: (untyped other) -> bool
|
|
42
|
+
|
|
43
|
+
# Structural equality (type, children, and class must match).
|
|
44
|
+
def eql?: (untyped other) -> bool
|
|
45
|
+
|
|
46
|
+
# Returns a new Node with non-nil arguments replacing the
|
|
47
|
+
# corresponding fields. If the result would be identical to self,
|
|
48
|
+
# returns self unchanged.
|
|
49
|
+
def updated: (?Symbol? type, ?Array[untyped]? children, ?Hash[Symbol, untyped]? properties) -> AST::Node
|
|
50
|
+
|
|
51
|
+
# Concatenates `array` with children and returns a new node.
|
|
52
|
+
def concat: (Array[untyped] array) -> AST::Node
|
|
53
|
+
|
|
54
|
+
# Alias for `concat`.
|
|
55
|
+
def +: (Array[untyped] array) -> AST::Node
|
|
56
|
+
|
|
57
|
+
# Appends `element` to children and returns a new node.
|
|
58
|
+
def append: (untyped element) -> AST::Node
|
|
59
|
+
|
|
60
|
+
# Alias for `append`.
|
|
61
|
+
def <<: (untyped element) -> AST::Node
|
|
62
|
+
|
|
63
|
+
# Alias for `children`.
|
|
64
|
+
def to_a: () -> Array[untyped]
|
|
65
|
+
|
|
66
|
+
# Returns self — nodes are already frozen.
|
|
67
|
+
def dup: () -> AST::Node
|
|
68
|
+
|
|
69
|
+
# Alias for `dup`.
|
|
70
|
+
def clone: () -> AST::Node
|
|
71
|
+
|
|
72
|
+
# Returns self — satisfies the `to_ast` protocol.
|
|
73
|
+
def to_ast: () -> AST::Node
|
|
74
|
+
|
|
75
|
+
# Pretty-printed s-expression string.
|
|
76
|
+
def to_sexp: (?Integer indent) -> String
|
|
77
|
+
|
|
78
|
+
# Alias for `to_sexp`.
|
|
79
|
+
def to_s: (?Integer indent) -> String
|
|
80
|
+
|
|
81
|
+
# Ruby-source s-expression string (uses `s(:type, ...)` notation).
|
|
82
|
+
def inspect: (?Integer indent) -> String
|
|
83
|
+
|
|
84
|
+
# Converts to `[type, *children_as_sexp_arrays]` recursively.
|
|
85
|
+
def to_sexp_array: () -> Array[untyped]
|
|
86
|
+
|
|
87
|
+
# Pattern-match support: `[type, *children]`.
|
|
88
|
+
def deconstruct: () -> Array[untyped]
|
|
89
|
+
|
|
90
|
+
# Assigns entries from `properties` as instance variables.
|
|
91
|
+
# Protected in Ruby; declared here without visibility for RBS
|
|
92
|
+
# compatibility (RBS does not support `protected` on class members).
|
|
93
|
+
def assign_properties: (Hash[Symbol, untyped] properties) -> nil
|
|
94
|
+
|
|
95
|
+
# Returns the type with underscores replaced by dashes.
|
|
96
|
+
def fancy_type: () -> String
|
|
97
|
+
|
|
98
|
+
# The original unfrozen `dup` kept for use in `#updated`.
|
|
99
|
+
private def original_dup: () -> AST::Node
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# The processor mixin provides a node-dispatch framework. Mix into a
|
|
103
|
+
# class and define `on_<type>` handlers; unhandled nodes fall through
|
|
104
|
+
# to `#handler_missing`.
|
|
105
|
+
module Processor::Mixin
|
|
106
|
+
# Dispatches `node` to the appropriate `on_<type>` handler.
|
|
107
|
+
# Returns the handler's return value if non-nil, otherwise the
|
|
108
|
+
# original `node`. Returns `nil` when `node` is `nil`.
|
|
109
|
+
def process: (AST::Node? node) -> AST::Node?
|
|
110
|
+
|
|
111
|
+
# Processes each node in `nodes` and returns the array of results.
|
|
112
|
+
def process_all: (Array[AST::Node?] nodes) -> Array[AST::Node?]
|
|
113
|
+
|
|
114
|
+
# Default handler for unrecognised node types. Does nothing and
|
|
115
|
+
# returns `nil`, which causes `#process` to return the node unchanged.
|
|
116
|
+
def handler_missing: (AST::Node node) -> nil
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Deprecated superclass. Prefer `include AST::Processor::Mixin`.
|
|
120
|
+
class Processor
|
|
121
|
+
include AST::Processor::Mixin
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# Mixin providing the `s(type, *children)` shorthand for building
|
|
125
|
+
# nodes in tests or DSLs.
|
|
126
|
+
module Sexp
|
|
127
|
+
# Creates an AST::Node with the given type and children.
|
|
128
|
+
def s: (Symbol type, *untyped children) -> AST::Node
|
|
129
|
+
end
|
|
130
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module BCrypt
|
|
2
|
+
class Password < String
|
|
3
|
+
attr_reader checksum: String
|
|
4
|
+
attr_reader salt: String
|
|
5
|
+
attr_reader version: String
|
|
6
|
+
attr_reader cost: Integer
|
|
7
|
+
def self.create: (_ToS secret, {cost: _ToI} options) -> BCrypt::Password
|
|
8
|
+
def self.valid_hash?: (String h) -> bool
|
|
9
|
+
def initialize: (String raw_hash) -> void
|
|
10
|
+
def ==: (_ToS secret) -> bool
|
|
11
|
+
alias is_password? ==
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Engine
|
|
15
|
+
DEFAULT_COST: Integer
|
|
16
|
+
MIN_COST: Integer
|
|
17
|
+
MAX_COST: Integer
|
|
18
|
+
MAX_SECRET_BYTESIZE: Integer
|
|
19
|
+
MAX_SALT_LENGTH: Integer
|
|
20
|
+
|
|
21
|
+
def self.cost: () -> Integer
|
|
22
|
+
def self.cost=: (Integer cost) -> Integer
|
|
23
|
+
def self.hash_secret: (_ToS secret, String salt, ?untyped _) -> String
|
|
24
|
+
def self.generate_salt: (?_ToI cost) -> String
|
|
25
|
+
def self.valid_salt?: (String salt) -> bool
|
|
26
|
+
def self.valid_secret?: (Object secret) -> bool
|
|
27
|
+
def self.calibrate: (Numeric upper_time_limit_in_ms) -> Integer
|
|
28
|
+
def self.autodetect_cost: (String salt) -> Integer
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
class Error < StandardError
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
module Errors
|
|
35
|
+
class InvalidSalt < Error
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
class InvalidHash < Error
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class InvalidCost < Error
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class InvalidSecret < Error
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Rigor-side vendored RBS stub for the `bundler` gem.
|
|
3
|
+
#
|
|
4
|
+
# The `bundler` gem does not ship its own `sig/` and is not
|
|
5
|
+
# covered by `ruby/gem_rbs_collection`. The shim in
|
|
6
|
+
# `references/rbs/sig/shims/bundler.rbs` (rbs gem upstream)
|
|
7
|
+
# carries a tiny subset (`LockfileParser`, `LazySpecification`,
|
|
8
|
+
# `Dependency`, `Definition`, `default_lockfile`, `definition`,
|
|
9
|
+
# `Source::Gemspec`) but is only loaded when the user opts in via
|
|
10
|
+
# `library "bundler"` — that's rare in Rigor `.rigor.yml` setups,
|
|
11
|
+
# so most projects analyse bundler-using code with NO `Bundler`
|
|
12
|
+
# RBS in scope.
|
|
13
|
+
#
|
|
14
|
+
# This stub covers the Bundler module's top-25 singleton methods
|
|
15
|
+
# surfaced by the `references/ruby/lib` survey
|
|
16
|
+
# (`docs/CURRENT_WORK.md`), plus the handful of class-level
|
|
17
|
+
# entries (`Definition`, `LockfileParser`, `LazySpecification`,
|
|
18
|
+
# `Dependency`, `ConfigFile`, `Settings`, `UI`) that downstream
|
|
19
|
+
# Rigor users routinely touch. Most return types are `untyped`
|
|
20
|
+
# because Bundler's surface is dynamic / opaque; the goal is to
|
|
21
|
+
# silence `call.undefined-method` rather than infer precise
|
|
22
|
+
# returns.
|
|
23
|
+
#
|
|
24
|
+
# Declarations are intentionally a SUPERSET of the
|
|
25
|
+
# `references/rbs/sig/shims/bundler.rbs` shim. When the user
|
|
26
|
+
# opts into `library "bundler"`, the shim's typed declarations
|
|
27
|
+
# (`LockfileParser#specs -> Array[LazySpecification]`, etc.)
|
|
28
|
+
# would conflict; users who want both should drop the
|
|
29
|
+
# `library "bundler"` entry from their config so this vendored
|
|
30
|
+
# stub wins.
|
|
31
|
+
#
|
|
32
|
+
module Bundler
|
|
33
|
+
# `Bundler.<name>` — accessors / module-level entry points.
|
|
34
|
+
# Return types: `untyped` unless the surface is documented and
|
|
35
|
+
# widely-used (`bundle_path` -> Pathname).
|
|
36
|
+
def self.configure: () -> untyped
|
|
37
|
+
def self.ui: () -> untyped
|
|
38
|
+
def self.ui=: (untyped) -> untyped
|
|
39
|
+
def self.bundle_path: () -> Pathname
|
|
40
|
+
def self.create_bundle_path: () -> Pathname
|
|
41
|
+
def self.configured_bundle_path: () -> untyped
|
|
42
|
+
def self.bin_path: () -> Pathname
|
|
43
|
+
def self.setup: (*untyped groups) -> untyped
|
|
44
|
+
def self.auto_switch: () -> untyped
|
|
45
|
+
def self.auto_install: () -> untyped
|
|
46
|
+
def self.require: (*untyped groups) -> untyped
|
|
47
|
+
def self.load: () -> untyped
|
|
48
|
+
def self.environment: () -> untyped
|
|
49
|
+
def self.definition: (?untyped unlock, ?untyped lockfile) -> Definition
|
|
50
|
+
def self.frozen_bundle?: () -> bool
|
|
51
|
+
def self.locked_gems: () -> untyped
|
|
52
|
+
def self.ruby_scope: () -> String
|
|
53
|
+
def self.user_home: () -> Pathname
|
|
54
|
+
def self.user_bundle_path: (?untyped dir) -> Pathname
|
|
55
|
+
def self.user_cache: () -> Pathname
|
|
56
|
+
def self.home: () -> Pathname
|
|
57
|
+
def self.install_path: () -> Pathname
|
|
58
|
+
def self.specs_path: () -> Pathname
|
|
59
|
+
def self.root: () -> Pathname
|
|
60
|
+
def self.app_config_path: () -> Pathname
|
|
61
|
+
def self.app_cache: (?untyped custom_path) -> Pathname
|
|
62
|
+
def self.tmp: (?untyped name) -> Pathname
|
|
63
|
+
def self.rm_rf: (untyped path) -> untyped
|
|
64
|
+
def self.settings: () -> untyped
|
|
65
|
+
def self.original_env: () -> Hash[String, String]
|
|
66
|
+
def self.clean_env: () -> Hash[String, String]
|
|
67
|
+
def self.unbundled_env: () -> Hash[String, String]
|
|
68
|
+
def self.unbundle_env!: () -> untyped
|
|
69
|
+
def self.with_original_env: () { () -> untyped } -> untyped
|
|
70
|
+
def self.with_clean_env: () { () -> untyped } -> untyped
|
|
71
|
+
def self.with_unbundled_env: () { () -> untyped } -> untyped
|
|
72
|
+
def self.original_system: (*untyped) -> untyped
|
|
73
|
+
def self.clean_system: (*untyped) -> untyped
|
|
74
|
+
def self.unbundled_system: (*untyped) -> untyped
|
|
75
|
+
def self.original_exec: (*untyped) -> untyped
|
|
76
|
+
def self.clean_exec: (*untyped) -> untyped
|
|
77
|
+
def self.unbundled_exec: (*untyped) -> untyped
|
|
78
|
+
def self.local_platform: () -> untyped
|
|
79
|
+
def self.generic_local_platform: () -> untyped
|
|
80
|
+
def self.default_gemfile: () -> Pathname
|
|
81
|
+
def self.default_lockfile: () -> Pathname
|
|
82
|
+
def self.default_bundle_dir: () -> Pathname?
|
|
83
|
+
def self.system_bindir: () -> String?
|
|
84
|
+
def self.preferred_gemfile_name: () -> String
|
|
85
|
+
def self.use_system_gems?: () -> bool
|
|
86
|
+
def self.rubygems: () -> untyped
|
|
87
|
+
def self.which: (untyped) -> String?
|
|
88
|
+
def self.load_gemspec: (untyped path, ?bool validate) -> untyped
|
|
89
|
+
def self.read_file: (untyped path) -> String
|
|
90
|
+
def self.safe_load_marshal: (untyped data) -> untyped
|
|
91
|
+
def self.git_present?: () -> bool
|
|
92
|
+
def self.gem_version: () -> Gem::Version
|
|
93
|
+
def self.verbose_version: () -> String
|
|
94
|
+
def self.self_manager: () -> untyped
|
|
95
|
+
def self.reset!: () -> void
|
|
96
|
+
|
|
97
|
+
# Top-level classes touched in real-world bundler / rubygems
|
|
98
|
+
# code paths the survey analysed. Each class declares only the
|
|
99
|
+
# most-used members; the rest fall through to `untyped`-typed
|
|
100
|
+
# singleton-class dispatch via the surrounding module's
|
|
101
|
+
# untyped return contracts.
|
|
102
|
+
class Definition
|
|
103
|
+
def self.build: (untyped gemfile, untyped lockfile, untyped unlock) -> Definition
|
|
104
|
+
|
|
105
|
+
def initialize: (*untyped) -> void
|
|
106
|
+
def gemfiles: () -> Array[Pathname]
|
|
107
|
+
def lockfile: () -> Pathname
|
|
108
|
+
def lockfile=: (untyped) -> untyped
|
|
109
|
+
def locked_gems: () -> LockfileParser
|
|
110
|
+
def dependencies: () -> Array[Dependency]
|
|
111
|
+
def current_dependencies: () -> Array[Dependency]
|
|
112
|
+
def requested_dependencies: () -> Array[Dependency]
|
|
113
|
+
def dependencies_for: (untyped groups) -> Array[Dependency]
|
|
114
|
+
def specs: () -> untyped
|
|
115
|
+
def specs_for: (untyped groups) -> untyped
|
|
116
|
+
def missing_specs: () -> untyped
|
|
117
|
+
def validate_runtime!: () -> untyped
|
|
118
|
+
def check!: () -> untyped
|
|
119
|
+
def lock: (?untyped) -> untyped
|
|
120
|
+
def write_lock: () -> untyped
|
|
121
|
+
def to_lock: () -> String
|
|
122
|
+
def resolve: () -> untyped
|
|
123
|
+
def resolve_with_cache!: () -> untyped
|
|
124
|
+
def resolve_remotely!: () -> untyped
|
|
125
|
+
def remotely!: () -> untyped
|
|
126
|
+
def ensure_equivalent_gemfile_and_lockfile: (?bool) -> untyped
|
|
127
|
+
def normalize_platforms: () -> untyped
|
|
128
|
+
def platforms: () -> Array[untyped]
|
|
129
|
+
def add_platform: (untyped) -> untyped
|
|
130
|
+
def remove_platform: (untyped) -> untyped
|
|
131
|
+
def add_checksums: () -> untyped
|
|
132
|
+
def groups: () -> Array[Symbol]
|
|
133
|
+
def ruby_version: () -> untyped
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
class LockfileParser
|
|
137
|
+
def initialize: (String body) -> void
|
|
138
|
+
def specs: () -> Array[LazySpecification]
|
|
139
|
+
def platforms: () -> Array[untyped]
|
|
140
|
+
def sources: () -> Array[untyped]
|
|
141
|
+
def dependencies: () -> Array[Dependency]
|
|
142
|
+
def ruby_version: () -> untyped
|
|
143
|
+
def bundler_version: () -> untyped
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
class LazySpecification
|
|
147
|
+
def name: () -> String
|
|
148
|
+
def version: () -> Gem::Version
|
|
149
|
+
def platform: () -> untyped
|
|
150
|
+
def dependencies: () -> Array[Gem::Dependency]
|
|
151
|
+
def source: () -> untyped
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
class Dependency < Gem::Dependency
|
|
155
|
+
attr_reader autorequire: Array[String]?
|
|
156
|
+
attr_reader source: untyped
|
|
157
|
+
attr_reader groups: Array[Symbol]
|
|
158
|
+
attr_reader platforms: Array[Symbol]
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
class ConfigFile
|
|
162
|
+
def []: (*untyped) -> untyped
|
|
163
|
+
def []=: (*untyped) -> untyped
|
|
164
|
+
def set_global: (untyped, untyped) -> untyped
|
|
165
|
+
def set_local: (untyped, untyped) -> untyped
|
|
166
|
+
def all: () -> Hash[String, untyped]
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
module Source
|
|
170
|
+
class Gemspec
|
|
171
|
+
def initialize: (*untyped) -> void
|
|
172
|
+
attr_accessor name: String?
|
|
173
|
+
attr_accessor version: String?
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
class Path
|
|
177
|
+
def initialize: (*untyped) -> void
|
|
178
|
+
attr_accessor name: String?
|
|
179
|
+
attr_accessor version: String?
|
|
180
|
+
attr_accessor path: String?
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
class Git
|
|
184
|
+
def initialize: (*untyped) -> void
|
|
185
|
+
attr_accessor uri: String?
|
|
186
|
+
attr_accessor branch: String?
|
|
187
|
+
attr_accessor ref: String?
|
|
188
|
+
attr_accessor submodules: bool
|
|
189
|
+
attr_accessor glob: String?
|
|
190
|
+
attr_accessor name: String?
|
|
191
|
+
attr_accessor version: String?
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
class Rubygems
|
|
195
|
+
def initialize: (*untyped) -> void
|
|
196
|
+
attr_accessor remotes: Array[String]
|
|
197
|
+
attr_accessor name: String?
|
|
198
|
+
attr_accessor version: String?
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
module UI
|
|
203
|
+
class Shell
|
|
204
|
+
def initialize: (?untyped) -> void
|
|
205
|
+
def info: (untyped, ?bool newline) -> void
|
|
206
|
+
def confirm: (untyped, ?bool newline) -> void
|
|
207
|
+
def warn: (untyped, ?bool newline) -> void
|
|
208
|
+
def debug: (untyped, ?bool newline) -> void
|
|
209
|
+
def debug?: () -> bool
|
|
210
|
+
def error: (untyped, ?bool newline) -> void
|
|
211
|
+
def trace: (untyped, ?untyped newline, ?bool force) -> void
|
|
212
|
+
def silence: () { () -> untyped } -> untyped
|
|
213
|
+
def ask: (untyped) -> String?
|
|
214
|
+
def yes?: (untyped) -> bool
|
|
215
|
+
def no?: () -> bool
|
|
216
|
+
def level: (?String name) -> String
|
|
217
|
+
def level=: (untyped) -> untyped
|
|
218
|
+
def quiet?: () -> bool
|
|
219
|
+
def quiet=: (bool) -> bool
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
class RGProxy
|
|
223
|
+
def initialize: (?untyped) -> void
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
class GemfileError < StandardError
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
class GemfileNotFound < StandardError
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
class LockfileError < StandardError
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
class GemNotFound < StandardError
|
|
237
|
+
end
|
|
238
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Rigor-side supplement to the rbs gem's
|
|
3
|
+
# `stdlib/cgi/0/core.rbs` declarations.
|
|
4
|
+
#
|
|
5
|
+
# Re-opens `class CGI` to bring in the instance methods that
|
|
6
|
+
# real-world Ruby code calls on a CGI instance: `params`,
|
|
7
|
+
# `params=`, `cookies`, `cookies=`, `multipart?`, `query_string`,
|
|
8
|
+
# the parsed-request bits.
|
|
9
|
+
#
|
|
10
|
+
# Why this isn't already in the upstream RBS: at runtime
|
|
11
|
+
# `CGI#initialize` does `extend CGI::QueryExtension`, which
|
|
12
|
+
# attaches the methods to each instance via singleton-class
|
|
13
|
+
# inheritance. The static-RBS surface can't represent
|
|
14
|
+
# per-instance `extend` calls. Declaring `class CGI; include
|
|
15
|
+
# CGI::QueryExtension; end` here is a deliberate
|
|
16
|
+
# over-approximation that matches the real surface every CGI
|
|
17
|
+
# instance you actually use (you got it from `CGI.new`) has.
|
|
18
|
+
#
|
|
19
|
+
# Driven by the tdiary-core survey
|
|
20
|
+
# (`docs/notes/20260519-oss-library-survey.md`) where
|
|
21
|
+
# `lib/tdiary/core_ext.rb:62`'s `cgi.params['key']` /
|
|
22
|
+
# `self.params[param]` surfaced as `undefined method 'params'
|
|
23
|
+
# for CGI` (3 errors per call site, 6 total).
|
|
24
|
+
#
|
|
25
|
+
# Adds new declarations only — never redeclares anything the
|
|
26
|
+
# upstream RBS already covers, so the loader does not raise
|
|
27
|
+
# `RBS::DuplicatedDeclarationError`. `include` is permitted
|
|
28
|
+
# because the upstream `class CGI` declaration already does
|
|
29
|
+
# `include CGI::Util` + `extend CGI::Util`; adding a sibling
|
|
30
|
+
# `include CGI::QueryExtension` is purely additive.
|
|
31
|
+
#
|
|
32
|
+
class CGI
|
|
33
|
+
include CGI::QueryExtension
|
|
34
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Rigor-side supplement to the rbs gem's
|
|
3
|
+
# `stdlib/did_you_mean/0/did_you_mean.rbs` declarations.
|
|
4
|
+
#
|
|
5
|
+
# Re-opens `module DidYouMean` to add the top-level singleton
|
|
6
|
+
# methods the upstream RBS omits — every method below is defined
|
|
7
|
+
# in `lib/did_you_mean.rb` and called by rubygems / bundler /
|
|
8
|
+
# optparse / thor without an RBS declaration to back it.
|
|
9
|
+
#
|
|
10
|
+
# Adds new declarations only; never redeclares anything the
|
|
11
|
+
# upstream RBS already covers, so the loader does not raise
|
|
12
|
+
# `RBS::DuplicatedDeclarationError`.
|
|
13
|
+
#
|
|
14
|
+
module DidYouMean
|
|
15
|
+
# Sharable hash of error-class names to spell-checker objects.
|
|
16
|
+
# Defaults to `Hash.new(NullChecker)` — the value's runtime
|
|
17
|
+
# default makes any missing-key lookup return `NullChecker`.
|
|
18
|
+
def self.spell_checkers: () -> Hash[String, untyped]
|
|
19
|
+
|
|
20
|
+
# `correct_error(error_class, spell_checker)` registers a
|
|
21
|
+
# spell-checker for the named error class, prepending
|
|
22
|
+
# `Correctable` to it when the class doesn't already include
|
|
23
|
+
# it. Returns the registered spell_checker (the assignment's
|
|
24
|
+
# value).
|
|
25
|
+
def self.correct_error: (untyped error_class, untyped spell_checker) -> untyped
|
|
26
|
+
|
|
27
|
+
# The active formatter. Returns the per-Ractor override when
|
|
28
|
+
# one is set; otherwise `DidYouMean::Formatter` (the module).
|
|
29
|
+
def self.formatter: () -> untyped
|
|
30
|
+
|
|
31
|
+
# Per-Ractor formatter override. Returns the assigned
|
|
32
|
+
# formatter under Ractor; nil otherwise.
|
|
33
|
+
def self.formatter=: (untyped) -> untyped
|
|
34
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Minimal hand-authored RBS stub for the `idn-ruby` gem
|
|
2
|
+
# (libidn binding for Internationalised Domain Names).
|
|
3
|
+
#
|
|
4
|
+
# `idn-ruby` is not in `ruby/gem_rbs_collection` as of 2026-05-15.
|
|
5
|
+
# Authorship: hand-written by Rigor maintainers based on the
|
|
6
|
+
# upstream README (https://github.com/idnruby/idn-ruby).
|
|
7
|
+
|
|
8
|
+
module IDN
|
|
9
|
+
VERSION: String
|
|
10
|
+
|
|
11
|
+
class Error < StandardError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class Stringprep
|
|
15
|
+
class StringprepError < IDN::Error
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
NAMEPREP: String
|
|
19
|
+
ISCSIPREP: String
|
|
20
|
+
NODEPREP: String
|
|
21
|
+
RESOURCEPREP: String
|
|
22
|
+
PLAIN: String
|
|
23
|
+
TRACE: String
|
|
24
|
+
SASLPREP: String
|
|
25
|
+
|
|
26
|
+
def self.with_profile: (String profile, String input) -> String
|
|
27
|
+
def self.nameprep: (String input) -> String
|
|
28
|
+
def self.iscsiprep: (String input) -> String
|
|
29
|
+
def self.nodeprep: (String input) -> String
|
|
30
|
+
def self.resourceprep: (String input) -> String
|
|
31
|
+
def self.plain: (String input) -> String
|
|
32
|
+
def self.trace: (String input) -> String
|
|
33
|
+
def self.saslprep: (String input) -> String
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Punycode
|
|
37
|
+
class PunycodeError < IDN::Error
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.encode: (String input) -> String
|
|
41
|
+
def self.decode: (String input) -> String
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class Idna
|
|
45
|
+
class IdnaError < IDN::Error
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
ALLOW_UNASSIGNED: Integer
|
|
49
|
+
USE_STD3_ASCII_RULES: Integer
|
|
50
|
+
|
|
51
|
+
def self.toASCII: (String input, ?Integer flags) -> String
|
|
52
|
+
def self.toUnicode: (String input, ?Integer flags) -> String
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Mysql2
|
|
2
|
+
class Client[ResultType]
|
|
3
|
+
MULTI_STATEMENTS: Integer
|
|
4
|
+
|
|
5
|
+
self.@default_query_options: untyped
|
|
6
|
+
|
|
7
|
+
@read_timeout: untyped
|
|
8
|
+
|
|
9
|
+
@query_options: untyped
|
|
10
|
+
|
|
11
|
+
attr_reader query_options: untyped
|
|
12
|
+
|
|
13
|
+
attr_reader read_timeout: untyped
|
|
14
|
+
|
|
15
|
+
def self.default_query_options: () -> untyped
|
|
16
|
+
|
|
17
|
+
def initialize: (Hash[(String | Symbol), untyped] opts) -> void
|
|
18
|
+
|
|
19
|
+
def self.new: (as: :hash, **untyped) -> Mysql2::Client[Mysql2::ResultAsHash]
|
|
20
|
+
| (as: :array, **untyped) -> Mysql2::Client[Mysql2::ResultAsArray]
|
|
21
|
+
| (as: Symbol, **untyped) -> Mysql2::Client[Mysql2::ResultAsHash | Mysql2::ResultAsArray]
|
|
22
|
+
| (**untyped) -> Mysql2::Client[Mysql2::ResultAsHash]
|
|
23
|
+
|
|
24
|
+
def parse_ssl_mode: (untyped mode) -> untyped
|
|
25
|
+
|
|
26
|
+
def parse_flags_array: (untyped flags, ?::Integer initial) -> untyped
|
|
27
|
+
|
|
28
|
+
# Find any default system CA paths to handle system roots
|
|
29
|
+
# by default if stricter validation is requested and no
|
|
30
|
+
# path is provide.
|
|
31
|
+
def find_default_ca_path: () -> untyped
|
|
32
|
+
|
|
33
|
+
# Set default program_name in performance_schema.session_connect_attrs
|
|
34
|
+
# and performance_schema.session_account_connect_attrs
|
|
35
|
+
def parse_connect_attrs: (untyped conn_attrs) -> (::Hash[untyped, untyped] | untyped)
|
|
36
|
+
|
|
37
|
+
def query: (String sql, as: :hash, **untyped) -> ResultAsHash
|
|
38
|
+
| (String sql, as: :array, **untyped) -> ResultAsArray
|
|
39
|
+
| (String sql, **untyped) -> ResultType
|
|
40
|
+
|
|
41
|
+
def query_info: () -> (::Hash[untyped, untyped] | untyped)
|
|
42
|
+
|
|
43
|
+
def info: () -> untyped
|
|
44
|
+
|
|
45
|
+
def last_id: () -> Integer
|
|
46
|
+
|
|
47
|
+
def affected_rows: () -> Integer
|
|
48
|
+
|
|
49
|
+
def prepare: (String sql) -> Mysql2::Statement
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def self.local_offset: () -> untyped
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Mysql2
|
|
2
|
+
type row_value_type = String | Integer | BigDecimal | Float | Time | Date | nil
|
|
3
|
+
|
|
4
|
+
class ResultAsHash
|
|
5
|
+
attr_reader server_flags: untyped
|
|
6
|
+
|
|
7
|
+
# NOTE:
|
|
8
|
+
# The type of key is controlled by `symbolize_keys` option of `Mysql2::Client.new`.
|
|
9
|
+
# It can be expressed using a type argument such as `Client[ResultType]`,
|
|
10
|
+
# but since the state becomes complicated. So `String | Symbol` is allowed.
|
|
11
|
+
type key_type = String | Symbol
|
|
12
|
+
|
|
13
|
+
include Enumerable[Hash[key_type, row_value_type]]
|
|
14
|
+
|
|
15
|
+
def each: () { (Hash[key_type, row_value_type]) -> void } -> void
|
|
16
|
+
def count: () -> Integer
|
|
17
|
+
def to_a: () -> Array[untyped]
|
|
18
|
+
alias size count
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class ResultAsArray
|
|
22
|
+
attr_reader server_flags: untyped
|
|
23
|
+
|
|
24
|
+
include Enumerable[Array[row_value_type]]
|
|
25
|
+
|
|
26
|
+
def each: () { (Array[row_value_type]) -> void } -> void
|
|
27
|
+
def count: () -> Integer
|
|
28
|
+
def to_a: () -> Array[untyped]
|
|
29
|
+
alias size count
|
|
30
|
+
end
|
|
31
|
+
end
|