rigortype 0.1.2 → 0.1.3
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 +10 -0
- data/lib/rigor/analysis/dependency_source_inference/builder.rb +87 -0
- data/lib/rigor/analysis/dependency_source_inference/gem_resolver.rb +72 -0
- data/lib/rigor/analysis/dependency_source_inference/index.rb +110 -0
- data/lib/rigor/analysis/dependency_source_inference/walker.rb +200 -0
- data/lib/rigor/analysis/dependency_source_inference.rb +37 -0
- data/lib/rigor/analysis/runner.rb +94 -5
- data/lib/rigor/cache/descriptor.rb +58 -5
- data/lib/rigor/configuration/dependencies.rb +235 -0
- data/lib/rigor/configuration.rb +43 -9
- data/lib/rigor/environment.rb +16 -4
- data/lib/rigor/flow_contribution/merger.rb +4 -0
- data/lib/rigor/inference/method_dispatcher.rb +87 -0
- data/lib/rigor/inference/statement_evaluator.rb +65 -1
- data/lib/rigor/plugin/manifest.rb +26 -5
- data/lib/rigor/version.rb +1 -1
- data/sig/rigor/environment.rbs +3 -2
- metadata +7 -1
|
@@ -37,26 +37,29 @@ module Rigor
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
attr_reader :id, :version, :description, :protocols, :config_schema, :produces, :consumes
|
|
40
|
+
attr_reader :id, :version, :description, :protocols, :config_schema, :produces, :consumes,
|
|
41
|
+
:owns_receivers
|
|
41
42
|
|
|
42
43
|
def initialize( # rubocop:disable Metrics/ParameterLists
|
|
43
44
|
id:, version:,
|
|
44
45
|
description: nil, protocols: [], config_schema: {},
|
|
45
|
-
produces: [], consumes: []
|
|
46
|
+
produces: [], consumes: [], owns_receivers: []
|
|
46
47
|
)
|
|
47
48
|
validate_id!(id)
|
|
48
49
|
validate_version!(version)
|
|
49
50
|
validate_protocols!(protocols)
|
|
50
51
|
validate_config_schema!(config_schema)
|
|
51
52
|
validate_produces!(produces)
|
|
53
|
+
validate_owns_receivers!(owns_receivers)
|
|
52
54
|
|
|
53
|
-
assign_fields(id, version, description, protocols, config_schema, produces, consumes)
|
|
55
|
+
assign_fields(id, version, description, protocols, config_schema, produces, consumes, owns_receivers)
|
|
54
56
|
freeze
|
|
55
57
|
end
|
|
56
58
|
|
|
57
59
|
private
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
# rubocop:disable Metrics/ParameterLists,Metrics/AbcSize
|
|
62
|
+
def assign_fields(id, version, description, protocols, config_schema, produces, consumes, owns_receivers)
|
|
60
63
|
@id = id.dup.freeze
|
|
61
64
|
@version = version.dup.freeze
|
|
62
65
|
@description = description.nil? ? nil : description.to_s.dup.freeze
|
|
@@ -64,7 +67,9 @@ module Rigor
|
|
|
64
67
|
@config_schema = config_schema.to_h { |k, v| [k.to_s.dup.freeze, v.to_sym] }.freeze
|
|
65
68
|
@produces = produces.map(&:to_sym).freeze
|
|
66
69
|
@consumes = coerce_consumes(consumes)
|
|
70
|
+
@owns_receivers = owns_receivers.map { |c| c.to_s.dup.freeze }.freeze
|
|
67
71
|
end
|
|
72
|
+
# rubocop:enable Metrics/ParameterLists,Metrics/AbcSize
|
|
68
73
|
|
|
69
74
|
public
|
|
70
75
|
|
|
@@ -99,7 +104,8 @@ module Rigor
|
|
|
99
104
|
"protocols" => protocols.map(&:to_s),
|
|
100
105
|
"config_schema" => config_schema.to_h { |k, v| [k, v.to_s] },
|
|
101
106
|
"produces" => produces.map(&:to_s),
|
|
102
|
-
"consumes" => consumes.map { |c| consumption_hash(c) }
|
|
107
|
+
"consumes" => consumes.map { |c| consumption_hash(c) },
|
|
108
|
+
"owns_receivers" => owns_receivers
|
|
103
109
|
}
|
|
104
110
|
end
|
|
105
111
|
|
|
@@ -166,6 +172,21 @@ module Rigor
|
|
|
166
172
|
raise ArgumentError, "plugin manifest produces must be an Array of Symbol/String, got #{produces.inspect}"
|
|
167
173
|
end
|
|
168
174
|
|
|
175
|
+
# ADR-10 5a — `owns_receivers:` declares the class names
|
|
176
|
+
# this plugin claims sole ownership of. The dispatcher's
|
|
177
|
+
# dependency-source-inference tier consults this list
|
|
178
|
+
# before consulting its own catalog: receivers owned by a
|
|
179
|
+
# registered plugin (directly or via subclass) decline,
|
|
180
|
+
# so plugin contributions stay authoritative for those
|
|
181
|
+
# types.
|
|
182
|
+
def validate_owns_receivers!(owns_receivers)
|
|
183
|
+
return if owns_receivers.is_a?(Array) && owns_receivers.all? { |c| c.is_a?(String) && !c.empty? }
|
|
184
|
+
|
|
185
|
+
raise ArgumentError,
|
|
186
|
+
"plugin manifest owns_receivers must be an Array of non-empty String, " \
|
|
187
|
+
"got #{owns_receivers.inspect}"
|
|
188
|
+
end
|
|
189
|
+
|
|
169
190
|
def coerce_consumes(consumes)
|
|
170
191
|
unless consumes.is_a?(Array)
|
|
171
192
|
raise ArgumentError, "plugin manifest consumes must be an Array, got #{consumes.inspect}"
|
data/lib/rigor/version.rb
CHANGED
data/sig/rigor/environment.rbs
CHANGED
|
@@ -7,11 +7,12 @@ module Rigor
|
|
|
7
7
|
attr_reader class_registry: ClassRegistry
|
|
8
8
|
attr_reader rbs_loader: RbsLoader?
|
|
9
9
|
attr_reader plugin_registry: untyped?
|
|
10
|
+
attr_reader dependency_source_index: untyped?
|
|
10
11
|
|
|
11
12
|
def self.default: () -> Environment
|
|
12
|
-
def self.for_project: (?root: String, ?libraries: Array[String], ?signature_paths: Array[String | _ToPath]?, ?cache_store: untyped?, ?plugin_registry: untyped?) -> Environment
|
|
13
|
+
def self.for_project: (?root: String, ?libraries: Array[String], ?signature_paths: Array[String | _ToPath]?, ?cache_store: untyped?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?) -> Environment
|
|
13
14
|
|
|
14
|
-
def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?, ?plugin_registry: untyped?) -> void
|
|
15
|
+
def initialize: (?class_registry: ClassRegistry, ?rbs_loader: RbsLoader?, ?plugin_registry: untyped?, ?dependency_source_index: untyped?) -> void
|
|
15
16
|
def nominal_for_name: (String | Symbol name) -> Type::Nominal?
|
|
16
17
|
def singleton_for_name: (String | Symbol name) -> Type::Singleton?
|
|
17
18
|
def constant_for_name: (String | Symbol name) -> Type::t?
|
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.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rigor contributors
|
|
@@ -187,6 +187,11 @@ files:
|
|
|
187
187
|
- lib/rigor/analysis/check_rules/always_truthy_condition_collector.rb
|
|
188
188
|
- lib/rigor/analysis/check_rules/dead_assignment_collector.rb
|
|
189
189
|
- lib/rigor/analysis/check_rules/ivar_write_collector.rb
|
|
190
|
+
- lib/rigor/analysis/dependency_source_inference.rb
|
|
191
|
+
- lib/rigor/analysis/dependency_source_inference/builder.rb
|
|
192
|
+
- lib/rigor/analysis/dependency_source_inference/gem_resolver.rb
|
|
193
|
+
- lib/rigor/analysis/dependency_source_inference/index.rb
|
|
194
|
+
- lib/rigor/analysis/dependency_source_inference/walker.rb
|
|
190
195
|
- lib/rigor/analysis/diagnostic.rb
|
|
191
196
|
- lib/rigor/analysis/fact_store.rb
|
|
192
197
|
- lib/rigor/analysis/result.rb
|
|
@@ -215,6 +220,7 @@ files:
|
|
|
215
220
|
- lib/rigor/cli/type_scan_renderer.rb
|
|
216
221
|
- lib/rigor/cli/type_scan_report.rb
|
|
217
222
|
- lib/rigor/configuration.rb
|
|
223
|
+
- lib/rigor/configuration/dependencies.rb
|
|
218
224
|
- lib/rigor/configuration/severity_profile.rb
|
|
219
225
|
- lib/rigor/environment.rb
|
|
220
226
|
- lib/rigor/environment/class_registry.rb
|