rigortype 0.0.9 → 0.1.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 +45 -2
- data/data/builtins/ruby_core/array.yml +6 -6
- data/data/builtins/ruby_core/hash.yml +1 -1
- data/data/builtins/ruby_core/io.yml +3 -3
- data/data/builtins/ruby_core/numeric.yml +1 -1
- data/data/builtins/ruby_core/pathname.yml +100 -100
- data/data/builtins/ruby_core/proc.yml +1 -1
- data/data/builtins/ruby_core/time.yml +3 -3
- data/lib/rigor/analysis/check_rules.rb +228 -40
- data/lib/rigor/analysis/diagnostic.rb +15 -1
- data/lib/rigor/analysis/runner.rb +269 -7
- data/lib/rigor/builtins/regex_refinement.rb +104 -0
- data/lib/rigor/cache/rbs_class_ancestor_table.rb +1 -1
- data/lib/rigor/cache/rbs_class_type_param_names.rb +1 -1
- data/lib/rigor/cache/rbs_constant_table.rb +2 -2
- data/lib/rigor/cache/rbs_descriptor.rb +2 -0
- data/lib/rigor/cache/rbs_instance_definitions.rb +79 -0
- data/lib/rigor/cache/store.rb +2 -0
- data/lib/rigor/cli/type_of_command.rb +3 -3
- data/lib/rigor/cli/type_scan_command.rb +4 -4
- data/lib/rigor/cli.rb +20 -7
- data/lib/rigor/configuration/severity_profile.rb +109 -0
- data/lib/rigor/configuration.rb +286 -15
- data/lib/rigor/environment/rbs_loader.rb +89 -13
- data/lib/rigor/environment.rb +12 -4
- data/lib/rigor/flow_contribution/conflict.rb +81 -0
- data/lib/rigor/flow_contribution/element.rb +53 -0
- data/lib/rigor/flow_contribution/fact.rb +88 -0
- data/lib/rigor/flow_contribution/merge_result.rb +67 -0
- data/lib/rigor/flow_contribution/merger.rb +275 -0
- data/lib/rigor/flow_contribution.rb +51 -0
- data/lib/rigor/inference/block_parameter_binder.rb +15 -0
- data/lib/rigor/inference/expression_typer.rb +87 -6
- data/lib/rigor/inference/method_dispatcher/kernel_dispatch.rb +31 -0
- data/lib/rigor/inference/method_dispatcher/literal_string_folding.rb +136 -9
- data/lib/rigor/inference/method_dispatcher/rbs_dispatch.rb +21 -1
- data/lib/rigor/inference/method_dispatcher/shape_dispatch.rb +68 -2
- data/lib/rigor/inference/method_dispatcher.rb +50 -1
- data/lib/rigor/inference/multi_target_binder.rb +2 -0
- data/lib/rigor/inference/narrowing.rb +246 -127
- data/lib/rigor/inference/scope_indexer.rb +124 -16
- data/lib/rigor/inference/statement_evaluator.rb +406 -37
- data/lib/rigor/plugin/access_denied_error.rb +24 -0
- data/lib/rigor/plugin/base.rb +284 -0
- data/lib/rigor/plugin/fact_store.rb +92 -0
- data/lib/rigor/plugin/io_boundary.rb +102 -0
- data/lib/rigor/plugin/load_error.rb +35 -0
- data/lib/rigor/plugin/loader.rb +307 -0
- data/lib/rigor/plugin/manifest.rb +203 -0
- data/lib/rigor/plugin/registry.rb +50 -0
- data/lib/rigor/plugin/services.rb +77 -0
- data/lib/rigor/plugin/trust_policy.rb +99 -0
- data/lib/rigor/plugin.rb +62 -0
- data/lib/rigor/rbs_extended.rb +57 -9
- data/lib/rigor/reflection.rb +2 -2
- data/lib/rigor/trinary.rb +1 -1
- data/lib/rigor/type/integer_range.rb +6 -2
- data/lib/rigor/version.rb +1 -1
- data/lib/rigor.rb +7 -0
- data/sig/rigor/environment.rbs +10 -3
- data/sig/rigor/inference.rbs +1 -0
- data/sig/rigor/rbs_extended.rbs +2 -0
- data/sig/rigor/scope.rbs +1 -0
- data/sig/rigor/type.rbs +7 -0
- data/sig/rigor.rbs +8 -2
- metadata +20 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rigor
|
|
4
|
+
module Plugin
|
|
5
|
+
# Declarative trust / I/O policy for the active plugin set.
|
|
6
|
+
# Pinned by [ADR-2 § "Plugin Trust and I/O Policy"](../../../docs/adr/2-extension-api.md):
|
|
7
|
+
# plugins are *trusted Ruby gems selected by the user, their
|
|
8
|
+
# Gemfile, or project configuration*; this class is the
|
|
9
|
+
# programmatic surface that documents that trust and lets the
|
|
10
|
+
# analyzer enforce read scope + network disablement at the
|
|
11
|
+
# documented edges.
|
|
12
|
+
#
|
|
13
|
+
# The policy is **not a sandbox.** A plugin that uses raw
|
|
14
|
+
# `File.read` or `Net::HTTP` bypasses the policy — ADR-2
|
|
15
|
+
# explicitly chooses documentation over forced isolation. The
|
|
16
|
+
# contract is: when plugins go through {Rigor::Plugin::IoBoundary}
|
|
17
|
+
# (the analyzer-side helper service slice 2 introduces), the
|
|
18
|
+
# boundary checks against this policy and feeds compliant reads
|
|
19
|
+
# into the cache descriptor for invalidation. Slices 3-6 wire
|
|
20
|
+
# plugin contributions through the boundary so the policy is
|
|
21
|
+
# the actual mechanism, not just paperwork.
|
|
22
|
+
#
|
|
23
|
+
# ## Fields
|
|
24
|
+
#
|
|
25
|
+
# - `trusted_gems`: gem names the user has authorised. Derived
|
|
26
|
+
# from the `plugins:` section of `.rigor.yml` plus any gems
|
|
27
|
+
# they reach transitively. Used today for documentation and
|
|
28
|
+
# future trust diagnostics.
|
|
29
|
+
# - `allowed_read_roots`: absolute paths plugin code may read
|
|
30
|
+
# from through the {IoBoundary}. The default set covers the
|
|
31
|
+
# project root, the project's `signature_paths`, the active
|
|
32
|
+
# `Gemfile.lock`, and each trusted gem's
|
|
33
|
+
# `Gem::Specification#full_gem_path`. The user extends this
|
|
34
|
+
# with `.rigor.yml`'s `plugins_io.allowed_paths:`.
|
|
35
|
+
# - `network_policy`: `:disabled` in slice 2; the only value
|
|
36
|
+
# accepted today. Plugin {IoBoundary#open_url} always raises
|
|
37
|
+
# while the policy is `:disabled`.
|
|
38
|
+
class TrustPolicy
|
|
39
|
+
VALID_NETWORK_POLICIES = %i[disabled].freeze
|
|
40
|
+
|
|
41
|
+
attr_reader :trusted_gems, :allowed_read_roots, :network_policy
|
|
42
|
+
|
|
43
|
+
def initialize(trusted_gems: [], allowed_read_roots: [], network_policy: :disabled)
|
|
44
|
+
validate_network_policy!(network_policy)
|
|
45
|
+
|
|
46
|
+
@trusted_gems = trusted_gems.map { |g| g.to_s.dup.freeze }.uniq.sort.freeze
|
|
47
|
+
@allowed_read_roots = allowed_read_roots
|
|
48
|
+
.map { |path| File.expand_path(path).freeze }
|
|
49
|
+
.uniq
|
|
50
|
+
.sort
|
|
51
|
+
.freeze
|
|
52
|
+
@network_policy = network_policy
|
|
53
|
+
freeze
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @param path [String]
|
|
57
|
+
# @return [Boolean] true when the absolute path falls inside
|
|
58
|
+
# any allowed read root. Symlinks are resolved through
|
|
59
|
+
# `File.expand_path` only (no `realpath`); plugins with
|
|
60
|
+
# adversarial intent are out of scope per ADR-2.
|
|
61
|
+
def allow_read?(path)
|
|
62
|
+
absolute = File.expand_path(path.to_s)
|
|
63
|
+
@allowed_read_roots.any? { |root| inside?(absolute, root) }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def network_allowed?
|
|
67
|
+
@network_policy != :disabled
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def gem_trusted?(name)
|
|
71
|
+
@trusted_gems.include?(name.to_s)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def to_h
|
|
75
|
+
{
|
|
76
|
+
"trusted_gems" => trusted_gems,
|
|
77
|
+
"allowed_read_roots" => allowed_read_roots,
|
|
78
|
+
"network_policy" => network_policy.to_s
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
def validate_network_policy!(policy)
|
|
85
|
+
return if VALID_NETWORK_POLICIES.include?(policy)
|
|
86
|
+
|
|
87
|
+
raise ArgumentError,
|
|
88
|
+
"TrustPolicy network_policy must be one of #{VALID_NETWORK_POLICIES.inspect}, got #{policy.inspect}"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def inside?(absolute, root)
|
|
92
|
+
return true if absolute == root
|
|
93
|
+
|
|
94
|
+
prefix = "#{root}#{File::SEPARATOR}"
|
|
95
|
+
absolute.start_with?(prefix)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
data/lib/rigor/plugin.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "plugin/manifest"
|
|
4
|
+
require_relative "plugin/access_denied_error"
|
|
5
|
+
require_relative "plugin/trust_policy"
|
|
6
|
+
require_relative "plugin/io_boundary"
|
|
7
|
+
require_relative "plugin/fact_store"
|
|
8
|
+
require_relative "plugin/services"
|
|
9
|
+
require_relative "plugin/base"
|
|
10
|
+
require_relative "plugin/registry"
|
|
11
|
+
require_relative "plugin/load_error"
|
|
12
|
+
|
|
13
|
+
module Rigor
|
|
14
|
+
module Plugin
|
|
15
|
+
@registered = {}
|
|
16
|
+
@mutex = Mutex.new
|
|
17
|
+
|
|
18
|
+
class << self
|
|
19
|
+
def register(plugin_class)
|
|
20
|
+
unless plugin_class.is_a?(Class) && plugin_class < Base
|
|
21
|
+
raise ArgumentError,
|
|
22
|
+
"Rigor::Plugin.register expects a subclass of Rigor::Plugin::Base, got #{plugin_class.inspect}"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
manifest = plugin_class.manifest # rigor:disable undefined-method
|
|
26
|
+
@mutex.synchronize do
|
|
27
|
+
existing = @registered[manifest.id]
|
|
28
|
+
if existing && existing != plugin_class
|
|
29
|
+
raise LoadError.new(
|
|
30
|
+
"plugin id #{manifest.id.inspect} already registered to #{existing}, " \
|
|
31
|
+
"cannot re-register to #{plugin_class}",
|
|
32
|
+
plugin_ref: manifest.id
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
@registered[manifest.id] = plugin_class
|
|
37
|
+
end
|
|
38
|
+
plugin_class
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def registered_for(id)
|
|
42
|
+
@mutex.synchronize { @registered[id.to_s] }
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def registered
|
|
46
|
+
@mutex.synchronize { @registered.dup.freeze }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def unregister!(id = nil)
|
|
50
|
+
@mutex.synchronize do
|
|
51
|
+
if id.nil?
|
|
52
|
+
@registered.clear
|
|
53
|
+
else
|
|
54
|
+
@registered.delete(id.to_s)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
require_relative "plugin/loader"
|
data/lib/rigor/rbs_extended.rb
CHANGED
|
@@ -64,6 +64,23 @@ module Rigor
|
|
|
64
64
|
def falsey_only? = edge == :falsey_only
|
|
65
65
|
def negative? = negative == true
|
|
66
66
|
def refinement? = !refinement_type.nil?
|
|
67
|
+
|
|
68
|
+
# ADR-7 § "Slice 4-A" canonical translation. Lifts the
|
|
69
|
+
# parser-side carrier into a `Rigor::FlowContribution::Fact`
|
|
70
|
+
# that the merger and plugin contribution stream consume
|
|
71
|
+
# uniformly. `class_name` lifts to `Nominal[<class>]`;
|
|
72
|
+
# `refinement_type` is already a `Rigor::Type` and passes
|
|
73
|
+
# through. The `edge` field doesn't survive the conversion —
|
|
74
|
+
# the slot it lands in (truthy_facts / falsey_facts / ...)
|
|
75
|
+
# encodes that.
|
|
76
|
+
def to_fact
|
|
77
|
+
FlowContribution::Fact.new(
|
|
78
|
+
target_kind: target_kind,
|
|
79
|
+
target_name: target_name,
|
|
80
|
+
type: refinement_type || Rigor::Type::Combinator.nominal_of(class_name),
|
|
81
|
+
negative: negative == true
|
|
82
|
+
)
|
|
83
|
+
end
|
|
67
84
|
end
|
|
68
85
|
|
|
69
86
|
# Returned for `assert` / `assert-if-true` /
|
|
@@ -87,6 +104,21 @@ module Rigor
|
|
|
87
104
|
def if_falsey_return? = condition == :if_falsey_return
|
|
88
105
|
def negative? = negative == true
|
|
89
106
|
def refinement? = !refinement_type.nil?
|
|
107
|
+
|
|
108
|
+
# ADR-7 § "Slice 4-A" canonical translation. Same shape as
|
|
109
|
+
# `PredicateEffect#to_fact`; the `condition` field
|
|
110
|
+
# (`:always` / `:if_truthy_return` / `:if_falsey_return`)
|
|
111
|
+
# routes which slot the resulting fact lands in at the
|
|
112
|
+
# `read_flow_contribution` boundary, but does not surface
|
|
113
|
+
# on the Fact itself.
|
|
114
|
+
def to_fact
|
|
115
|
+
FlowContribution::Fact.new(
|
|
116
|
+
target_kind: target_kind,
|
|
117
|
+
target_name: target_name,
|
|
118
|
+
type: refinement_type || Rigor::Type::Combinator.nominal_of(class_name),
|
|
119
|
+
negative: negative == true
|
|
120
|
+
)
|
|
121
|
+
end
|
|
90
122
|
end
|
|
91
123
|
|
|
92
124
|
module_function
|
|
@@ -425,12 +457,16 @@ module Rigor
|
|
|
425
457
|
).freeze
|
|
426
458
|
|
|
427
459
|
# Rolls up every recognised RBS::Extended directive on
|
|
428
|
-
# `method_def` into a single {Rigor::FlowContribution}
|
|
460
|
+
# `method_def` into a single {Rigor::FlowContribution} with
|
|
461
|
+
# the canonical {Rigor::FlowContribution::Fact} payload (see
|
|
462
|
+
# ADR-7 § "Slice 4-A"):
|
|
429
463
|
#
|
|
430
|
-
# - `predicate-if-true`
|
|
431
|
-
# - `predicate-if-false`
|
|
432
|
-
# - `assert
|
|
433
|
-
# - `
|
|
464
|
+
# - `predicate-if-true` → `truthy_facts`
|
|
465
|
+
# - `predicate-if-false` → `falsey_facts`
|
|
466
|
+
# - `assert` → `post_return_facts`
|
|
467
|
+
# - `assert-if-true` → `truthy_facts`
|
|
468
|
+
# - `assert-if-false` → `falsey_facts`
|
|
469
|
+
# - `return:` override → `return_type` (`Rigor::Type`)
|
|
434
470
|
#
|
|
435
471
|
# Param overrides are intentionally NOT included — they refine
|
|
436
472
|
# the call's signature contract rather than its flow facts and
|
|
@@ -452,12 +488,24 @@ module Rigor
|
|
|
452
488
|
build_flow_contribution(predicate_effects, assert_effects, return_override)
|
|
453
489
|
end
|
|
454
490
|
|
|
455
|
-
def build_flow_contribution(predicate_effects, assert_effects, return_override)
|
|
491
|
+
def build_flow_contribution(predicate_effects, assert_effects, return_override) # rubocop:disable Metrics/CyclomaticComplexity
|
|
492
|
+
truthy = predicate_effects.select(&:truthy_only?).map(&:to_fact)
|
|
493
|
+
falsey = predicate_effects.select(&:falsey_only?).map(&:to_fact)
|
|
494
|
+
post_return = []
|
|
495
|
+
|
|
496
|
+
assert_effects.each do |effect|
|
|
497
|
+
case effect.condition
|
|
498
|
+
when :if_truthy_return then truthy << effect.to_fact
|
|
499
|
+
when :if_falsey_return then falsey << effect.to_fact
|
|
500
|
+
else post_return << effect.to_fact
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
|
|
456
504
|
FlowContribution.new(
|
|
457
505
|
return_type: return_override,
|
|
458
|
-
truthy_facts: nilable_slot(
|
|
459
|
-
falsey_facts: nilable_slot(
|
|
460
|
-
post_return_facts: nilable_slot(
|
|
506
|
+
truthy_facts: nilable_slot(truthy),
|
|
507
|
+
falsey_facts: nilable_slot(falsey),
|
|
508
|
+
post_return_facts: nilable_slot(post_return),
|
|
461
509
|
provenance: RBS_EXTENDED_PROVENANCE
|
|
462
510
|
)
|
|
463
511
|
end
|
data/lib/rigor/reflection.rb
CHANGED
|
@@ -147,7 +147,7 @@ module Rigor
|
|
|
147
147
|
return nil if loader.nil?
|
|
148
148
|
|
|
149
149
|
loader.instance_definition(class_name.to_s)
|
|
150
|
-
rescue
|
|
150
|
+
rescue ::RBS::BaseError
|
|
151
151
|
nil
|
|
152
152
|
end
|
|
153
153
|
|
|
@@ -157,7 +157,7 @@ module Rigor
|
|
|
157
157
|
return nil if loader.nil?
|
|
158
158
|
|
|
159
159
|
loader.singleton_definition(class_name.to_s)
|
|
160
|
-
rescue
|
|
160
|
+
rescue ::RBS::BaseError
|
|
161
161
|
nil
|
|
162
162
|
end
|
|
163
163
|
|
data/lib/rigor/trinary.rb
CHANGED
|
@@ -66,12 +66,16 @@ module Rigor
|
|
|
66
66
|
# `:neg_infinity` directly with an `Integer`.
|
|
67
67
|
def lower
|
|
68
68
|
m = min
|
|
69
|
-
m.is_a?(
|
|
69
|
+
return m if m.is_a?(Integer)
|
|
70
|
+
|
|
71
|
+
-Float::INFINITY
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
def upper
|
|
73
75
|
m = max
|
|
74
|
-
m.is_a?(
|
|
76
|
+
return m if m.is_a?(Integer)
|
|
77
|
+
|
|
78
|
+
Float::INFINITY
|
|
75
79
|
end
|
|
76
80
|
|
|
77
81
|
ALIAS_NAMES = {
|
data/lib/rigor/version.rb
CHANGED
data/lib/rigor.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative "rigor/version"
|
|
4
4
|
require_relative "rigor/configuration"
|
|
5
|
+
require_relative "rigor/configuration/severity_profile"
|
|
5
6
|
require_relative "rigor/trinary"
|
|
6
7
|
require_relative "rigor/type"
|
|
7
8
|
require_relative "rigor/ast"
|
|
@@ -27,7 +28,13 @@ require_relative "rigor/cache/rbs_known_class_names"
|
|
|
27
28
|
require_relative "rigor/cache/rbs_class_ancestor_table"
|
|
28
29
|
require_relative "rigor/cache/rbs_class_type_param_names"
|
|
29
30
|
require_relative "rigor/cache/rbs_environment"
|
|
31
|
+
require_relative "rigor/cache/rbs_instance_definitions"
|
|
30
32
|
require_relative "rigor/flow_contribution"
|
|
33
|
+
require_relative "rigor/flow_contribution/fact"
|
|
34
|
+
require_relative "rigor/flow_contribution/conflict"
|
|
35
|
+
require_relative "rigor/flow_contribution/merge_result"
|
|
36
|
+
require_relative "rigor/flow_contribution/merger"
|
|
37
|
+
require_relative "rigor/plugin"
|
|
31
38
|
require_relative "rigor/source"
|
|
32
39
|
require_relative "rigor/inference/scope_indexer"
|
|
33
40
|
require_relative "rigor/inference/coverage_scanner"
|
data/sig/rigor/environment.rbs
CHANGED
|
@@ -6,11 +6,12 @@ module Rigor
|
|
|
6
6
|
|
|
7
7
|
attr_reader class_registry: ClassRegistry
|
|
8
8
|
attr_reader rbs_loader: RbsLoader?
|
|
9
|
+
attr_reader plugin_registry: untyped?
|
|
9
10
|
|
|
10
11
|
def self.default: () -> Environment
|
|
11
|
-
def self.for_project: (?root: String, ?libraries: Array[String], ?signature_paths: Array[String | _ToPath]?) -> Environment
|
|
12
|
+
def self.for_project: (?root: String, ?libraries: Array[String], ?signature_paths: Array[String | _ToPath]?, ?cache_store: untyped?, ?plugin_registry: untyped?) -> Environment
|
|
12
13
|
|
|
13
|
-
def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?) -> void
|
|
14
|
+
def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?, ?plugin_registry: untyped?) -> void
|
|
14
15
|
def nominal_for_name: (String | Symbol name) -> Type::Nominal?
|
|
15
16
|
def singleton_for_name: (String | Symbol name) -> Type::Singleton?
|
|
16
17
|
def constant_for_name: (String | Symbol name) -> Type::t?
|
|
@@ -32,19 +33,25 @@ module Rigor
|
|
|
32
33
|
class RbsLoader
|
|
33
34
|
attr_reader libraries: Array[String]
|
|
34
35
|
attr_reader signature_paths: Array[String | _ToPath]
|
|
36
|
+
attr_reader cache_store: untyped?
|
|
35
37
|
|
|
36
38
|
def self.default: () -> RbsLoader
|
|
37
39
|
def self.reset_default!: () -> void
|
|
40
|
+
def self.build_env_for: (libraries: Array[String], signature_paths: Array[String | _ToPath]) -> untyped
|
|
38
41
|
|
|
39
|
-
def initialize: (?libraries: Array[String], ?signature_paths: Array[String | _ToPath]) -> void
|
|
42
|
+
def initialize: (?libraries: Array[String], ?signature_paths: Array[String | _ToPath], ?cache_store: untyped?) -> void
|
|
40
43
|
def class_known?: (String | Symbol name) -> bool
|
|
41
44
|
def instance_definition: (String | Symbol class_name) -> untyped?
|
|
42
45
|
def instance_method: (class_name: String | Symbol, method_name: String | Symbol) -> untyped?
|
|
46
|
+
def uncached_instance_definition: (String | Symbol class_name) -> untyped?
|
|
43
47
|
def singleton_definition: (String | Symbol class_name) -> untyped?
|
|
44
48
|
def singleton_method: (class_name: String | Symbol, method_name: String | Symbol) -> untyped?
|
|
49
|
+
def uncached_singleton_definition: (String | Symbol class_name) -> untyped?
|
|
45
50
|
def class_type_param_names: (String | Symbol class_name) -> Array[Symbol]
|
|
46
51
|
def class_ordering: (String | Symbol lhs, String | Symbol rhs) -> ordering
|
|
47
52
|
def constant_type: (String name) -> Type::t?
|
|
53
|
+
def constant_names: () -> Array[String]
|
|
54
|
+
def each_known_class_name: () { (String name) -> void } -> untyped
|
|
48
55
|
end
|
|
49
56
|
|
|
50
57
|
class RbsHierarchy
|
data/sig/rigor/inference.rbs
CHANGED
|
@@ -86,6 +86,7 @@ module Rigor
|
|
|
86
86
|
def self?.narrow_class: (Type::t type, String class_name, ?exact: bool, ?environment: Environment) -> Type::t
|
|
87
87
|
def self?.narrow_not_class: (Type::t type, String class_name, ?exact: bool, ?environment: Environment) -> Type::t
|
|
88
88
|
def self?.narrow_not_refinement: (Type::t current_type, Type::t refinement_type) -> Type::t
|
|
89
|
+
def self?.narrow_for_fact: (Type::t current, untyped fact, untyped environment) -> Type::t
|
|
89
90
|
def self?.predicate_scopes: (untyped node, Scope scope) -> [Scope, Scope]
|
|
90
91
|
def self?.case_when_scopes: (untyped subject, Array[untyped] conditions, Scope scope) -> [Scope, Scope]
|
|
91
92
|
def self?.analyse: (untyped node, Scope scope) -> untyped
|
data/sig/rigor/rbs_extended.rbs
CHANGED
|
@@ -43,6 +43,8 @@ module Rigor
|
|
|
43
43
|
def self?.read_return_type_override: (untyped method_def) -> Type::t?
|
|
44
44
|
def self?.parse_return_type_override: (String string) -> Type::t?
|
|
45
45
|
|
|
46
|
+
def self?.read_flow_contribution: (untyped method_def) -> untyped?
|
|
47
|
+
|
|
46
48
|
class ParamOverride
|
|
47
49
|
attr_reader param_name: Symbol
|
|
48
50
|
attr_reader type: Type::t
|
data/sig/rigor/scope.rbs
CHANGED
data/sig/rigor/type.rbs
CHANGED
|
@@ -244,9 +244,16 @@ module Rigor
|
|
|
244
244
|
def self?.decimal_int_string: () -> Refined
|
|
245
245
|
def self?.octal_int_string: () -> Refined
|
|
246
246
|
def self?.hex_int_string: () -> Refined
|
|
247
|
+
def self?.literal_string: () -> Refined
|
|
248
|
+
def self?.non_lowercase_string: () -> Refined
|
|
249
|
+
def self?.non_uppercase_string: () -> Refined
|
|
250
|
+
def self?.non_numeric_string: () -> Refined
|
|
251
|
+
def self?.literal_string_carrier?: (Type::t refined) -> bool
|
|
252
|
+
def self?.literal_string_compatible?: (Type::t type) -> bool
|
|
247
253
|
def self?.intersection: (*Type::t members) -> Type::t
|
|
248
254
|
def self?.non_empty_lowercase_string: () -> Type::t
|
|
249
255
|
def self?.non_empty_uppercase_string: () -> Type::t
|
|
256
|
+
def self?.non_empty_literal_string: () -> Type::t
|
|
250
257
|
def self?.integer_range: ((Integer | Symbol) min, (Integer | Symbol) max) -> IntegerRange
|
|
251
258
|
def self?.positive_int: () -> IntegerRange
|
|
252
259
|
def self?.non_negative_int: () -> IntegerRange
|
data/sig/rigor.rbs
CHANGED
|
@@ -64,8 +64,14 @@ module Rigor
|
|
|
64
64
|
class Runner
|
|
65
65
|
RUBY_GLOB: String
|
|
66
66
|
DEFAULT_CACHE_ROOT: String
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
# `Rigor::Cache::Store` itself is not yet sig-covered (the
|
|
68
|
+
# cache namespace is in `UNSIGNED_NAMESPACES` per
|
|
69
|
+
# `spec/rigor/public_api_drift_spec.rb`), so reference it as
|
|
70
|
+
# `untyped` until the full Cache::Store sig lands. Steep
|
|
71
|
+
# otherwise raises `RBS::UnknownTypeName` for the named type.
|
|
72
|
+
attr_reader cache_store: untyped
|
|
73
|
+
attr_reader plugin_registry: untyped
|
|
74
|
+
def initialize: (configuration: Configuration, ?explain: bool, ?cache_store: untyped, ?plugin_requirer: untyped) -> void
|
|
69
75
|
def run: (?Array[String] paths) -> Result
|
|
70
76
|
end
|
|
71
77
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rigortype
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rigor contributors
|
|
@@ -191,6 +191,7 @@ files:
|
|
|
191
191
|
- lib/rigor/ast.rb
|
|
192
192
|
- lib/rigor/ast/type_node.rb
|
|
193
193
|
- lib/rigor/builtins/imported_refinements.rb
|
|
194
|
+
- lib/rigor/builtins/regex_refinement.rb
|
|
194
195
|
- lib/rigor/cache/descriptor.rb
|
|
195
196
|
- lib/rigor/cache/rbs_class_ancestor_table.rb
|
|
196
197
|
- lib/rigor/cache/rbs_class_type_param_names.rb
|
|
@@ -198,6 +199,7 @@ files:
|
|
|
198
199
|
- lib/rigor/cache/rbs_descriptor.rb
|
|
199
200
|
- lib/rigor/cache/rbs_environment.rb
|
|
200
201
|
- lib/rigor/cache/rbs_environment_marshal_patch.rb
|
|
202
|
+
- lib/rigor/cache/rbs_instance_definitions.rb
|
|
201
203
|
- lib/rigor/cache/rbs_known_class_names.rb
|
|
202
204
|
- lib/rigor/cache/store.rb
|
|
203
205
|
- lib/rigor/cli.rb
|
|
@@ -207,11 +209,17 @@ files:
|
|
|
207
209
|
- lib/rigor/cli/type_scan_renderer.rb
|
|
208
210
|
- lib/rigor/cli/type_scan_report.rb
|
|
209
211
|
- lib/rigor/configuration.rb
|
|
212
|
+
- lib/rigor/configuration/severity_profile.rb
|
|
210
213
|
- lib/rigor/environment.rb
|
|
211
214
|
- lib/rigor/environment/class_registry.rb
|
|
212
215
|
- lib/rigor/environment/rbs_hierarchy.rb
|
|
213
216
|
- lib/rigor/environment/rbs_loader.rb
|
|
214
217
|
- lib/rigor/flow_contribution.rb
|
|
218
|
+
- lib/rigor/flow_contribution/conflict.rb
|
|
219
|
+
- lib/rigor/flow_contribution/element.rb
|
|
220
|
+
- lib/rigor/flow_contribution/fact.rb
|
|
221
|
+
- lib/rigor/flow_contribution/merge_result.rb
|
|
222
|
+
- lib/rigor/flow_contribution/merger.rb
|
|
215
223
|
- lib/rigor/inference/acceptance.rb
|
|
216
224
|
- lib/rigor/inference/block_parameter_binder.rb
|
|
217
225
|
- lib/rigor/inference/builtins/array_catalog.rb
|
|
@@ -255,6 +263,17 @@ files:
|
|
|
255
263
|
- lib/rigor/inference/rbs_type_translator.rb
|
|
256
264
|
- lib/rigor/inference/scope_indexer.rb
|
|
257
265
|
- lib/rigor/inference/statement_evaluator.rb
|
|
266
|
+
- lib/rigor/plugin.rb
|
|
267
|
+
- lib/rigor/plugin/access_denied_error.rb
|
|
268
|
+
- lib/rigor/plugin/base.rb
|
|
269
|
+
- lib/rigor/plugin/fact_store.rb
|
|
270
|
+
- lib/rigor/plugin/io_boundary.rb
|
|
271
|
+
- lib/rigor/plugin/load_error.rb
|
|
272
|
+
- lib/rigor/plugin/loader.rb
|
|
273
|
+
- lib/rigor/plugin/manifest.rb
|
|
274
|
+
- lib/rigor/plugin/registry.rb
|
|
275
|
+
- lib/rigor/plugin/services.rb
|
|
276
|
+
- lib/rigor/plugin/trust_policy.rb
|
|
258
277
|
- lib/rigor/rbs_extended.rb
|
|
259
278
|
- lib/rigor/reflection.rb
|
|
260
279
|
- lib/rigor/scope.rb
|