danger-swiftformat 0.3.0 → 0.3.1
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/Gemfile.lock +2 -2
- data/lib/swiftformat/gem_version.rb +1 -1
- data/lib/swiftformat/swiftformat.rb +9 -1
- data/spec/fixtures/swiftformat_output_bad.txt +9 -0
- data/spec/swiftformat/swiftformat_spec.rb +15 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f81a4c7e44e5a23a8d7067dce1c851f898ed8a8
|
4
|
+
data.tar.gz: 345782e42ac5b52abd278476c527ba412e374763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c660ed15219c13a5d4d68f6196207e06a418cb2cc0277b60a39dc71ef73add88d1c0112a29a9662eef8c22d012c81f39f93ed2de971e884a1f187b8100afdca
|
7
|
+
data.tar.gz: bc68d5038eb2355a49c79aa3b1fc58a385cbbe3c6b66e3315cbcace224a048f8df3f20df70c69d778ddf10ae9b13887bba40ab850457620e3451af1cb47c2620
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
danger-swiftformat (0.3.
|
4
|
+
danger-swiftformat (0.3.1)
|
5
5
|
danger-plugin-api (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
colored2 (3.1.2)
|
20
20
|
cork (0.3.0)
|
21
21
|
colored2 (~> 3.1)
|
22
|
-
danger (5.5.
|
22
|
+
danger (5.5.6)
|
23
23
|
claide (~> 1.0)
|
24
24
|
claide-plugins (>= 0.9.2)
|
25
25
|
colored2 (~> 3.1)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "logger"
|
2
|
+
|
1
3
|
module Danger
|
2
4
|
class SwiftFormat
|
3
5
|
def initialize(path = nil)
|
@@ -45,7 +47,13 @@ module Danger
|
|
45
47
|
RUNTIME_REGEX = /.*swiftformat completed.*(.+\..+)s/
|
46
48
|
|
47
49
|
def run_time(output)
|
48
|
-
RUNTIME_REGEX.match(output)
|
50
|
+
if RUNTIME_REGEX.match(output)
|
51
|
+
RUNTIME_REGEX.match(output)[1]
|
52
|
+
else
|
53
|
+
logger = Logger.new(STDERR)
|
54
|
+
logger.error("Invalid run_time output: #{output}")
|
55
|
+
"-1"
|
56
|
+
end
|
49
57
|
end
|
50
58
|
end
|
51
59
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
running swiftformat...
|
2
|
+
formatting /Users/garriguv/FirstClass.swift
|
3
|
+
-- no changes
|
4
|
+
formatting /Users/garriguv/FileWithErrors.swift
|
5
|
+
-- no changes
|
6
|
+
formatting /Users/garriguv/OtherFile.swift
|
7
|
+
-- no changes
|
8
|
+
|
9
|
+
swiftformat completed. 0/3 files would have been updated in 0.08m
|
@@ -113,5 +113,20 @@ RSpec.describe Danger::SwiftFormat do
|
|
113
113
|
|
114
114
|
expect(@sut.check_format(%w(.), "--self insert --indent tab")).to eq(output)
|
115
115
|
end
|
116
|
+
|
117
|
+
it "should not crash if the output is invalid" do
|
118
|
+
expect(@cmd).to receive(:run)
|
119
|
+
.with(%w(swiftformat . --self insert --indent tab --dryrun --verbose))
|
120
|
+
.and_return(fixture("swiftformat_output_bad.txt"))
|
121
|
+
|
122
|
+
output = {
|
123
|
+
errors: [],
|
124
|
+
stats: {
|
125
|
+
run_time: "-1"
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
expect(@sut.check_format(%w(.), "--self insert --indent tab")).to eq(output)
|
130
|
+
end
|
116
131
|
end
|
117
132
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-swiftformat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Garrigues
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- lib/swiftformat/plugin.rb
|
175
175
|
- lib/swiftformat/swiftformat.rb
|
176
176
|
- spec/fixtures/swiftformat_output.txt
|
177
|
+
- spec/fixtures/swiftformat_output_bad.txt
|
177
178
|
- spec/fixtures/swiftformat_output_with_errors.txt
|
178
179
|
- spec/spec_helper.rb
|
179
180
|
- spec/swiftformat/plugin_spec.rb
|
@@ -204,6 +205,7 @@ specification_version: 4
|
|
204
205
|
summary: A danger plugin for checking Swift formatting using SwiftFormat.
|
205
206
|
test_files:
|
206
207
|
- spec/fixtures/swiftformat_output.txt
|
208
|
+
- spec/fixtures/swiftformat_output_bad.txt
|
207
209
|
- spec/fixtures/swiftformat_output_with_errors.txt
|
208
210
|
- spec/spec_helper.rb
|
209
211
|
- spec/swiftformat/plugin_spec.rb
|