functional-light-service 0.5.4 → 6.0.0
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/.github/workflows/project-build.yml +35 -11
- data/.rubocop.yml +101 -160
- data/AUDIT-functional-light-service.md +352 -0
- data/CHANGELOG.md +38 -0
- data/README.md +54 -2
- data/audit/bench.rb +99 -0
- data/audit/verify_findings.rb +172 -0
- data/functional-light-service.gemspec +15 -21
- data/lib/functional-light-service/action.rb +97 -101
- data/lib/functional-light-service/configuration.rb +26 -24
- data/lib/functional-light-service/context/key_verifier.rb +124 -118
- data/lib/functional-light-service/context.rb +63 -20
- data/lib/functional-light-service/deprecations.rb +26 -0
- data/lib/functional-light-service/errors.rb +8 -6
- data/lib/functional-light-service/functional/enum.rb +286 -250
- data/lib/functional-light-service/functional/maybe.rb +21 -15
- data/lib/functional-light-service/functional/monad.rb +77 -66
- data/lib/functional-light-service/functional/null.rb +88 -74
- data/lib/functional-light-service/functional/option.rb +100 -97
- data/lib/functional-light-service/functional/result.rb +129 -116
- data/lib/functional-light-service/localization_adapter.rb +48 -47
- data/lib/functional-light-service/organizer/execute.rb +16 -14
- data/lib/functional-light-service/organizer/iterate.rb +30 -25
- data/lib/functional-light-service/organizer/reduce_if.rb +19 -17
- data/lib/functional-light-service/organizer/reduce_until.rb +22 -20
- data/lib/functional-light-service/organizer/scoped_reducable.rb +15 -13
- data/lib/functional-light-service/organizer/with_callback.rb +28 -26
- data/lib/functional-light-service/organizer/with_reducer.rb +81 -77
- data/lib/functional-light-service/organizer/with_reducer_factory.rb +20 -18
- data/lib/functional-light-service/organizer/with_reducer_log_decorator.rb +110 -108
- data/lib/functional-light-service/organizer.rb +114 -114
- data/lib/functional-light-service/testing/context_factory.rb +48 -42
- data/lib/functional-light-service/testing.rb +3 -1
- data/lib/functional-light-service/version.rb +5 -3
- data/lib/functional-light-service.rb +30 -28
- data/spec/acceptance/after_actions_spec.rb +87 -71
- data/spec/acceptance/before_actions_spec.rb +115 -98
- data/spec/acceptance/custom_log_from_organizer_spec.rb +61 -60
- data/spec/acceptance/deprecation_warnings_spec.rb +82 -0
- data/spec/acceptance/fail_spec.rb +52 -50
- data/spec/acceptance/message_localization_spec.rb +119 -118
- data/spec/acceptance/organizer/context_failure_and_skipping_spec.rb +68 -65
- data/spec/acceptance/organizer/reduce_if_spec.rb +89 -89
- data/spec/acceptance/organizer/with_callback_spec.rb +113 -110
- data/spec/acceptance/{not_having_call_method_warning_spec.rb → organizer_entry_point_spec.rb} +10 -7
- data/spec/acceptance/rollback_spec.rb +183 -132
- data/spec/action_expects_and_promises_spec.rb +97 -93
- data/spec/action_promised_keys_spec.rb +126 -122
- data/spec/context_spec.rb +289 -197
- data/spec/examples/controller_spec.rb +63 -63
- data/spec/examples/validate_address_spec.rb +38 -37
- data/spec/lib/deterministic/currify_spec.rb +90 -88
- data/spec/lib/deterministic/null_spec.rb +6 -1
- data/spec/lib/deterministic/option_spec.rb +140 -137
- data/spec/lib/deterministic/result/result_map_spec.rb +155 -154
- data/spec/lib/deterministic/result/result_shared.rb +3 -2
- data/spec/lib/deterministic/result_spec.rb +2 -2
- data/spec/lib/edge_cases_spec.rb +156 -0
- data/spec/lib/enum_spec.rb +1 -1
- data/spec/lib/native_pattern_matching_spec.rb +74 -0
- data/spec/organizer_spec.rb +115 -114
- data/spec/readme_spec.rb +45 -47
- data/spec/sample/calculates_order_tax_action_spec.rb +16 -16
- data/spec/sample/calculates_tax_spec.rb +1 -1
- data/spec/sample/looks_up_tax_percentage_action_spec.rb +55 -55
- data/spec/sample/tax/calculates_order_tax_action.rb +10 -9
- data/spec/sample/tax/looks_up_tax_percentage_action.rb +28 -27
- data/spec/sample/tax/provides_free_shipping_action.rb +11 -10
- data/spec/spec_helper.rb +6 -0
- data/spec/test_doubles.rb +628 -599
- data/spec/testing/context_factory_spec.rb +21 -0
- metadata +45 -161
- data/lib/functional-light-service/organizer/verify_call_method_exists.rb +0 -29
- data/spec/acceptance/include_warning_spec.rb +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a02972ac6e701ec1ed5ceafcea5880e961ccbaf23ff886fe8f490c5bb514e6e1
|
|
4
|
+
data.tar.gz: 0a35af1df1d0820de886bae015cc84846dc0809d4602d12528c7f716b537a2f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ec467e5b62e74629391dfaf9b2e0ede5534338b3ce1411f9c0f7c4a9c38b7aa880701ddd98e4fd5f8a61fa7e8dc741633c626a6b422c544084c825e883b1453
|
|
7
|
+
data.tar.gz: e526d9bd6c3736ea555db60add374336dd6a9e957f7fae265bee44282ffe0dbb2fb43bba03eaafd210aab7bcf1f9d1f7af96391fa34b680dacfe4cd148fff4ca
|
|
@@ -2,9 +2,9 @@ name: CI Tests
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
|
-
branches: [ main, master ]
|
|
5
|
+
branches: [ main, master, develop ]
|
|
6
6
|
pull_request:
|
|
7
|
-
branches: [ main, master ]
|
|
7
|
+
branches: [ main, master, develop ]
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
10
|
test:
|
|
@@ -13,19 +13,43 @@ jobs:
|
|
|
13
13
|
fail-fast: false
|
|
14
14
|
matrix:
|
|
15
15
|
os: [ubuntu, macos, windows]
|
|
16
|
-
ruby: [
|
|
17
|
-
gemfile: [dry_inflector_0_2_1, i18n_1_8_11]
|
|
18
|
-
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
|
19
|
-
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
|
|
20
|
-
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
16
|
+
ruby: ['3.1', '3.2', '3.3', '3.4', '4.0']
|
|
21
17
|
steps:
|
|
22
|
-
- uses: actions/checkout@
|
|
18
|
+
- uses: actions/checkout@v4
|
|
23
19
|
- uses: ruby/setup-ruby@v1
|
|
24
20
|
with:
|
|
25
21
|
ruby-version: ${{ matrix.ruby }}
|
|
26
|
-
|
|
22
|
+
bundler-cache: true
|
|
27
23
|
- run: bundle exec rspec spec
|
|
24
|
+
|
|
25
|
+
rubocop:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v4
|
|
29
|
+
- uses: ruby/setup-ruby@v1
|
|
30
|
+
with:
|
|
31
|
+
ruby-version: '3.4'
|
|
32
|
+
bundler-cache: true
|
|
28
33
|
- run: bundle exec rubocop
|
|
34
|
+
|
|
35
|
+
# Verifica che i vincoli minimi delle dipendenze runtime dichiarati
|
|
36
|
+
# nel gemspec siano reali (sulla versione Ruby minima supportata)
|
|
37
|
+
minimal-deps:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
strategy:
|
|
40
|
+
fail-fast: false
|
|
41
|
+
matrix:
|
|
42
|
+
gemfile: [dry_inflector_0_2_1, i18n_1_8_11]
|
|
43
|
+
env:
|
|
44
|
+
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
- uses: ruby/setup-ruby@v1
|
|
48
|
+
with:
|
|
49
|
+
ruby-version: '3.1'
|
|
50
|
+
bundler-cache: true
|
|
51
|
+
- run: bundle exec rspec spec
|
|
52
|
+
|
|
29
53
|
codecov:
|
|
30
54
|
name: Codecov
|
|
31
55
|
runs-on: ubuntu-latest
|
|
@@ -35,8 +59,8 @@ jobs:
|
|
|
35
59
|
- uses: actions/checkout@v4
|
|
36
60
|
- uses: ruby/setup-ruby@v1
|
|
37
61
|
with:
|
|
38
|
-
ruby-version: 3.
|
|
39
|
-
|
|
62
|
+
ruby-version: '3.4'
|
|
63
|
+
bundler-cache: true
|
|
40
64
|
- run: bundle exec rspec spec
|
|
41
65
|
- uses: codecov/codecov-action@v5
|
|
42
66
|
with:
|
data/.rubocop.yml
CHANGED
|
@@ -1,160 +1,101 @@
|
|
|
1
|
-
# require: rubocop-performance
|
|
2
|
-
|
|
3
|
-
AllCops:
|
|
4
|
-
TargetRubyVersion:
|
|
5
|
-
Exclude:
|
|
6
|
-
- 'lib/functional-light-service.rb'
|
|
7
|
-
- 'vendor/bundle/**/*'
|
|
8
|
-
- 'gemfiles/vendor/bundle/**/*'
|
|
9
|
-
- 'bin/*'
|
|
10
|
-
- 'functional-light-service.gemspec'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Style/
|
|
24
|
-
Enabled: false
|
|
25
|
-
|
|
26
|
-
Style/
|
|
27
|
-
Enabled: false
|
|
28
|
-
|
|
29
|
-
Style/
|
|
30
|
-
Enabled: false
|
|
31
|
-
|
|
32
|
-
Style/
|
|
33
|
-
Enabled:
|
|
34
|
-
|
|
35
|
-
Style/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Style/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Style/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Style/
|
|
45
|
-
Enabled: false
|
|
46
|
-
|
|
47
|
-
Style/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
Metrics/
|
|
57
|
-
Max:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
Enabled: false
|
|
69
|
-
|
|
70
|
-
Layout/
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
Layout/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Enabled:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Enabled: true
|
|
103
|
-
Lint/EmptyBlock: # new in 1.1
|
|
104
|
-
Enabled: true
|
|
105
|
-
Lint/EmptyInPattern: # new in 1.16
|
|
106
|
-
Enabled: true
|
|
107
|
-
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
|
108
|
-
Enabled: true
|
|
109
|
-
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
|
110
|
-
Enabled: true
|
|
111
|
-
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
|
112
|
-
Enabled: true
|
|
113
|
-
Lint/NumberedParameterAssignment: # new in 1.9
|
|
114
|
-
Enabled: true
|
|
115
|
-
Lint/OrAssignmentToConstant: # new in 1.9
|
|
116
|
-
Enabled: true
|
|
117
|
-
Lint/RedundantDirGlobSort: # new in 1.8
|
|
118
|
-
Enabled: true
|
|
119
|
-
Lint/SymbolConversion: # new in 1.9
|
|
120
|
-
Enabled: true
|
|
121
|
-
Lint/ToEnumArguments: # new in 1.1
|
|
122
|
-
Enabled: true
|
|
123
|
-
Lint/TripleQuotes: # new in 1.9
|
|
124
|
-
Enabled: true
|
|
125
|
-
Lint/UnexpectedBlockArity: # new in 1.5
|
|
126
|
-
Enabled: true
|
|
127
|
-
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
|
128
|
-
Enabled: true
|
|
129
|
-
Style/ArgumentsForwarding: # new in 1.1
|
|
130
|
-
Enabled: true
|
|
131
|
-
Style/CollectionCompact: # new in 1.2
|
|
132
|
-
Enabled: true
|
|
133
|
-
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
|
134
|
-
Enabled: true
|
|
135
|
-
Style/EndlessMethod: # new in 1.8
|
|
136
|
-
Enabled: true
|
|
137
|
-
Style/HashConversion: # new in 1.10
|
|
138
|
-
Enabled: true
|
|
139
|
-
Style/HashExcept: # new in 1.7
|
|
140
|
-
Enabled: true
|
|
141
|
-
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
|
142
|
-
Enabled: true
|
|
143
|
-
Style/InPatternThen: # new in 1.16
|
|
144
|
-
Enabled: true
|
|
145
|
-
Style/MultilineInPatternThen: # new in 1.16
|
|
146
|
-
Enabled: true
|
|
147
|
-
Style/NegatedIfElseCondition: # new in 1.2
|
|
148
|
-
Enabled: true
|
|
149
|
-
Style/NilLambda: # new in 1.3
|
|
150
|
-
Enabled: true
|
|
151
|
-
Style/QuotedSymbols: # new in 1.16
|
|
152
|
-
Enabled: true
|
|
153
|
-
Style/RedundantArgument: # new in 1.4
|
|
154
|
-
Enabled: true
|
|
155
|
-
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
|
156
|
-
Enabled: true
|
|
157
|
-
Style/StringChars: # new in 1.12
|
|
158
|
-
Enabled: true
|
|
159
|
-
Style/SwapValues: # new in 1.1
|
|
160
|
-
Enabled: true
|
|
1
|
+
# require: rubocop-performance
|
|
2
|
+
|
|
3
|
+
AllCops:
|
|
4
|
+
TargetRubyVersion: 3.1
|
|
5
|
+
Exclude:
|
|
6
|
+
- 'lib/functional-light-service.rb'
|
|
7
|
+
- 'vendor/bundle/**/*'
|
|
8
|
+
- 'gemfiles/vendor/bundle/**/*'
|
|
9
|
+
- 'bin/*'
|
|
10
|
+
- 'functional-light-service.gemspec'
|
|
11
|
+
- 'audit/**/*'
|
|
12
|
+
NewCops: enable
|
|
13
|
+
SuggestExtensions: false
|
|
14
|
+
|
|
15
|
+
Style/Documentation:
|
|
16
|
+
Enabled: false
|
|
17
|
+
|
|
18
|
+
Style/FrozenStringLiteralComment:
|
|
19
|
+
Enabled: true
|
|
20
|
+
Include:
|
|
21
|
+
- 'lib/**/*.rb'
|
|
22
|
+
|
|
23
|
+
Style/Encoding:
|
|
24
|
+
Enabled: false
|
|
25
|
+
|
|
26
|
+
Style/StringLiterals:
|
|
27
|
+
Enabled: false
|
|
28
|
+
|
|
29
|
+
Style/FormatStringToken:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
Style/RedundantReturn:
|
|
33
|
+
Enabled: false
|
|
34
|
+
|
|
35
|
+
Style/SignalException:
|
|
36
|
+
Enabled: true
|
|
37
|
+
|
|
38
|
+
Style/HashSyntax:
|
|
39
|
+
EnforcedStyle: hash_rockets
|
|
40
|
+
|
|
41
|
+
Style/TrivialAccessors:
|
|
42
|
+
AllowPredicates: true
|
|
43
|
+
|
|
44
|
+
Style/MissingRespondToMissing:
|
|
45
|
+
Enabled: false
|
|
46
|
+
|
|
47
|
+
Style/Alias:
|
|
48
|
+
Enabled: false
|
|
49
|
+
|
|
50
|
+
Style/Lambda:
|
|
51
|
+
EnforcedStyle: literal
|
|
52
|
+
|
|
53
|
+
Naming/PredicatePrefix:
|
|
54
|
+
Enabled: false
|
|
55
|
+
|
|
56
|
+
Metrics/MethodLength:
|
|
57
|
+
Max: 15
|
|
58
|
+
|
|
59
|
+
Metrics/BlockLength:
|
|
60
|
+
Max: 35
|
|
61
|
+
Exclude:
|
|
62
|
+
- 'spec/**/*.rb'
|
|
63
|
+
|
|
64
|
+
Metrics/AbcSize:
|
|
65
|
+
Max: 24
|
|
66
|
+
|
|
67
|
+
Naming/MethodParameterName:
|
|
68
|
+
Enabled: false
|
|
69
|
+
|
|
70
|
+
Layout/TrailingEmptyLines:
|
|
71
|
+
Enabled: false
|
|
72
|
+
|
|
73
|
+
Layout/LineLength:
|
|
74
|
+
Max: 100
|
|
75
|
+
|
|
76
|
+
Layout/EndOfLine:
|
|
77
|
+
Enabled: False
|
|
78
|
+
|
|
79
|
+
Lint/ConstantDefinitionInBlock:
|
|
80
|
+
Exclude:
|
|
81
|
+
- 'spec/**/*.rb'
|
|
82
|
+
|
|
83
|
+
Lint/EmptyClass:
|
|
84
|
+
Exclude:
|
|
85
|
+
- 'spec/**/*.rb'
|
|
86
|
+
|
|
87
|
+
# I cop nuovi sono abilitati automaticamente da NewCops: enable
|
|
88
|
+
|
|
89
|
+
# Template method (throw_error_predicate) e simili: nomi storici dell'API interna
|
|
90
|
+
Naming/PredicateMethod:
|
|
91
|
+
Enabled: false
|
|
92
|
+
|
|
93
|
+
# La gem definisce deliberatamente classi correlate nello stesso file
|
|
94
|
+
# (Result + Prelude, i verifier delle chiavi, i test double)
|
|
95
|
+
Style/OneClassPerFile:
|
|
96
|
+
Enabled: false
|
|
97
|
+
|
|
98
|
+
# Nelle spec l'include a top-level e' prassi
|
|
99
|
+
Style/MixinUsage:
|
|
100
|
+
Exclude:
|
|
101
|
+
- 'spec/**/*.rb'
|