danger-swiftformat 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/swiftformat/gem_version.rb +1 -1
- data/lib/swiftformat/plugin.rb +2 -2
- data/spec/swiftformat/plugin_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 878adc127e7cfa90ea5e96b3fcbd1c6cf9ea66c3
|
4
|
+
data.tar.gz: d7acc8b4be1678a16af24585e187729e99066a05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9a04d379f2619634d565702e7fbffced3b67759b2a486132d6900420277089b3c570a0d1aeb886a9bd04718f7a2df9e4d8cb8e3a860332c99c82bca79a61778
|
7
|
+
data.tar.gz: 016ef2f96e85863824e34dc1e0a420244e39430557e961f6b877831ec6c631239b92e984057f2b86d6f1db2f74fcb9216df7498724e1225c6b85b83bf6ddc4df
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -34,10 +34,10 @@ You can specify the `swiftformat` binary using the `binary_path` parameter:
|
|
34
34
|
swiftformat.binary_path = "/path/to/swiftformat"
|
35
35
|
```
|
36
36
|
|
37
|
-
You can specify additional `swiftformat` arguments using the `
|
37
|
+
You can specify additional `swiftformat` arguments using the `additional_args` parameter:
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
swiftformat.
|
40
|
+
swiftformat.additional_args = "--indent tab --self insert"
|
41
41
|
```
|
42
42
|
|
43
43
|
## Development
|
data/lib/swiftformat/plugin.rb
CHANGED
@@ -17,7 +17,7 @@ module Danger
|
|
17
17
|
# Additional swiftformat command line arguments
|
18
18
|
#
|
19
19
|
# @return [String]
|
20
|
-
attr_accessor :
|
20
|
+
attr_accessor :additional_args
|
21
21
|
|
22
22
|
# Runs swiftformat
|
23
23
|
#
|
@@ -36,7 +36,7 @@ module Danger
|
|
36
36
|
return if swift_files.empty?
|
37
37
|
|
38
38
|
# Run swiftformat
|
39
|
-
results = swiftformat.check_format(swift_files,
|
39
|
+
results = swiftformat.check_format(swift_files, additional_args)
|
40
40
|
|
41
41
|
# Stop processing if the errors array is empty
|
42
42
|
return if results[:errors].empty?
|
@@ -31,8 +31,8 @@ module Danger
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
context "with
|
35
|
-
let(:
|
34
|
+
context "with additional_args" do
|
35
|
+
let(:additional_args) { "--indent tab --self insert" }
|
36
36
|
let(:success_output) { { errors: [], stats: { run_time: "0.08s" } } }
|
37
37
|
|
38
38
|
it "should pass the additional flags to swiftformat" do
|
@@ -41,10 +41,10 @@ module Danger
|
|
41
41
|
allow(@sut.git).to receive(:deleted_files).and_return(["Deleted.swift"])
|
42
42
|
allow_any_instance_of(SwiftFormat).to receive(:installed?).and_return(true)
|
43
43
|
allow_any_instance_of(SwiftFormat).to receive(:check_format)
|
44
|
-
.with(%w(Added.swift Modified.swift),
|
44
|
+
.with(%w(Added.swift Modified.swift), additional_args)
|
45
45
|
.and_return(success_output)
|
46
46
|
|
47
|
-
@sut.
|
47
|
+
@sut.additional_args = additional_args
|
48
48
|
|
49
49
|
@sut.check_format(fail_on_error: true)
|
50
50
|
|