trailblazer-macro-contract 2.1.4 → 2.1.5
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/ci.yml +1 -1
- data/CHANGES.md +4 -0
- data/Gemfile +6 -10
- data/lib/trailblazer/macro/contract/build.rb +7 -9
- data/lib/trailblazer/macro/contract/persist.rb +5 -2
- data/lib/trailblazer/macro/contract/validate.rb +19 -9
- data/lib/trailblazer/macro/contract/version.rb +1 -1
- data/test/docs/contract_test.rb +11 -10
- data/test/operation/contract_test.rb +1 -1
- data/test/test_helper.rb +6 -18
- data/trailblazer-macro-contract.gemspec +3 -3
- metadata +9 -15
- data/.github/workflows/ci_jruby.yml +0 -19
- data/.github/workflows/ci_legacy.yml +0 -19
- data/.github/workflows/ci_truffleruby.yml +0 -19
- data/.rubocop-https---raw-githubusercontent-com-trailblazer-meta-master-rubocop-yml +0 -136
- data/.rubocop.yml +0 -9
- data/.rubocop_todo.yml +0 -237
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc683dd764a82d3e373aa4656086632035f765b40670a6e30e7820b9623185d
|
4
|
+
data.tar.gz: e05b281e657a7fee96d70a1c4668298009a396e3c96250031a5b8d1526dac096
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a18a04d845668fdc8acec87848b6b9080bda62529cbcf1c38b48abe8d31b133c865c27a0914fc13f2117ef6cfb03ebce912c5c20a7f62b953ff1a0b368ca1a16
|
7
|
+
data.tar.gz: 670ea7f5487cfd36bed24519aef8175bff616402ec03f00523715051fc645bbdfdef76b60d258b9554f61cc8a44567e6ee3b0ec6e7e5cfca46e9ef22c482902e
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -2,16 +2,12 @@ source 'https://rubygems.org'
|
|
2
2
|
# Specify your gem's dependencies in trailblazer.gemspec
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem "
|
6
|
-
gem "
|
7
|
-
|
8
|
-
# gem "trailblazer-
|
9
|
-
# gem "trailblazer-
|
10
|
-
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
11
|
-
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
5
|
+
# gem "trailblazer-operation", path: "../trailblazer-operation"
|
6
|
+
# gem "trailblazer-macro", path: "../trailblazer-macro"
|
7
|
+
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
8
|
+
# gem "trailblazer-activity-dsl-linear", path: "../trailblazer-activity-dsl-linear"
|
9
|
+
# gem "trailblazer-developer", path: "../trailblazer-developer"
|
12
10
|
# gem "trailblazer-errors", path: "../trailblazer-errors"
|
13
|
-
# gem "trailblazer-developer", path: "../trailblazer-developer"
|
14
11
|
|
15
12
|
gem "minitest-line"
|
16
|
-
|
17
|
-
gem "rubocop", require: false
|
13
|
+
gem "standard"
|
@@ -4,12 +4,10 @@ module Trailblazer
|
|
4
4
|
module Macro
|
5
5
|
module Contract
|
6
6
|
def self.Build(name: "default", constant: nil, builder: nil)
|
7
|
-
contract_path
|
7
|
+
contract_path = :"contract.#{name}"
|
8
8
|
|
9
9
|
injections = {
|
10
|
-
Activity::Railway.Inject() => {
|
11
|
-
"#{contract_path}.class": ->(*) { constant }, # default to {constant} if not injected.
|
12
|
-
}
|
10
|
+
Activity::Railway.Inject("#{contract_path}.class") => ->(*) { constant }, # default to {constant} if not injected.
|
13
11
|
}
|
14
12
|
|
15
13
|
# DISCUSS: can we force-default this via Inject()?
|
@@ -29,17 +27,17 @@ module Trailblazer
|
|
29
27
|
default_contract_builder = ->(ctx, model: nil, **) { ctx[:"#{contract_path}.class"].new(model) }
|
30
28
|
|
31
29
|
# proc is called via {Option()}.
|
32
|
-
task_option_proc = builder
|
30
|
+
task_option_proc = builder || default_contract_builder
|
33
31
|
|
34
32
|
# after the builder proc is run, assign its result to {:"contract.default"}.
|
35
33
|
task = Macro.task_adapter_for_decider(task_option_proc, variable_name: contract_path)
|
36
34
|
|
37
35
|
{
|
38
36
|
task: task, id: "contract.build",
|
39
|
-
}
|
40
|
-
merge(injections)
|
41
|
-
merge(input)
|
42
|
-
merge(output)
|
37
|
+
}
|
38
|
+
.merge(injections)
|
39
|
+
.merge(input)
|
40
|
+
.merge(output)
|
43
41
|
end
|
44
42
|
|
45
43
|
module DSL
|
@@ -3,11 +3,14 @@ module Trailblazer
|
|
3
3
|
module Contract
|
4
4
|
def self.Persist(method: :save, name: "default")
|
5
5
|
path = :"contract.#{name}"
|
6
|
-
step = ->(
|
6
|
+
step = ->(ctx, **) { ctx[path].send(method) }
|
7
7
|
|
8
8
|
task = Activity::Circuit::TaskAdapter.for_step(step)
|
9
9
|
|
10
|
-
{
|
10
|
+
{
|
11
|
+
task: task,
|
12
|
+
id: "persist.save"
|
13
|
+
}
|
11
14
|
end
|
12
15
|
end
|
13
16
|
end
|
@@ -15,23 +15,33 @@ module Trailblazer
|
|
15
15
|
|
16
16
|
# These are defaulting dependency injection, more here
|
17
17
|
# https://trailblazer.to/2.1/docs/activity.html#activity-dependency-injection-inject-defaulting
|
18
|
-
extract_injections = {key_path => ->(*) { key }} # default to {key} if not injected.
|
19
|
-
validate_injections = {contract_path => ->(*) { constant }} # default the contract instance to {constant}, if not injected (or passed down from {Build()})
|
20
18
|
|
21
19
|
# Build a simple Railway {Activity} for the internal flow.
|
22
|
-
activity =
|
23
|
-
|
24
|
-
|
20
|
+
activity = Activity::Railway(name: "Contract::Validate") do
|
21
|
+
unless skip_extract
|
22
|
+
step extract,
|
23
|
+
id: "#{params_path}_extract",
|
24
|
+
Output(:failure) => End(:extract_failure),
|
25
|
+
Inject(key_path) => ->(*) { key } # default to {key} if not injected.
|
26
|
+
end
|
27
|
+
|
28
|
+
step validate,
|
29
|
+
id: "contract.#{name}.call",
|
30
|
+
Inject(contract_path) => ->(*) { constant } # default the contract instance to {constant}, if not injected (or passed down from {Build()})
|
25
31
|
end
|
26
32
|
|
27
33
|
options = activity.Subprocess(activity)
|
28
|
-
options
|
34
|
+
options.merge!(id: "contract.#{name}.validate")
|
29
35
|
|
30
36
|
# Deviate End.extract_failure to the standard failure track as a default. This can be changed from the user side.
|
31
|
-
|
37
|
+
unless skip_extract
|
38
|
+
options.merge!(activity.Output(:extract_failure) => activity.Track(:failure))
|
39
|
+
end
|
32
40
|
|
33
41
|
# Halt failure track to End with {contract.name.invalid}.
|
34
|
-
|
42
|
+
if invalid_data_terminus
|
43
|
+
options.merge!(activity.Output(:failure) => activity.End(:invalid_data))
|
44
|
+
end
|
35
45
|
|
36
46
|
options
|
37
47
|
end
|
@@ -49,7 +59,7 @@ module Trailblazer
|
|
49
59
|
end
|
50
60
|
end
|
51
61
|
|
52
|
-
def initialize(name: "default", representer: false, params_path: nil
|
62
|
+
def initialize(name: "default", contract_path:, representer: false, params_path: nil)
|
53
63
|
@name, @representer, @params_path, @contract_path = name, representer, params_path, contract_path
|
54
64
|
end
|
55
65
|
|
data/test/docs/contract_test.rb
CHANGED
@@ -308,10 +308,10 @@ class DocsContractKeyWithOutputTest < Minitest::Spec
|
|
308
308
|
|
309
309
|
#:key-output
|
310
310
|
class Song::Create < Trailblazer::Operation
|
311
|
-
step Model(
|
312
|
-
step Contract::Build(
|
313
|
-
step Contract::Validate(
|
314
|
-
step Contract::Persist(
|
311
|
+
step Model(Song, :new)
|
312
|
+
step Contract::Build(constant: Song::Contract::Create)
|
313
|
+
step Contract::Validate(key: "song"), Output(:extract_failure) => End(:key_not_found)
|
314
|
+
step Contract::Persist()
|
315
315
|
end
|
316
316
|
#:key-output end
|
317
317
|
|
@@ -379,16 +379,17 @@ class DocsContractInvalidEndTest < Minitest::Spec
|
|
379
379
|
|
380
380
|
#:invalid-end
|
381
381
|
class Song::Create < Trailblazer::Operation
|
382
|
-
step Model(
|
383
|
-
step Contract::Build(
|
384
|
-
step Contract::Validate(
|
385
|
-
step Contract::Persist(
|
382
|
+
step Model(Song, :new)
|
383
|
+
step Contract::Build(constant: Song::Contract::Create)
|
384
|
+
step Contract::Validate(key: :song, invalid_data_terminus: true)
|
385
|
+
step Contract::Persist()
|
386
386
|
end
|
387
387
|
#:invalid-end end
|
388
388
|
|
389
389
|
it do
|
390
|
-
result = Song::Create.(params: {song: {
|
391
|
-
|
390
|
+
result = Song::Create.(params: {song: {title: nil, length: nil}})
|
391
|
+
|
392
|
+
assert_equal result.event.to_h[:semantic].inspect, %(:invalid_data)
|
392
393
|
end
|
393
394
|
|
394
395
|
it { Song::Create.(params: {song: { title: "SVG", length: 13 }}).inspect(:model).must_equal %{<Result:true [#<struct DocsContractInvalidEndTest::Song title=\"SVG\", length=13>] >} }
|
@@ -76,7 +76,7 @@ class ContractTest < Minitest::Spec
|
|
76
76
|
|
77
77
|
#- overwriting Validate
|
78
78
|
class NewHit < Upsert
|
79
|
-
step Contract::Validate(
|
79
|
+
step Contract::Validate(key: :hit), override: true
|
80
80
|
end
|
81
81
|
|
82
82
|
it { Trailblazer::Developer.railway(NewHit).must_equal %{[>model.build,>contract.build,>contract.default.validate,>persist.save]} }
|
data/test/test_helper.rb
CHANGED
@@ -4,8 +4,9 @@ require "trailblazer-macro-contract"
|
|
4
4
|
require "pp"
|
5
5
|
require 'delegate'
|
6
6
|
require "trailblazer/operation"
|
7
|
-
require "trailblazer/developer"
|
8
7
|
require "trailblazer/macro"
|
8
|
+
require "trailblazer/developer"
|
9
|
+
# require "trailblazer/activity/testing"
|
9
10
|
require "minitest/autorun"
|
10
11
|
|
11
12
|
# TODO: convert tests to non-rails.
|
@@ -14,26 +15,13 @@ Reform::Form.class_eval do
|
|
14
15
|
include Reform::Form::ActiveModel::Validations
|
15
16
|
end
|
16
17
|
|
17
|
-
module Mock
|
18
|
-
class Result
|
19
|
-
def initialize(bool); @bool = bool end
|
20
|
-
def success?; @bool end
|
21
|
-
def errors; ["hihi"] end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
module Test
|
26
|
-
module ReturnCall
|
27
|
-
def self.included(includer)
|
28
|
-
includer._insert :_insert, ReturnResult, {replace: Trailblazer::Operation::Result::Build}, ReturnResult, ""
|
29
|
-
end
|
30
|
-
end
|
31
|
-
ReturnResult = ->(last, input, options) { input }
|
32
|
-
end
|
33
|
-
|
34
18
|
Memo = Struct.new(:id, :body) do
|
35
19
|
def self.find(id)
|
36
20
|
return new(id, "Yo!") if id
|
37
21
|
nil
|
38
22
|
end
|
39
23
|
end
|
24
|
+
|
25
|
+
# Minitest::Spec.class_eval do
|
26
|
+
# include Trailblazer::Activity::Testing::Assertions
|
27
|
+
# end
|
@@ -23,14 +23,14 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "dry-validation"
|
25
25
|
spec.add_development_dependency "reform-rails", "~> 0.2.0.rc2"
|
26
|
-
spec.add_development_dependency "trailblazer-macro"
|
26
|
+
spec.add_development_dependency "trailblazer-macro"#, ">= 2.1.14"
|
27
27
|
spec.add_development_dependency "trailblazer-developer"
|
28
28
|
spec.add_development_dependency "activemodel", "~> 6.0.0" # FIXME: we still don't support the Rails 6.1 errors object.
|
29
29
|
|
30
30
|
spec.add_development_dependency "minitest"
|
31
31
|
spec.add_development_dependency "rake"
|
32
32
|
|
33
|
-
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.
|
33
|
+
spec.add_dependency "trailblazer-activity-dsl-linear", ">= 1.2.0", "< 1.3.0"
|
34
34
|
|
35
|
-
spec.required_ruby_version = ">= 2.
|
35
|
+
spec.required_ruby_version = ">= 2.5.0"
|
36
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-macro-contract
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: reform
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: '0'
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: '0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: trailblazer-developer
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,20 +148,20 @@ dependencies:
|
|
148
148
|
requirements:
|
149
149
|
- - ">="
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 1.
|
151
|
+
version: 1.2.0
|
152
152
|
- - "<"
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version: 1.
|
154
|
+
version: 1.3.0
|
155
155
|
type: :runtime
|
156
156
|
prerelease: false
|
157
157
|
version_requirements: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
159
|
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: 1.
|
161
|
+
version: 1.2.0
|
162
162
|
- - "<"
|
163
163
|
- !ruby/object:Gem::Version
|
164
|
-
version: 1.
|
164
|
+
version: 1.3.0
|
165
165
|
description: Operation macros for form objects
|
166
166
|
email:
|
167
167
|
- apotonick@gmail.com
|
@@ -170,13 +170,7 @@ extensions: []
|
|
170
170
|
extra_rdoc_files: []
|
171
171
|
files:
|
172
172
|
- ".github/workflows/ci.yml"
|
173
|
-
- ".github/workflows/ci_jruby.yml"
|
174
|
-
- ".github/workflows/ci_legacy.yml"
|
175
|
-
- ".github/workflows/ci_truffleruby.yml"
|
176
173
|
- ".gitignore"
|
177
|
-
- ".rubocop-https---raw-githubusercontent-com-trailblazer-meta-master-rubocop-yml"
|
178
|
-
- ".rubocop.yml"
|
179
|
-
- ".rubocop_todo.yml"
|
180
174
|
- CHANGES.md
|
181
175
|
- COMM-LICENSE
|
182
176
|
- Gemfile
|
@@ -207,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
201
|
requirements:
|
208
202
|
- - ">="
|
209
203
|
- !ruby/object:Gem::Version
|
210
|
-
version: 2.
|
204
|
+
version: 2.5.0
|
211
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
206
|
requirements:
|
213
207
|
- - ">="
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI JRuby
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [jruby, jruby-head]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI with EOL ruby versions
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [2.5, 2.6]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|
@@ -1,19 +0,0 @@
|
|
1
|
-
## This file is managed by Terraform.
|
2
|
-
## Do not modify this file directly, as it may be overwritten.
|
3
|
-
## Please open an issue instead.
|
4
|
-
name: CI TruffleRuby
|
5
|
-
on: [push, pull_request]
|
6
|
-
jobs:
|
7
|
-
test:
|
8
|
-
strategy:
|
9
|
-
fail-fast: false
|
10
|
-
matrix:
|
11
|
-
ruby: [truffleruby, truffleruby-head]
|
12
|
-
runs-on: ubuntu-latest
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v3
|
15
|
-
- uses: ruby/setup-ruby@v1
|
16
|
-
with:
|
17
|
-
ruby-version: ${{ matrix.ruby }}
|
18
|
-
bundler-cache: true
|
19
|
-
- run: bundle exec rake
|
@@ -1,136 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.5.0
|
3
|
-
DisplayCopNames: true
|
4
|
-
Layout/CaseIndentation:
|
5
|
-
IndentOneStep: true
|
6
|
-
Layout/FirstArrayElementLineBreak:
|
7
|
-
Enabled: true
|
8
|
-
Layout/FirstHashElementLineBreak:
|
9
|
-
Enabled: true
|
10
|
-
Layout/FirstMethodArgumentLineBreak:
|
11
|
-
Enabled: true
|
12
|
-
Layout/FirstMethodParameterLineBreak:
|
13
|
-
Enabled: true
|
14
|
-
Layout/MultilineAssignmentLayout:
|
15
|
-
Enabled: true
|
16
|
-
EnforcedStyle: same_line
|
17
|
-
Layout/SpaceInsideHashLiteralBraces:
|
18
|
-
EnforcedStyle: no_space
|
19
|
-
Metrics/LineLength:
|
20
|
-
Max: 130
|
21
|
-
Metrics/ParameterLists:
|
22
|
-
Max: 5
|
23
|
-
Naming/VariableNumber:
|
24
|
-
EnforcedStyle: snake_case
|
25
|
-
Style/AndOr:
|
26
|
-
EnforcedStyle: conditionals
|
27
|
-
Style/AutoResourceCleanup:
|
28
|
-
Enabled: true
|
29
|
-
Style/CollectionMethods:
|
30
|
-
Enabled: true
|
31
|
-
Style/Documentation:
|
32
|
-
Enabled: false
|
33
|
-
Style/EmptyLiteral:
|
34
|
-
Enabled: false
|
35
|
-
Style/EmptyMethod:
|
36
|
-
EnforcedStyle: expanded
|
37
|
-
Style/FormatStringToken:
|
38
|
-
EnforcedStyle: template
|
39
|
-
Style/ImplicitRuntimeError:
|
40
|
-
Enabled: true
|
41
|
-
Style/MethodCalledOnDoEndBlock:
|
42
|
-
Enabled: true
|
43
|
-
Style/MethodDefParentheses:
|
44
|
-
EnforcedStyle: require_parentheses
|
45
|
-
Style/MissingElse:
|
46
|
-
Enabled: true
|
47
|
-
EnforcedStyle: case
|
48
|
-
Style/NumericLiterals:
|
49
|
-
Enabled: false
|
50
|
-
Style/OptionHash:
|
51
|
-
Enabled: true
|
52
|
-
Style/PercentLiteralDelimiters:
|
53
|
-
PreferredDelimiters:
|
54
|
-
"%w": "[]"
|
55
|
-
"%W": "[]"
|
56
|
-
"%i": "[]"
|
57
|
-
"%I": "[]"
|
58
|
-
"%r": "()"
|
59
|
-
Style/ReturnNil:
|
60
|
-
Enabled: true
|
61
|
-
Style/SafeNavigation:
|
62
|
-
Enabled: false
|
63
|
-
Style/Send:
|
64
|
-
Enabled: true
|
65
|
-
Style/SignalException:
|
66
|
-
EnforcedStyle: semantic
|
67
|
-
Style/StringLiterals:
|
68
|
-
EnforcedStyle: double_quotes
|
69
|
-
Style/StringLiteralsInInterpolation:
|
70
|
-
EnforcedStyle: double_quotes
|
71
|
-
Style/StringMethods:
|
72
|
-
Enabled: true
|
73
|
-
Style/SymbolArray:
|
74
|
-
Enabled: true
|
75
|
-
# this allows in rspec to have expect { } with multiple lines
|
76
|
-
Style/BlockDelimiters:
|
77
|
-
EnforcedStyle: braces_for_chaining
|
78
|
-
Layout/EndOfLine:
|
79
|
-
Enabled: false
|
80
|
-
# don't need these checks in test folders
|
81
|
-
Metrics/ModuleLength:
|
82
|
-
Exclude:
|
83
|
-
- "spec/**/*"
|
84
|
-
- "test/**/*"
|
85
|
-
Metrics/BlockLength:
|
86
|
-
Exclude:
|
87
|
-
- "spec/**/*"
|
88
|
-
- "test/**/*"
|
89
|
-
- "*.gemspec" # definitely not in the gemspec
|
90
|
-
Metrics/MethodLength:
|
91
|
-
Max: 20
|
92
|
-
Lint/UnreachableCode:
|
93
|
-
Description: 'Unreachable code.'
|
94
|
-
Enabled: false
|
95
|
-
Lint/Void:
|
96
|
-
Enabled: false
|
97
|
-
Layout/AlignHash:
|
98
|
-
EnforcedLastArgumentHashStyle: ignore_implicit
|
99
|
-
Metrics/AbcSize:
|
100
|
-
Max: 25
|
101
|
-
Style/LambdaCall:
|
102
|
-
Enabled: false
|
103
|
-
Style/Semicolon:
|
104
|
-
Enabled: false
|
105
|
-
Naming/UncommunicativeMethodParamName:
|
106
|
-
Enabled: false
|
107
|
-
Style/ClassAndModuleChildren:
|
108
|
-
Enabled: false
|
109
|
-
Layout/LeadingCommentSpace:
|
110
|
-
Exclude:
|
111
|
-
- 'test/docs/**/*'
|
112
|
-
Layout/AlignHash:
|
113
|
-
EnforcedHashRocketStyle: table
|
114
|
-
Style/FrozenStringLiteralComment:
|
115
|
-
Enabled: false
|
116
|
-
Layout/AlignHash:
|
117
|
-
EnforcedColonStyle: table
|
118
|
-
SingleLineMethods:
|
119
|
-
Enabled: false
|
120
|
-
Style/Lambda:
|
121
|
-
EnforcedStyle: literal
|
122
|
-
Style/AsciiComments:
|
123
|
-
Enabled: false
|
124
|
-
Style/CollectionMethods:
|
125
|
-
Enabled: false
|
126
|
-
Style/RedundantReturn:
|
127
|
-
Enabled: false
|
128
|
-
Style/PercentLiteralDelimiters:
|
129
|
-
PreferredDelimiters:
|
130
|
-
default: {}
|
131
|
-
"%q": '()'
|
132
|
-
"%r": '{}'
|
133
|
-
"%w": '[]'
|
134
|
-
"%": '{}'
|
135
|
-
Style/HashSyntax:
|
136
|
-
Enabled: false
|
data/.rubocop.yml
DELETED
data/.rubocop_todo.yml
DELETED
@@ -1,237 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2018-06-19 17:19:28 +0800 using RuboCop version 0.57.2.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Configuration parameters: Include.
|
11
|
-
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
12
|
-
Bundler/DuplicatedGem:
|
13
|
-
Exclude:
|
14
|
-
- 'Gemfile'
|
15
|
-
|
16
|
-
# Offense count: 2
|
17
|
-
# Cop supports --auto-correct.
|
18
|
-
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
19
|
-
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
20
|
-
Bundler/OrderedGems:
|
21
|
-
Exclude:
|
22
|
-
- 'Gemfile'
|
23
|
-
|
24
|
-
# Offense count: 1
|
25
|
-
# Configuration parameters: Include.
|
26
|
-
# Include: **/*.gemspec
|
27
|
-
Gemspec/RequiredRubyVersion:
|
28
|
-
Exclude:
|
29
|
-
- 'trailblazer-macro-contract.gemspec'
|
30
|
-
|
31
|
-
# Offense count: 2
|
32
|
-
# Cop supports --auto-correct.
|
33
|
-
# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
34
|
-
Layout/EmptyLineBetweenDefs:
|
35
|
-
Exclude:
|
36
|
-
- 'test/test_helper.rb'
|
37
|
-
|
38
|
-
# Offense count: 1
|
39
|
-
# Cop supports --auto-correct.
|
40
|
-
# Configuration parameters: EnforcedStyle.
|
41
|
-
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
42
|
-
Layout/EmptyLinesAroundClassBody:
|
43
|
-
Exclude:
|
44
|
-
- 'test/docs/contract_test.rb'
|
45
|
-
|
46
|
-
# Offense count: 1
|
47
|
-
# Cop supports --auto-correct.
|
48
|
-
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
49
|
-
Layout/ExtraSpacing:
|
50
|
-
Exclude:
|
51
|
-
- 'test/docs/contract_test.rb'
|
52
|
-
|
53
|
-
# Offense count: 1
|
54
|
-
# Cop supports --auto-correct.
|
55
|
-
# Configuration parameters: IndentationWidth.
|
56
|
-
Layout/IndentAssignment:
|
57
|
-
Exclude:
|
58
|
-
- 'lib/trailblazer/operation/validate.rb'
|
59
|
-
|
60
|
-
# Offense count: 5
|
61
|
-
# Cop supports --auto-correct.
|
62
|
-
Layout/LeadingCommentSpace:
|
63
|
-
Exclude:
|
64
|
-
- 'test/docs/contract_test.rb'
|
65
|
-
|
66
|
-
# Offense count: 1
|
67
|
-
# Cop supports --auto-correct.
|
68
|
-
# Configuration parameters: EnforcedStyle.
|
69
|
-
# SupportedTypes: block, case, class, if, kwbegin, module
|
70
|
-
# SupportedStyles: same_line, new_line
|
71
|
-
Layout/MultilineAssignmentLayout:
|
72
|
-
Exclude:
|
73
|
-
- 'lib/trailblazer/operation/validate.rb'
|
74
|
-
|
75
|
-
# Offense count: 3
|
76
|
-
# Cop supports --auto-correct.
|
77
|
-
Layout/SpaceAfterColon:
|
78
|
-
Exclude:
|
79
|
-
- 'test/docs/contract_test.rb'
|
80
|
-
|
81
|
-
# Offense count: 7
|
82
|
-
# Cop supports --auto-correct.
|
83
|
-
# Configuration parameters: AllowForAlignment.
|
84
|
-
Layout/SpaceAroundOperators:
|
85
|
-
Exclude:
|
86
|
-
- 'test/docs/contract_test.rb'
|
87
|
-
- 'test/operation/contract_test.rb'
|
88
|
-
- 'test/operation/persist_test.rb'
|
89
|
-
|
90
|
-
# Offense count: 5
|
91
|
-
# Cop supports --auto-correct.
|
92
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
93
|
-
# SupportedStyles: space, no_space
|
94
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
95
|
-
Layout/SpaceInsideBlockBraces:
|
96
|
-
Exclude:
|
97
|
-
- 'test/docs/contract_test.rb'
|
98
|
-
|
99
|
-
# Offense count: 92
|
100
|
-
# Cop supports --auto-correct.
|
101
|
-
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
102
|
-
# SupportedStyles: space, no_space, compact
|
103
|
-
# SupportedStylesForEmptyBraces: space, no_space
|
104
|
-
Layout/SpaceInsideHashLiteralBraces:
|
105
|
-
Exclude:
|
106
|
-
- 'test/docs/contract_test.rb'
|
107
|
-
- 'test/docs/dry_test.rb'
|
108
|
-
- 'test/operation/contract_test.rb'
|
109
|
-
- 'test/operation/persist_test.rb'
|
110
|
-
|
111
|
-
# Offense count: 95
|
112
|
-
# Cop supports --auto-correct.
|
113
|
-
# Configuration parameters: EnforcedStyle.
|
114
|
-
# SupportedStyles: space, no_space
|
115
|
-
Layout/SpaceInsideParens:
|
116
|
-
Exclude:
|
117
|
-
- 'test/docs/contract_test.rb'
|
118
|
-
- 'test/operation/contract_test.rb'
|
119
|
-
- 'test/operation/persist_test.rb'
|
120
|
-
|
121
|
-
# Offense count: 1
|
122
|
-
# Cop supports --auto-correct.
|
123
|
-
# Configuration parameters: EnforcedStyle.
|
124
|
-
# SupportedStyles: final_newline, final_blank_line
|
125
|
-
Layout/TrailingBlankLines:
|
126
|
-
Exclude:
|
127
|
-
- 'test/operation/persist_test.rb'
|
128
|
-
|
129
|
-
# Offense count: 1
|
130
|
-
Lint/ParenthesesAsGroupedExpression:
|
131
|
-
Exclude:
|
132
|
-
- 'test/docs/contract_test.rb'
|
133
|
-
|
134
|
-
# Offense count: 2
|
135
|
-
# Cop supports --auto-correct.
|
136
|
-
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
137
|
-
Lint/UnusedBlockArgument:
|
138
|
-
Exclude:
|
139
|
-
- 'test/test_helper.rb'
|
140
|
-
|
141
|
-
# Offense count: 33
|
142
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
143
|
-
# URISchemes: http, https
|
144
|
-
Metrics/LineLength:
|
145
|
-
Max: 214
|
146
|
-
|
147
|
-
# Offense count: 1
|
148
|
-
# Cop supports --auto-correct.
|
149
|
-
Style/BlockComments:
|
150
|
-
Exclude:
|
151
|
-
- 'test/docs/contract_test.rb'
|
152
|
-
|
153
|
-
# Offense count: 3
|
154
|
-
# Cop supports --auto-correct.
|
155
|
-
# Configuration parameters: EnforcedStyle.
|
156
|
-
# SupportedStyles: braces, no_braces, context_dependent
|
157
|
-
Style/BracesAroundHashParameters:
|
158
|
-
Exclude:
|
159
|
-
- 'test/operation/contract_test.rb'
|
160
|
-
|
161
|
-
# Offense count: 10
|
162
|
-
# Cop supports --auto-correct.
|
163
|
-
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
164
|
-
# SupportedStyles: nested, compact
|
165
|
-
Style/ClassAndModuleChildren:
|
166
|
-
Exclude:
|
167
|
-
- 'test/docs/contract_test.rb'
|
168
|
-
|
169
|
-
# Offense count: 2
|
170
|
-
Style/CommentedKeyword:
|
171
|
-
Exclude:
|
172
|
-
- 'lib/trailblazer/operation/validate.rb'
|
173
|
-
|
174
|
-
# Offense count: 1
|
175
|
-
# Cop supports --auto-correct.
|
176
|
-
Style/ExpandPathArguments:
|
177
|
-
Exclude:
|
178
|
-
- 'trailblazer-macro-contract.gemspec'
|
179
|
-
|
180
|
-
# Offense count: 8
|
181
|
-
# Cop supports --auto-correct.
|
182
|
-
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
183
|
-
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
184
|
-
Style/HashSyntax:
|
185
|
-
Exclude:
|
186
|
-
- 'Rakefile'
|
187
|
-
- 'test/docs/contract_test.rb'
|
188
|
-
- 'test/operation/contract_test.rb'
|
189
|
-
|
190
|
-
# Offense count: 2
|
191
|
-
# Cop supports --auto-correct.
|
192
|
-
Style/ParallelAssignment:
|
193
|
-
Exclude:
|
194
|
-
- 'lib/trailblazer/operation/validate.rb'
|
195
|
-
|
196
|
-
# Offense count: 34
|
197
|
-
# Cop supports --auto-correct.
|
198
|
-
# Configuration parameters: PreferredDelimiters.
|
199
|
-
Style/PercentLiteralDelimiters:
|
200
|
-
Exclude:
|
201
|
-
- 'test/docs/contract_test.rb'
|
202
|
-
- 'test/docs/dry_test.rb'
|
203
|
-
- 'test/operation/contract_test.rb'
|
204
|
-
- 'test/operation/persist_test.rb'
|
205
|
-
- 'trailblazer-macro-contract.gemspec'
|
206
|
-
|
207
|
-
# Offense count: 1
|
208
|
-
Style/Send:
|
209
|
-
Exclude:
|
210
|
-
- 'lib/trailblazer/operation/persist.rb'
|
211
|
-
|
212
|
-
# Offense count: 3
|
213
|
-
# Cop supports --auto-correct.
|
214
|
-
# Configuration parameters: EnforcedStyle.
|
215
|
-
# SupportedStyles: only_raise, only_fail, semantic
|
216
|
-
Style/SignalException:
|
217
|
-
Exclude:
|
218
|
-
- 'lib/trailblazer/operation/contract.rb'
|
219
|
-
|
220
|
-
# Offense count: 6
|
221
|
-
# Cop supports --auto-correct.
|
222
|
-
# Configuration parameters: AllowIfMethodIsEmpty.
|
223
|
-
Style/SingleLineMethods:
|
224
|
-
Exclude:
|
225
|
-
- 'test/operation/persist_test.rb'
|
226
|
-
- 'test/test_helper.rb'
|
227
|
-
|
228
|
-
# Offense count: 11
|
229
|
-
# Cop supports --auto-correct.
|
230
|
-
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
231
|
-
# SupportedStyles: single_quotes, double_quotes
|
232
|
-
Style/StringLiterals:
|
233
|
-
Exclude:
|
234
|
-
- 'Gemfile'
|
235
|
-
- 'Rakefile'
|
236
|
-
- 'test/test_helper.rb'
|
237
|
-
- 'trailblazer-macro-contract.gemspec'
|