axn 0.1.0.pre.alpha.2.8.1 → 0.1.0.pre.alpha.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/.cursor/rules/axn-framework-patterns.mdc +43 -0
- data/.cursor/rules/general-coding-standards.mdc +27 -0
- data/.cursor/rules/spec/testing-patterns.mdc +40 -0
- data/CHANGELOG.md +43 -0
- data/Rakefile +12 -2
- data/docs/.vitepress/config.mjs +8 -3
- data/docs/advanced/conventions.md +2 -2
- data/docs/advanced/mountable.md +562 -0
- data/docs/advanced/profiling.md +355 -0
- data/docs/advanced/rough.md +1 -1
- data/docs/index.md +5 -3
- data/docs/intro/about.md +1 -1
- data/docs/intro/overview.md +5 -5
- data/docs/recipes/memoization.md +2 -2
- data/docs/recipes/rubocop-integration.md +38 -284
- data/docs/recipes/testing.md +14 -14
- data/docs/recipes/validating-user-input.md +1 -1
- data/docs/reference/async.md +160 -0
- data/docs/reference/axn-result.md +107 -0
- data/docs/reference/class.md +123 -25
- data/docs/reference/configuration.md +191 -10
- data/docs/reference/instance.md +14 -29
- data/docs/strategies/index.md +21 -21
- data/docs/strategies/transaction.md +1 -1
- data/docs/usage/setup.md +14 -0
- data/docs/usage/steps.md +7 -7
- data/docs/usage/using.md +23 -12
- data/docs/usage/writing.md +92 -11
- data/lib/axn/async/adapters/active_job.rb +65 -0
- data/lib/axn/async/adapters/disabled.rb +26 -0
- data/lib/axn/async/adapters/sidekiq.rb +74 -0
- data/lib/axn/async/adapters.rb +26 -0
- data/lib/axn/async.rb +61 -0
- data/lib/{action → axn}/configuration.rb +21 -3
- data/lib/{action → axn}/context.rb +21 -4
- data/lib/{action → axn}/core/automatic_logging.rb +6 -6
- data/lib/axn/core/context/facade.rb +69 -0
- data/lib/{action → axn}/core/context/facade_inspector.rb +31 -4
- data/lib/{action → axn}/core/context/internal.rb +5 -5
- data/lib/{action → axn}/core/contract.rb +41 -46
- data/lib/{action → axn}/core/contract_for_subfields.rb +30 -35
- data/lib/{action → axn}/core/contract_validation.rb +16 -6
- data/lib/axn/core/contract_validation_for_subfields.rb +158 -0
- data/lib/axn/core/field_resolvers/extract.rb +32 -0
- data/lib/axn/core/field_resolvers/model.rb +63 -0
- data/lib/axn/core/field_resolvers.rb +24 -0
- data/lib/{action → axn}/core/flow/callbacks.rb +7 -7
- data/lib/{action → axn}/core/flow/exception_execution.rb +4 -13
- data/lib/{action → axn}/core/flow/handlers/base_descriptor.rb +3 -2
- data/lib/{action → axn}/core/flow/handlers/descriptors/callback_descriptor.rb +2 -2
- data/lib/{action → axn}/core/flow/handlers/descriptors/message_descriptor.rb +6 -6
- data/lib/{action → axn}/core/flow/handlers/invoker.rb +2 -2
- data/lib/{action → axn}/core/flow/handlers/matcher.rb +5 -5
- data/lib/{action → axn}/core/flow/handlers/registry.rb +3 -1
- data/lib/{action → axn}/core/flow/handlers/resolvers/base_resolver.rb +1 -1
- data/lib/{action → axn}/core/flow/handlers/resolvers/callback_resolver.rb +2 -2
- data/lib/{action → axn}/core/flow/handlers/resolvers/message_resolver.rb +12 -3
- data/lib/axn/core/flow/handlers.rb +20 -0
- data/lib/{action → axn}/core/flow/messages.rb +7 -7
- data/lib/{action → axn}/core/flow.rb +4 -4
- data/lib/{action → axn}/core/hooks.rb +16 -5
- data/lib/{action → axn}/core/logging.rb +3 -3
- data/lib/{action → axn}/core/nesting_tracking.rb +1 -1
- data/lib/axn/core/profiling.rb +124 -0
- data/lib/{action → axn}/core/timing.rb +1 -1
- data/lib/axn/core/tracing.rb +17 -0
- data/lib/axn/core/use_strategy.rb +29 -0
- data/lib/{action → axn}/core/validation/fields.rb +26 -2
- data/lib/{action → axn}/core/validation/subfields.rb +14 -12
- data/lib/axn/core/validation/validators/model_validator.rb +36 -0
- data/lib/axn/core/validation/validators/type_validator.rb +80 -0
- data/lib/{action → axn}/core/validation/validators/validate_validator.rb +12 -2
- data/lib/axn/core.rb +123 -0
- data/lib/{action → axn}/exceptions.rb +12 -2
- data/lib/axn/factory.rb +102 -34
- data/lib/axn/internal/logging.rb +26 -0
- data/lib/axn/internal/registry.rb +87 -0
- data/lib/axn/mountable/descriptor.rb +76 -0
- data/lib/axn/mountable/helpers/class_builder.rb +162 -0
- data/lib/axn/mountable/helpers/mounter.rb +33 -0
- data/lib/axn/mountable/helpers/namespace_manager.rb +66 -0
- data/lib/axn/mountable/helpers/validator.rb +112 -0
- data/lib/axn/mountable/inherit_profiles.rb +72 -0
- data/lib/axn/mountable/mounting_strategies/_base.rb +83 -0
- data/lib/axn/mountable/mounting_strategies/axn.rb +48 -0
- data/lib/axn/mountable/mounting_strategies/enqueue_all.rb +55 -0
- data/lib/axn/mountable/mounting_strategies/method.rb +95 -0
- data/lib/axn/mountable/mounting_strategies/step.rb +69 -0
- data/lib/axn/mountable/mounting_strategies.rb +32 -0
- data/lib/axn/mountable.rb +85 -0
- data/lib/axn/rails/engine.rb +51 -0
- data/lib/axn/rails/generators/axn_generator.rb +68 -0
- data/lib/axn/rails/generators/templates/action.rb.erb +17 -0
- data/lib/axn/rails/generators/templates/action_spec.rb.erb +25 -0
- data/lib/{action → axn}/result.rb +30 -11
- data/lib/{action → axn}/strategies/transaction.rb +1 -1
- data/lib/axn/strategies.rb +20 -0
- data/lib/axn/testing/spec_helpers.rb +6 -8
- data/lib/axn/util/memoization.rb +20 -0
- data/lib/axn/version.rb +1 -1
- data/lib/axn.rb +17 -16
- data/lib/rubocop/cop/axn/README.md +23 -23
- data/lib/rubocop/cop/axn/unchecked_result.rb +138 -17
- metadata +88 -64
- data/.rspec +0 -3
- data/.rubocop.yml +0 -76
- data/.tool-versions +0 -1
- data/docs/reference/action-result.md +0 -37
- data/lib/action/attachable/base.rb +0 -43
- data/lib/action/attachable/steps.rb +0 -63
- data/lib/action/attachable/subactions.rb +0 -70
- data/lib/action/attachable.rb +0 -17
- data/lib/action/core/context/facade.rb +0 -48
- data/lib/action/core/flow/handlers.rb +0 -20
- data/lib/action/core/tracing.rb +0 -17
- data/lib/action/core/use_strategy.rb +0 -30
- data/lib/action/core/validation/validators/model_validator.rb +0 -34
- data/lib/action/core/validation/validators/type_validator.rb +0 -30
- data/lib/action/core.rb +0 -108
- data/lib/action/enqueueable/via_sidekiq.rb +0 -76
- data/lib/action/enqueueable.rb +0 -13
- data/lib/action/strategies.rb +0 -48
- data/lib/axn/util.rb +0 -24
- data/package.json +0 -10
- data/yarn.lock +0 -1166
@@ -4,11 +4,11 @@ This directory contains custom RuboCop cops specifically designed for the Axn li
|
|
4
4
|
|
5
5
|
## Axn/UncheckedResult
|
6
6
|
|
7
|
-
This cop enforces proper result handling when calling
|
7
|
+
This cop enforces proper result handling when calling Axns. It can be configured to check nested calls, non-nested calls, or both.
|
8
8
|
|
9
9
|
### Why This Rule Exists
|
10
10
|
|
11
|
-
When
|
11
|
+
When Axns are nested, proper error handling becomes crucial. Without proper result checking, failures in nested Axns can be silently ignored, leading to:
|
12
12
|
|
13
13
|
- Silent failures that are hard to debug
|
14
14
|
- Inconsistent error handling patterns
|
@@ -21,8 +21,8 @@ The cop supports flexible configuration to match your team's needs:
|
|
21
21
|
```yaml
|
22
22
|
Axn/UncheckedResult:
|
23
23
|
Enabled: true
|
24
|
-
CheckNested: true # Check nested
|
25
|
-
CheckNonNested: true # Check non-nested
|
24
|
+
CheckNested: true # Check nested Axn calls (default: true)
|
25
|
+
CheckNonNested: true # Check non-nested Axn calls (default: true)
|
26
26
|
Severity: warning # or error, if you want to enforce it strictly
|
27
27
|
```
|
28
28
|
|
@@ -33,21 +33,21 @@ Axn/UncheckedResult:
|
|
33
33
|
CheckNested: true
|
34
34
|
CheckNonNested: true
|
35
35
|
```
|
36
|
-
Checks all
|
36
|
+
Checks all Axn calls regardless of nesting.
|
37
37
|
|
38
38
|
2. **Nested Only**:
|
39
39
|
```yaml
|
40
40
|
CheckNested: true
|
41
41
|
CheckNonNested: false
|
42
42
|
```
|
43
|
-
Only checks
|
43
|
+
Only checks Axn calls from within other Axns.
|
44
44
|
|
45
45
|
3. **Non-Nested Only**:
|
46
46
|
```yaml
|
47
47
|
CheckNested: false
|
48
48
|
CheckNonNested: true
|
49
49
|
```
|
50
|
-
Only checks top-level
|
50
|
+
Only checks top-level Axn calls.
|
51
51
|
|
52
52
|
4. **Disabled**:
|
53
53
|
```yaml
|
@@ -62,7 +62,7 @@ Axn/UncheckedResult:
|
|
62
62
|
|
63
63
|
```ruby
|
64
64
|
class OuterAction
|
65
|
-
include
|
65
|
+
include Axn
|
66
66
|
def call
|
67
67
|
InnerAction.call(param: "value") # Missing result check
|
68
68
|
# This will always continue even if InnerAction fails
|
@@ -74,7 +74,7 @@ end
|
|
74
74
|
|
75
75
|
```ruby
|
76
76
|
class OuterAction
|
77
|
-
include
|
77
|
+
include Axn
|
78
78
|
def call
|
79
79
|
InnerAction.call!(param: "value") # Using call! ensures exceptions bubble up
|
80
80
|
end
|
@@ -85,7 +85,7 @@ end
|
|
85
85
|
|
86
86
|
```ruby
|
87
87
|
class OuterAction
|
88
|
-
include
|
88
|
+
include Axn
|
89
89
|
def call
|
90
90
|
result = InnerAction.call(param: "value")
|
91
91
|
return result unless result.ok?
|
@@ -98,7 +98,7 @@ end
|
|
98
98
|
|
99
99
|
```ruby
|
100
100
|
class OuterAction
|
101
|
-
include
|
101
|
+
include Axn
|
102
102
|
def call
|
103
103
|
result = InnerAction.call(param: "value")
|
104
104
|
if result.failed?
|
@@ -113,7 +113,7 @@ end
|
|
113
113
|
|
114
114
|
```ruby
|
115
115
|
class OuterAction
|
116
|
-
include
|
116
|
+
include Axn
|
117
117
|
def call
|
118
118
|
result = InnerAction.call(param: "value")
|
119
119
|
if result.error
|
@@ -128,7 +128,7 @@ end
|
|
128
128
|
|
129
129
|
```ruby
|
130
130
|
class OuterAction
|
131
|
-
include
|
131
|
+
include Axn
|
132
132
|
def call
|
133
133
|
result = InnerAction.call(param: "value")
|
134
134
|
result # Result is returned, so it's properly handled
|
@@ -140,7 +140,7 @@ end
|
|
140
140
|
|
141
141
|
```ruby
|
142
142
|
class OuterAction
|
143
|
-
include
|
143
|
+
include Axn
|
144
144
|
exposes :nested_result
|
145
145
|
def call
|
146
146
|
result = InnerAction.call(param: "value")
|
@@ -153,7 +153,7 @@ end
|
|
153
153
|
|
154
154
|
```ruby
|
155
155
|
class OuterAction
|
156
|
-
include
|
156
|
+
include Axn
|
157
157
|
def call
|
158
158
|
result = InnerAction.call(param: "value")
|
159
159
|
process_result(result) # Result is used, so it's properly handled
|
@@ -165,19 +165,19 @@ end
|
|
165
165
|
|
166
166
|
The cop analyzes your code to determine if you're:
|
167
167
|
|
168
|
-
1. **Inside an
|
168
|
+
1. **Inside an Axn class** - Classes that `include Axn`
|
169
169
|
2. **Inside the `call` method** - Only the main execution method
|
170
|
-
3. **Calling another
|
170
|
+
3. **Calling another Axn** - Using `.call` on Axn classes
|
171
171
|
4. **Properly handling the result** - One of the acceptable patterns above
|
172
172
|
|
173
173
|
### What the Cop Ignores
|
174
174
|
|
175
175
|
The cop will NOT report offenses for:
|
176
176
|
|
177
|
-
-
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
177
|
+
- Axn calls outside of Axn classes
|
178
|
+
- Axn calls in methods other than `call`
|
179
|
+
- Axn calls that use `call!` (bang method)
|
180
|
+
- Axn calls where the result is properly handled
|
181
181
|
|
182
182
|
### Configuration
|
183
183
|
|
@@ -189,8 +189,8 @@ require:
|
|
189
189
|
|
190
190
|
Axn/UncheckedResult:
|
191
191
|
Enabled: true
|
192
|
-
CheckNested: true # Check nested
|
193
|
-
CheckNonNested: true # Check non-nested
|
192
|
+
CheckNested: true # Check nested Axn calls
|
193
|
+
CheckNonNested: true # Check non-nested Axn calls
|
194
194
|
Severity: warning # or error, if you want to enforce it strictly
|
195
195
|
```
|
196
196
|
|
@@ -3,13 +3,17 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module Axn
|
6
|
-
# This cop enforces that when calling
|
6
|
+
# This cop enforces that when calling Axns from within other Axns,
|
7
7
|
# you must either use `call!` (with the bang) or check `result.ok?`.
|
8
8
|
#
|
9
|
+
# When the ActionsNamespace configuration is set (e.g., to "Actions"),
|
10
|
+
# the cop will only check calls on classes under that namespace,
|
11
|
+
# reducing false positives from other service objects.
|
12
|
+
#
|
9
13
|
# @example
|
10
14
|
# # bad
|
11
15
|
# class OuterAction
|
12
|
-
# include
|
16
|
+
# include Axn
|
13
17
|
# def call
|
14
18
|
# InnerAction.call(param: "value") # Missing result check
|
15
19
|
# end
|
@@ -17,7 +21,7 @@ module RuboCop
|
|
17
21
|
#
|
18
22
|
# # good
|
19
23
|
# class OuterAction
|
20
|
-
# include
|
24
|
+
# include Axn
|
21
25
|
# def call
|
22
26
|
# result = InnerAction.call(param: "value")
|
23
27
|
# return result unless result.ok?
|
@@ -27,17 +31,68 @@ module RuboCop
|
|
27
31
|
#
|
28
32
|
# # also good
|
29
33
|
# class OuterAction
|
30
|
-
# include
|
34
|
+
# include Axn
|
31
35
|
# def call
|
32
36
|
# InnerAction.call!(param: "value") # Using call! ensures exceptions bubble up
|
33
37
|
# end
|
34
38
|
# end
|
35
39
|
#
|
40
|
+
# @example With ActionsNamespace configured as string
|
41
|
+
# # .rubocop.yml
|
42
|
+
# Axn/UncheckedResult:
|
43
|
+
# ActionsNamespace: "Actions"
|
44
|
+
#
|
45
|
+
# # This will only check Actions::* classes, not other service objects
|
46
|
+
# class OuterAction
|
47
|
+
# include Axn
|
48
|
+
# def call
|
49
|
+
# SomeService.call(param: "value") # Won't trigger cop
|
50
|
+
# Actions::InnerAction.call(param: "value") # Will trigger cop
|
51
|
+
# end
|
52
|
+
# end
|
53
|
+
#
|
54
|
+
# @example With ActionsNamespace configured as array
|
55
|
+
# # .rubocop.yml
|
56
|
+
# Axn/UncheckedResult:
|
57
|
+
# ActionsNamespace: ["Actions", "Services"]
|
58
|
+
#
|
59
|
+
# # This will check both Actions::* and Services::* classes
|
60
|
+
# class OuterAction
|
61
|
+
# include Axn
|
62
|
+
# def call
|
63
|
+
# SomeService.call(param: "value") # Won't trigger cop
|
64
|
+
# Actions::InnerAction.call(param: "value") # Will trigger cop
|
65
|
+
# Services::SomeService.call(param: "value") # Will trigger cop
|
66
|
+
# end
|
67
|
+
# end
|
68
|
+
#
|
36
69
|
# rubocop:disable Metrics/ClassLength
|
37
70
|
class UncheckedResult < RuboCop::Cop::Base
|
38
71
|
extend RuboCop::Cop::AutoCorrector
|
39
72
|
|
40
|
-
MSG = "Use `call!` or check `result.ok?` when calling
|
73
|
+
MSG = "Use `call!` or check `result.ok?` when calling Axns from within Axns"
|
74
|
+
|
75
|
+
# Define the configuration schema
|
76
|
+
def self.configuration_schema
|
77
|
+
@configuration_schema ||= RuboCop::ConfigSchema::Schema.new(
|
78
|
+
{
|
79
|
+
"ActionsNamespace" => {
|
80
|
+
"type" => %w[string array],
|
81
|
+
"description" => 'Only check calls on classes under this namespace (e.g., "Actions") or array of namespaces (e.g., ["Actions", "Services"])',
|
82
|
+
},
|
83
|
+
"CheckNested" => {
|
84
|
+
"type" => "boolean",
|
85
|
+
"description" => "Check nested Axn calls",
|
86
|
+
"default" => true,
|
87
|
+
},
|
88
|
+
"CheckNonNested" => {
|
89
|
+
"type" => "boolean",
|
90
|
+
"description" => "Check non-nested Axn calls",
|
91
|
+
"default" => true,
|
92
|
+
},
|
93
|
+
},
|
94
|
+
)
|
95
|
+
end
|
41
96
|
|
42
97
|
# Configuration options
|
43
98
|
def check_nested?
|
@@ -48,20 +103,20 @@ module RuboCop
|
|
48
103
|
cop_config["CheckNonNested"] != false
|
49
104
|
end
|
50
105
|
|
51
|
-
# Track whether we're inside an
|
106
|
+
# Track whether we're inside an Axn class and its call method
|
52
107
|
def_node_search :action_class?, <<~PATTERN
|
53
|
-
(class _ (const nil? :
|
108
|
+
(class _ (const nil? :Axn) ...)
|
54
109
|
PATTERN
|
55
110
|
|
56
111
|
def_node_search :includes_action?, <<~PATTERN
|
57
|
-
(send nil? :include (const nil? :
|
112
|
+
(send nil? :include (const nil? :Axn))
|
58
113
|
PATTERN
|
59
114
|
|
60
115
|
def_node_search :call_method?, <<~PATTERN
|
61
116
|
(def :call ...)
|
62
117
|
PATTERN
|
63
118
|
|
64
|
-
def_node_search :
|
119
|
+
def_node_search :axn_call?, <<~PATTERN
|
65
120
|
(send (const _ _) :call ...)
|
66
121
|
PATTERN
|
67
122
|
|
@@ -102,9 +157,10 @@ module RuboCop
|
|
102
157
|
PATTERN
|
103
158
|
|
104
159
|
def on_send(node)
|
105
|
-
return unless
|
160
|
+
return unless axn_call?(node)
|
161
|
+
return unless axn_action_call?(node)
|
106
162
|
return if bang_call?(node)
|
107
|
-
return unless
|
163
|
+
return unless inside_axn_call_method?(node)
|
108
164
|
|
109
165
|
# Check if we should process this call based on configuration
|
110
166
|
is_inside_action = inside_action_context?(node)
|
@@ -117,8 +173,73 @@ module RuboCop
|
|
117
173
|
|
118
174
|
private
|
119
175
|
|
120
|
-
def
|
121
|
-
#
|
176
|
+
def axn_action_call?(node)
|
177
|
+
# Get the receiver of the call method
|
178
|
+
receiver = node.children[0]
|
179
|
+
return false unless receiver&.type == :const
|
180
|
+
|
181
|
+
# Get the constant name - handle both simple constants and namespaced constants
|
182
|
+
const_name = get_constant_name(receiver)
|
183
|
+
return false unless const_name
|
184
|
+
|
185
|
+
# Check if we have the Actions namespace configured
|
186
|
+
namespace = actions_namespace
|
187
|
+
|
188
|
+
if namespace
|
189
|
+
# Handle both string and array configurations
|
190
|
+
case namespace
|
191
|
+
when String
|
192
|
+
return const_name.start_with?("#{namespace}::")
|
193
|
+
when Array
|
194
|
+
# If array is empty, fall back to checking all calls
|
195
|
+
return true if namespace.empty?
|
196
|
+
|
197
|
+
return namespace.any? { |ns| const_name.start_with?("#{ns}::") }
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# If no namespace is configured, we can't be as precise
|
202
|
+
# Fall back to checking if the class includes Axn (more complex)
|
203
|
+
true
|
204
|
+
rescue StandardError => _e
|
205
|
+
# If there's any error, assume it's not an Axn action call
|
206
|
+
false
|
207
|
+
end
|
208
|
+
|
209
|
+
def get_constant_name(const_node)
|
210
|
+
# Handle both simple constants (const :SomeClass) and namespaced constants (const (const nil :Actions) :SomeClass)
|
211
|
+
if const_node.children[0]&.type == :const
|
212
|
+
# This is a namespaced constant like Actions::SomeClass
|
213
|
+
namespace = get_constant_name(const_node.children[0])
|
214
|
+
class_name = const_node.children[1]
|
215
|
+
"#{namespace}::#{class_name}"
|
216
|
+
else
|
217
|
+
# This is a simple constant like SomeClass
|
218
|
+
const_node.children[1]
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def actions_namespace
|
223
|
+
# First try to get from RuboCop configuration
|
224
|
+
config_value = cop_config["ActionsNamespace"]
|
225
|
+
return nil unless config_value
|
226
|
+
|
227
|
+
# Handle both string and array configurations
|
228
|
+
case config_value
|
229
|
+
when String
|
230
|
+
config_value
|
231
|
+
when Array
|
232
|
+
config_value.map(&:to_s)
|
233
|
+
else
|
234
|
+
config_value.to_s
|
235
|
+
end
|
236
|
+
rescue StandardError => _e
|
237
|
+
# If there's any error accessing the configuration, return nil
|
238
|
+
nil
|
239
|
+
end
|
240
|
+
|
241
|
+
def inside_axn_call_method?(node)
|
242
|
+
# Check if we're inside a call method of an Axn class
|
122
243
|
current_node = node
|
123
244
|
while current_node.parent
|
124
245
|
current_node = current_node.parent
|
@@ -126,19 +247,19 @@ module RuboCop
|
|
126
247
|
# Check if we're inside a def :call
|
127
248
|
next unless call_method?(current_node) && current_node.method_name == :call
|
128
249
|
|
129
|
-
# Now check if this class includes
|
250
|
+
# Now check if this class includes Axn
|
130
251
|
class_node = find_enclosing_class(current_node)
|
131
252
|
return includes_action?(class_node) if class_node
|
132
253
|
end
|
133
254
|
false
|
134
255
|
rescue StandardError => _e
|
135
|
-
# If there's any error in the analysis, assume we're not in an
|
256
|
+
# If there's any error in the analysis, assume we're not in an Axn call method
|
136
257
|
# This prevents the cop from crashing on complex or malformed code
|
137
258
|
false
|
138
259
|
end
|
139
260
|
|
140
261
|
def inside_action_context?(node)
|
141
|
-
# Check if this
|
262
|
+
# Check if this Axn call is inside an Axn class's call method
|
142
263
|
current_node = node
|
143
264
|
while current_node.parent
|
144
265
|
current_node = current_node.parent
|
@@ -146,7 +267,7 @@ module RuboCop
|
|
146
267
|
# Check if we're inside a def :call
|
147
268
|
next unless call_method?(current_node) && current_node.method_name == :call
|
148
269
|
|
149
|
-
# Now check if this class includes
|
270
|
+
# Now check if this class includes Axn
|
150
271
|
class_node = find_enclosing_class(current_node)
|
151
272
|
return true if class_node && includes_action?(class_node)
|
152
273
|
end
|
metadata
CHANGED
@@ -1,54 +1,54 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.alpha.
|
4
|
+
version: 0.1.0.pre.alpha.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kali Donovan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '7.
|
19
|
+
version: '7.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '7.
|
26
|
+
version: '7.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '7.
|
33
|
+
version: '7.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '7.
|
40
|
+
version: '7.2'
|
41
41
|
description: Pattern for writing callable service objects with contract validation
|
42
|
-
and
|
42
|
+
and exception handling
|
43
43
|
email:
|
44
44
|
- kali@teamshares.com
|
45
45
|
executables: []
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- ".
|
50
|
-
- ".
|
51
|
-
- ".
|
49
|
+
- ".cursor/rules/axn-framework-patterns.mdc"
|
50
|
+
- ".cursor/rules/general-coding-standards.mdc"
|
51
|
+
- ".cursor/rules/spec/testing-patterns.mdc"
|
52
52
|
- CHANGELOG.md
|
53
53
|
- CONTRIBUTING.md
|
54
54
|
- LICENSE.txt
|
@@ -56,6 +56,8 @@ files:
|
|
56
56
|
- Rakefile
|
57
57
|
- docs/.vitepress/config.mjs
|
58
58
|
- docs/advanced/conventions.md
|
59
|
+
- docs/advanced/mountable.md
|
60
|
+
- docs/advanced/profiling.md
|
59
61
|
- docs/advanced/rough.md
|
60
62
|
- docs/index.md
|
61
63
|
- docs/intro/about.md
|
@@ -64,7 +66,8 @@ files:
|
|
64
66
|
- docs/recipes/rubocop-integration.md
|
65
67
|
- docs/recipes/testing.md
|
66
68
|
- docs/recipes/validating-user-input.md
|
67
|
-
- docs/reference/
|
69
|
+
- docs/reference/async.md
|
70
|
+
- docs/reference/axn-result.md
|
68
71
|
- docs/reference/class.md
|
69
72
|
- docs/reference/configuration.md
|
70
73
|
- docs/reference/instance.md
|
@@ -74,61 +77,82 @@ files:
|
|
74
77
|
- docs/usage/steps.md
|
75
78
|
- docs/usage/using.md
|
76
79
|
- docs/usage/writing.md
|
77
|
-
- lib/action/attachable.rb
|
78
|
-
- lib/action/attachable/base.rb
|
79
|
-
- lib/action/attachable/steps.rb
|
80
|
-
- lib/action/attachable/subactions.rb
|
81
|
-
- lib/action/configuration.rb
|
82
|
-
- lib/action/context.rb
|
83
|
-
- lib/action/core.rb
|
84
|
-
- lib/action/core/automatic_logging.rb
|
85
|
-
- lib/action/core/context/facade.rb
|
86
|
-
- lib/action/core/context/facade_inspector.rb
|
87
|
-
- lib/action/core/context/internal.rb
|
88
|
-
- lib/action/core/contract.rb
|
89
|
-
- lib/action/core/contract_for_subfields.rb
|
90
|
-
- lib/action/core/contract_validation.rb
|
91
|
-
- lib/action/core/flow.rb
|
92
|
-
- lib/action/core/flow/callbacks.rb
|
93
|
-
- lib/action/core/flow/exception_execution.rb
|
94
|
-
- lib/action/core/flow/handlers.rb
|
95
|
-
- lib/action/core/flow/handlers/base_descriptor.rb
|
96
|
-
- lib/action/core/flow/handlers/descriptors/callback_descriptor.rb
|
97
|
-
- lib/action/core/flow/handlers/descriptors/message_descriptor.rb
|
98
|
-
- lib/action/core/flow/handlers/invoker.rb
|
99
|
-
- lib/action/core/flow/handlers/matcher.rb
|
100
|
-
- lib/action/core/flow/handlers/registry.rb
|
101
|
-
- lib/action/core/flow/handlers/resolvers/base_resolver.rb
|
102
|
-
- lib/action/core/flow/handlers/resolvers/callback_resolver.rb
|
103
|
-
- lib/action/core/flow/handlers/resolvers/message_resolver.rb
|
104
|
-
- lib/action/core/flow/messages.rb
|
105
|
-
- lib/action/core/hooks.rb
|
106
|
-
- lib/action/core/logging.rb
|
107
|
-
- lib/action/core/nesting_tracking.rb
|
108
|
-
- lib/action/core/timing.rb
|
109
|
-
- lib/action/core/tracing.rb
|
110
|
-
- lib/action/core/use_strategy.rb
|
111
|
-
- lib/action/core/validation/fields.rb
|
112
|
-
- lib/action/core/validation/subfields.rb
|
113
|
-
- lib/action/core/validation/validators/model_validator.rb
|
114
|
-
- lib/action/core/validation/validators/type_validator.rb
|
115
|
-
- lib/action/core/validation/validators/validate_validator.rb
|
116
|
-
- lib/action/enqueueable.rb
|
117
|
-
- lib/action/enqueueable/via_sidekiq.rb
|
118
|
-
- lib/action/exceptions.rb
|
119
|
-
- lib/action/result.rb
|
120
|
-
- lib/action/strategies.rb
|
121
|
-
- lib/action/strategies/transaction.rb
|
122
80
|
- lib/axn.rb
|
81
|
+
- lib/axn/async.rb
|
82
|
+
- lib/axn/async/adapters.rb
|
83
|
+
- lib/axn/async/adapters/active_job.rb
|
84
|
+
- lib/axn/async/adapters/disabled.rb
|
85
|
+
- lib/axn/async/adapters/sidekiq.rb
|
86
|
+
- lib/axn/configuration.rb
|
87
|
+
- lib/axn/context.rb
|
88
|
+
- lib/axn/core.rb
|
89
|
+
- lib/axn/core/automatic_logging.rb
|
90
|
+
- lib/axn/core/context/facade.rb
|
91
|
+
- lib/axn/core/context/facade_inspector.rb
|
92
|
+
- lib/axn/core/context/internal.rb
|
93
|
+
- lib/axn/core/contract.rb
|
94
|
+
- lib/axn/core/contract_for_subfields.rb
|
95
|
+
- lib/axn/core/contract_validation.rb
|
96
|
+
- lib/axn/core/contract_validation_for_subfields.rb
|
97
|
+
- lib/axn/core/field_resolvers.rb
|
98
|
+
- lib/axn/core/field_resolvers/extract.rb
|
99
|
+
- lib/axn/core/field_resolvers/model.rb
|
100
|
+
- lib/axn/core/flow.rb
|
101
|
+
- lib/axn/core/flow/callbacks.rb
|
102
|
+
- lib/axn/core/flow/exception_execution.rb
|
103
|
+
- lib/axn/core/flow/handlers.rb
|
104
|
+
- lib/axn/core/flow/handlers/base_descriptor.rb
|
105
|
+
- lib/axn/core/flow/handlers/descriptors/callback_descriptor.rb
|
106
|
+
- lib/axn/core/flow/handlers/descriptors/message_descriptor.rb
|
107
|
+
- lib/axn/core/flow/handlers/invoker.rb
|
108
|
+
- lib/axn/core/flow/handlers/matcher.rb
|
109
|
+
- lib/axn/core/flow/handlers/registry.rb
|
110
|
+
- lib/axn/core/flow/handlers/resolvers/base_resolver.rb
|
111
|
+
- lib/axn/core/flow/handlers/resolvers/callback_resolver.rb
|
112
|
+
- lib/axn/core/flow/handlers/resolvers/message_resolver.rb
|
113
|
+
- lib/axn/core/flow/messages.rb
|
114
|
+
- lib/axn/core/hooks.rb
|
115
|
+
- lib/axn/core/logging.rb
|
116
|
+
- lib/axn/core/nesting_tracking.rb
|
117
|
+
- lib/axn/core/profiling.rb
|
118
|
+
- lib/axn/core/timing.rb
|
119
|
+
- lib/axn/core/tracing.rb
|
120
|
+
- lib/axn/core/use_strategy.rb
|
121
|
+
- lib/axn/core/validation/fields.rb
|
122
|
+
- lib/axn/core/validation/subfields.rb
|
123
|
+
- lib/axn/core/validation/validators/model_validator.rb
|
124
|
+
- lib/axn/core/validation/validators/type_validator.rb
|
125
|
+
- lib/axn/core/validation/validators/validate_validator.rb
|
126
|
+
- lib/axn/exceptions.rb
|
123
127
|
- lib/axn/factory.rb
|
128
|
+
- lib/axn/internal/logging.rb
|
129
|
+
- lib/axn/internal/registry.rb
|
130
|
+
- lib/axn/mountable.rb
|
131
|
+
- lib/axn/mountable/descriptor.rb
|
132
|
+
- lib/axn/mountable/helpers/class_builder.rb
|
133
|
+
- lib/axn/mountable/helpers/mounter.rb
|
134
|
+
- lib/axn/mountable/helpers/namespace_manager.rb
|
135
|
+
- lib/axn/mountable/helpers/validator.rb
|
136
|
+
- lib/axn/mountable/inherit_profiles.rb
|
137
|
+
- lib/axn/mountable/mounting_strategies.rb
|
138
|
+
- lib/axn/mountable/mounting_strategies/_base.rb
|
139
|
+
- lib/axn/mountable/mounting_strategies/axn.rb
|
140
|
+
- lib/axn/mountable/mounting_strategies/enqueue_all.rb
|
141
|
+
- lib/axn/mountable/mounting_strategies/method.rb
|
142
|
+
- lib/axn/mountable/mounting_strategies/step.rb
|
143
|
+
- lib/axn/rails/engine.rb
|
144
|
+
- lib/axn/rails/generators/axn_generator.rb
|
145
|
+
- lib/axn/rails/generators/templates/action.rb.erb
|
146
|
+
- lib/axn/rails/generators/templates/action_spec.rb.erb
|
147
|
+
- lib/axn/result.rb
|
124
148
|
- lib/axn/rubocop.rb
|
149
|
+
- lib/axn/strategies.rb
|
150
|
+
- lib/axn/strategies/transaction.rb
|
125
151
|
- lib/axn/testing/spec_helpers.rb
|
126
|
-
- lib/axn/util.rb
|
152
|
+
- lib/axn/util/memoization.rb
|
127
153
|
- lib/axn/version.rb
|
128
154
|
- lib/rubocop/cop/axn/README.md
|
129
155
|
- lib/rubocop/cop/axn/unchecked_result.rb
|
130
|
-
- package.json
|
131
|
-
- yarn.lock
|
132
156
|
homepage: https://github.com/teamshares/axn
|
133
157
|
licenses:
|
134
158
|
- MIT
|
@@ -145,7 +169,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
169
|
requirements:
|
146
170
|
- - ">="
|
147
171
|
- !ruby/object:Gem::Version
|
148
|
-
version: 3.2.
|
172
|
+
version: 3.2.1
|
149
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
174
|
requirements:
|
151
175
|
- - ">="
|
data/.rspec
DELETED