danger-dangermattic 1.2.2 → 1.2.4
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/.rubocop.yml +1 -1
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +95 -57
- data/lib/dangermattic/gem_version.rb +1 -1
- data/lib/dangermattic/plugins/android_unit_test_checker.rb +7 -4
- data/lib/dangermattic/plugins/manifest_pr_checker.rb +25 -8
- data/lib/dangermattic/plugins/podfile_checker.rb +2 -0
- data/lib/dangermattic/plugins/pr_size_checker.rb +10 -12
- data/rakelib/console.rake +1 -1
- data/rakelib/git_helpers.rake +1 -1
- data/spec/android_unit_test_checker_spec.rb +93 -3
- data/spec/fixtures/android_unit_test_checker/MixDataPlusNormalClass.kt +14 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/api/ApiResult.kt +69 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/api/WebRecordApi.kt +49 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/domain/drive/UiStates.kt +13 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/main/settings/integrations/connect/AppIntegrationModule.kt +29 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/main/streaks/StreaksViewModel.kt +377 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/mediastorage/MediaStorageConfiguration.kt +31 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/utils/AccountType.kt +15 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/utils/usecase/SelectPhotoUseCase.kt +76 -0
- data/spec/pr_size_checker_spec.rb +27 -26
- data/spec/spec_helper.rb +8 -2
- data/spec/view_changes_checker_spec.rb +15 -15
- metadata +11 -2
@@ -72,19 +72,19 @@ module Danger
|
|
72
72
|
end
|
73
73
|
|
74
74
|
context 'when fail on error is false and a custom message is given' do
|
75
|
-
|
75
|
+
it_behaves_like 'reporting diff size custom warnings or errors', false, 'this is my custom warning message'
|
76
76
|
end
|
77
77
|
|
78
78
|
context 'when fail on error is false' do
|
79
|
-
|
79
|
+
it_behaves_like 'reporting diff size custom warnings or errors', false
|
80
80
|
end
|
81
81
|
|
82
82
|
context 'when fail on error is true' do
|
83
|
-
|
83
|
+
it_behaves_like 'reporting diff size custom warnings or errors', true
|
84
84
|
end
|
85
85
|
|
86
86
|
context 'when a custom error message is given and fail on error is true' do
|
87
|
-
|
87
|
+
it_behaves_like 'reporting diff size custom warnings or errors', true, 'this is my custom error message'
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -146,35 +146,36 @@ module Danger
|
|
146
146
|
allow(@plugin.git).to receive_messages(added_files: [added_config, added_file], modified_files: [modified_file1, modified_file2, added_test_file, modified_strings], deleted_files: [deleted_file1, deleted_test_file, deleted_strings, deleted_file2])
|
147
147
|
|
148
148
|
allow(@plugin.git).to receive(:diff).and_return(instance_double(Git::Diff))
|
149
|
-
|
149
|
+
# Populate stats hash directly with insertions/deletions data for the optimized code path
|
150
|
+
expected_files = {
|
151
|
+
added_test_file => { insertions: 201 },
|
152
|
+
added_config => { insertions: 311 },
|
153
|
+
added_file => { insertions: 13 },
|
154
|
+
modified_file1 => { insertions: 127, deletions: 159 },
|
155
|
+
modified_file2 => { insertions: 43, deletions: 37 },
|
156
|
+
modified_strings => { insertions: 432, deletions: 297 },
|
157
|
+
deleted_file1 => { deletions: 246 },
|
158
|
+
deleted_file2 => { deletions: 493 },
|
159
|
+
deleted_test_file => { deletions: 222 },
|
160
|
+
deleted_strings => { deletions: 593 }
|
161
|
+
}
|
150
162
|
allow(@plugin.git.diff).to receive(:stats).and_return({ files: expected_files })
|
151
|
-
|
152
|
-
allow(@plugin.git).to receive(:info_for_file).with(added_test_file).and_return({ insertions: 201 })
|
153
|
-
allow(@plugin.git).to receive(:info_for_file).with(added_config).and_return({ insertions: 311 })
|
154
|
-
allow(@plugin.git).to receive(:info_for_file).with(added_file).and_return({ insertions: 13 })
|
155
|
-
allow(@plugin.git).to receive(:info_for_file).with(modified_file1).and_return({ insertions: 127, deletions: 159 })
|
156
|
-
allow(@plugin.git).to receive(:info_for_file).with(modified_file2).and_return({ insertions: 43, deletions: 37 })
|
157
|
-
allow(@plugin.git).to receive(:info_for_file).with(modified_strings).and_return({ insertions: 432, deletions: 297 })
|
158
|
-
allow(@plugin.git).to receive(:info_for_file).with(deleted_file1).and_return({ deletions: 246 })
|
159
|
-
allow(@plugin.git).to receive(:info_for_file).with(deleted_file2).and_return({ deletions: 493 })
|
160
|
-
allow(@plugin.git).to receive(:info_for_file).with(deleted_test_file).and_return({ deletions: 222 })
|
161
|
-
allow(@plugin.git).to receive(:info_for_file).with(deleted_strings).and_return({ deletions: 593 })
|
162
163
|
end
|
163
164
|
end
|
164
165
|
|
165
166
|
context 'with the entire diff' do
|
166
|
-
|
167
|
-
|
167
|
+
it_behaves_like 'using the default diff size counter, without a file selector', :all
|
168
|
+
it_behaves_like 'using a file selector to filter and count the changes in a diff', :all, [422, 520, 1541]
|
168
169
|
end
|
169
170
|
|
170
171
|
context 'with the insertions in the diff' do
|
171
|
-
|
172
|
-
|
172
|
+
it_behaves_like 'using the default diff size counter, without a file selector', :insertions
|
173
|
+
it_behaves_like 'using a file selector to filter and count the changes in a diff', :insertions, [200, 139, 384]
|
173
174
|
end
|
174
175
|
|
175
176
|
context 'with the deletions in the diff' do
|
176
|
-
|
177
|
-
|
177
|
+
it_behaves_like 'using the default diff size counter, without a file selector', :deletions
|
178
|
+
it_behaves_like 'using a file selector to filter and count the changes in a diff', :deletions, [221, 380, 1157]
|
178
179
|
end
|
179
180
|
end
|
180
181
|
|
@@ -221,19 +222,19 @@ module Danger
|
|
221
222
|
end
|
222
223
|
|
223
224
|
context 'when fail on error is false and a custom message is given' do
|
224
|
-
|
225
|
+
it_behaves_like 'reporting PR length check custom warnings or errors', false, 'this is my custom warning message'
|
225
226
|
end
|
226
227
|
|
227
228
|
context 'when fail on error is false' do
|
228
|
-
|
229
|
+
it_behaves_like 'reporting PR length check custom warnings or errors', false
|
229
230
|
end
|
230
231
|
|
231
232
|
context 'when fail on error is true' do
|
232
|
-
|
233
|
+
it_behaves_like 'reporting PR length check custom warnings or errors', true
|
233
234
|
end
|
234
235
|
|
235
236
|
context 'when a custom error message is given and fail on error is true' do
|
236
|
-
|
237
|
+
it_behaves_like 'reporting PR length check custom warnings or errors', true, 'this is my custom error message'
|
237
238
|
end
|
238
239
|
end
|
239
240
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -58,8 +58,14 @@ def testing_dangerfile
|
|
58
58
|
Danger::Dangerfile.new(env, testing_ui)
|
59
59
|
end
|
60
60
|
|
61
|
-
|
62
|
-
|
61
|
+
# Returns the full path of the fixture at the given subpath (relative to `spec/fixtures`)
|
62
|
+
def fixture_path(*path_components)
|
63
|
+
File.join('spec', 'fixtures', *path_components)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Returns the content of the fixture at the given path (relative to `spec/fixtures`)
|
67
|
+
def fixture(*path_components)
|
68
|
+
File.read(fixture_path(*path_components))
|
63
69
|
end
|
64
70
|
|
65
71
|
# custom matchers
|
@@ -123,62 +123,62 @@ module Danger
|
|
123
123
|
|
124
124
|
context 'when checking an iOS PR' do
|
125
125
|
context 'with view code changes in Swift files' do
|
126
|
-
|
126
|
+
it_behaves_like 'PR with view code changes', ['TestView.swift', 'SimpleViewHelper.m']
|
127
127
|
end
|
128
128
|
|
129
129
|
context 'with button changes in Swift files' do
|
130
|
-
|
130
|
+
it_behaves_like 'PR with view code changes', ['SimpleViewHelper.m', 'MyAwesomeButton.swift']
|
131
131
|
end
|
132
132
|
|
133
133
|
context 'with view code changes in ObjC files' do
|
134
|
-
|
134
|
+
it_behaves_like 'PR with view code changes', ['TestView.m', 'SimpleViewHelper.m']
|
135
135
|
end
|
136
136
|
|
137
137
|
context 'with button changes in ObjC files' do
|
138
|
-
|
138
|
+
it_behaves_like 'PR with view code changes', ['SimpleViewHelper.m', 'MyAwesomeButton.m']
|
139
139
|
end
|
140
140
|
|
141
141
|
context 'with changes in a .xib file' do
|
142
|
-
|
142
|
+
it_behaves_like 'PR with view code changes', ['SimpleViewHelper.m', 'top_bar.xib']
|
143
143
|
end
|
144
144
|
|
145
145
|
context 'with changes in a Storyboard' do
|
146
|
-
|
146
|
+
it_behaves_like 'PR with view code changes', ['SimpleViewHelper.m', 'main_screen.storyboard']
|
147
147
|
end
|
148
148
|
|
149
149
|
context 'with no view changes' do
|
150
|
-
|
151
|
-
|
150
|
+
it_behaves_like 'PR without view code changes',
|
151
|
+
['SimpleViewHelper.m', 'MyButtonTester.swift', 'Version.xcconfig']
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
155
|
context 'when checking an Android PR' do
|
156
156
|
context 'with view code changes in Kotlin files' do
|
157
|
-
|
157
|
+
it_behaves_like 'PR with view code changes', ['SimpleViewHelper.kt', 'MySimpleView.kt']
|
158
158
|
end
|
159
159
|
|
160
160
|
context 'with button changes in Kotlin files' do
|
161
|
-
|
161
|
+
it_behaves_like 'PR with view code changes', ['MyAwesomeButton.kt', 'SimpleViewHelper.java']
|
162
162
|
end
|
163
163
|
|
164
164
|
context 'with view code changes in Java files' do
|
165
|
-
|
165
|
+
it_behaves_like 'PR with view code changes', ['TestView.java', 'SimpleViewHelper.kt']
|
166
166
|
end
|
167
167
|
|
168
168
|
context 'with button changes in Java files' do
|
169
|
-
|
169
|
+
it_behaves_like 'PR with view code changes', ['SimpleViewHelper.kt', 'MyAwesomeButton.java']
|
170
170
|
end
|
171
171
|
|
172
172
|
context 'with view code changes in a XML file' do
|
173
|
-
|
173
|
+
it_behaves_like 'PR with view code changes', ['test_view.xml', 'SimpleViewHelper.kt', 'strings.xml']
|
174
174
|
end
|
175
175
|
|
176
176
|
context 'with button changes in a XML file' do
|
177
|
-
|
177
|
+
it_behaves_like 'PR with view code changes', ['SimpleViewHelper.kt', 'strings.xml', 'my_awesome_button.xml']
|
178
178
|
end
|
179
179
|
|
180
180
|
context 'with no view changes' do
|
181
|
-
|
181
|
+
it_behaves_like 'PR without view code changes', ['SimpleViewHelper.java', 'values.xml', 'MyButtonTester.kt']
|
182
182
|
end
|
183
183
|
end
|
184
184
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-dangermattic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Automattic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger
|
@@ -247,6 +247,7 @@ files:
|
|
247
247
|
- spec/fixtures/android_unit_test_checker/Abcdef.kt
|
248
248
|
- spec/fixtures/android_unit_test_checker/AbcdefgViewHelper.java
|
249
249
|
- spec/fixtures/android_unit_test_checker/AnotherViewHelper.kt
|
250
|
+
- spec/fixtures/android_unit_test_checker/MixDataPlusNormalClass.kt
|
250
251
|
- spec/fixtures/android_unit_test_checker/MyNewClass.java
|
251
252
|
- spec/fixtures/android_unit_test_checker/Polygon.kt
|
252
253
|
- spec/fixtures/android_unit_test_checker/PublicAndPrivateType.kt
|
@@ -267,6 +268,14 @@ files:
|
|
267
268
|
- spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/PublicTypeTest.kt
|
268
269
|
- spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/TestMyNewClass.java
|
269
270
|
- spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/ToolTest.kt
|
271
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/api/ApiResult.kt
|
272
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/api/WebRecordApi.kt
|
273
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/domain/drive/UiStates.kt
|
274
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/main/settings/integrations/connect/AppIntegrationModule.kt
|
275
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/main/streaks/StreaksViewModel.kt
|
276
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/mediastorage/MediaStorageConfiguration.kt
|
277
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/utils/AccountType.kt
|
278
|
+
- spec/fixtures/android_unit_test_checker/src/main/java/com/dayoneapp/dayone/utils/usecase/SelectPhotoUseCase.kt
|
270
279
|
- spec/fixtures/android_unit_test_checker/src/main/java/org/wordpress/android/widgets/NestedWebView.kt
|
271
280
|
- spec/fixtures/android_unit_test_checker/src/main/java/org/wordpress/util/config/BloggingPromptsFeatureConfig.kt
|
272
281
|
- spec/fixtures/android_unit_test_checker/src/test/java/org/test/TestsINeedThem.java
|