danger-dangermattic 1.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 +7 -0
- data/.buildkite/gem-push.sh +15 -0
- data/.buildkite/pipeline.yml +69 -0
- data/.bundle/config +2 -0
- data/.github/workflows/reusable-check-labels-on-issues.yml +91 -0
- data/.github/workflows/reusable-run-danger.yml +54 -0
- data/.gitignore +30 -0
- data/.rubocop.yml +67 -0
- data/.ruby-version +1 -0
- data/.yardopts +7 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +191 -0
- data/Guardfile +21 -0
- data/LICENSE +373 -0
- data/README.md +68 -0
- data/Rakefile +24 -0
- data/danger-dangermattic.gemspec +58 -0
- data/lib/danger_dangermattic.rb +3 -0
- data/lib/danger_plugin.rb +4 -0
- data/lib/dangermattic/gem_version.rb +5 -0
- data/lib/dangermattic/plugins/android_release_checker.rb +50 -0
- data/lib/dangermattic/plugins/android_strings_checker.rb +31 -0
- data/lib/dangermattic/plugins/android_unit_test_checker.rb +187 -0
- data/lib/dangermattic/plugins/common/common_release_checker.rb +113 -0
- data/lib/dangermattic/plugins/common/git_utils.rb +166 -0
- data/lib/dangermattic/plugins/common/github_utils.rb +68 -0
- data/lib/dangermattic/plugins/common/reporter.rb +38 -0
- data/lib/dangermattic/plugins/ios_release_checker.rb +106 -0
- data/lib/dangermattic/plugins/labels_checker.rb +74 -0
- data/lib/dangermattic/plugins/manifest_pr_checker.rb +106 -0
- data/lib/dangermattic/plugins/milestone_checker.rb +98 -0
- data/lib/dangermattic/plugins/podfile_checker.rb +122 -0
- data/lib/dangermattic/plugins/pr_size_checker.rb +125 -0
- data/lib/dangermattic/plugins/tracks_checker.rb +72 -0
- data/lib/dangermattic/plugins/view_changes_checker.rb +46 -0
- data/spec/android_release_checker_spec.rb +93 -0
- data/spec/android_strings_checker_spec.rb +185 -0
- data/spec/android_unit_test_checker_spec.rb +343 -0
- data/spec/common_release_checker_spec.rb +70 -0
- data/spec/fixtures/android_unit_test_checker/Abc.java +7 -0
- data/spec/fixtures/android_unit_test_checker/AbcFeatureConfig.java +7 -0
- data/spec/fixtures/android_unit_test_checker/Abcdef.kt +5 -0
- data/spec/fixtures/android_unit_test_checker/AbcdefgViewHelper.java +7 -0
- data/spec/fixtures/android_unit_test_checker/AnotherViewHelper.kt +7 -0
- data/spec/fixtures/android_unit_test_checker/MyNewClass.java +7 -0
- data/spec/fixtures/android_unit_test_checker/Polygon.kt +3 -0
- data/spec/fixtures/android_unit_test_checker/Shape.kt +10 -0
- data/spec/fixtures/android_unit_test_checker/TestsINeedThem.java +5 -0
- data/spec/fixtures/android_unit_test_checker/TestsINeedThem.kt +7 -0
- data/spec/fixtures/android_unit_test_checker/TestsINeedThem2.kt +12 -0
- data/spec/fixtures/android_unit_test_checker/src/android/java/org/activities/MyActivity.kt +7 -0
- data/spec/fixtures/android_unit_test_checker/src/android/java/org/activities/MyJavaActivity.java +7 -0
- data/spec/fixtures/android_unit_test_checker/src/android/java/org/fragments/MyFragment.kt +6 -0
- data/spec/fixtures/android_unit_test_checker/src/android/java/org/fragments/MyNewJavaFragment.java +7 -0
- data/spec/fixtures/android_unit_test_checker/src/android/java/org/module/MyModule.java +13 -0
- data/spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt +22 -0
- data/spec/fixtures/android_unit_test_checker/src/android/java/org/view/MyRecyclerView.java +7 -0
- data/spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/AbcTests.java +5 -0
- data/spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/AnotherTestClass.java +7 -0
- data/spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/PolygonTest.kt +4 -0
- data/spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/TestMyNewClass.java +9 -0
- data/spec/fixtures/android_unit_test_checker/src/androidTest/java/org/test/ToolTest.kt +5 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/org/wordpress/android/widgets/NestedWebView.kt +32 -0
- data/spec/fixtures/android_unit_test_checker/src/main/java/org/wordpress/util/config/BloggingPromptsFeatureConfig.kt +23 -0
- data/spec/fixtures/android_unit_test_checker/src/test/java/org/test/TestsINeedThem.java +9 -0
- data/spec/github_utils_spec.rb +110 -0
- data/spec/ios_release_checker_spec.rb +191 -0
- data/spec/labels_checker_spec.rb +169 -0
- data/spec/manifest_pr_checker_spec.rb +140 -0
- data/spec/milestone_checker_spec.rb +222 -0
- data/spec/podfile_checker_spec.rb +595 -0
- data/spec/pr_size_checker_spec.rb +250 -0
- data/spec/spec_helper.rb +115 -0
- data/spec/tracks_checker_spec.rb +156 -0
- data/spec/view_changes_checker_spec.rb +168 -0
- metadata +341 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
package src.android.java.org.module;
|
2
|
+
|
3
|
+
import dagger.hilt.components.SingletonComponent;
|
4
|
+
import dagger.android.AndroidInjectionModule;
|
5
|
+
|
6
|
+
@InstallIn(SingletonComponent.class)
|
7
|
+
@Module(includes = AndroidInjectionModule.class)
|
8
|
+
public class MyModule {
|
9
|
+
@Provides
|
10
|
+
public static SharedPreferences provideSharedPrefs(@ApplicationContext Context context) {
|
11
|
+
return PreferenceManager.getDefaultSharedPreferences(context);
|
12
|
+
}
|
13
|
+
}
|
data/spec/fixtures/android_unit_test_checker/src/android/java/org/view/ActionCardViewHolder.kt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
// Taken from https://github.com/wordpress-mobile/WordPress-Android/blob/trunk/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/sections/viewholders/ActionCardViewHolder.kt
|
2
|
+
import android.view.ViewGroup
|
3
|
+
import androidx.core.text.HtmlCompat
|
4
|
+
import org.wordpress.android.databinding.StatsBlockListActionCardBinding
|
5
|
+
import org.wordpress.android.ui.stats.refresh.lists.sections.BlockListItem.ListItemActionCard
|
6
|
+
import org.wordpress.android.util.extensions.viewBinding
|
7
|
+
|
8
|
+
class ActionCardViewHolder(
|
9
|
+
val parent: ViewGroup,
|
10
|
+
val binding: StatsBlockListActionCardBinding = parent.viewBinding(StatsBlockListActionCardBinding::inflate)
|
11
|
+
) : BlockListItemViewHolder(binding.root) {
|
12
|
+
fun bind(
|
13
|
+
item: ListItemActionCard
|
14
|
+
) = with(binding) {
|
15
|
+
actionTitle.text = parent.context.getString(item.titleResource)
|
16
|
+
actionMessage.text = HtmlCompat.fromHtml(parent.context.getString(item.text), HtmlCompat.FROM_HTML_MODE_LEGACY)
|
17
|
+
buttonPositive.setText(item.positiveButtonText)
|
18
|
+
buttonPositive.setOnClickListener { item.positiveAction.click() }
|
19
|
+
buttonNegative.setText(item.negativeButtonText)
|
20
|
+
buttonNegative.setOnClickListener { item.negativeAction.click() }
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
// example declaration taken from https://github.com/wordpress-mobile/WordPress-Android/blob/44282b137085ec230771fc2c87ad9a44610fbeb1/WordPress/src/main/java/org/wordpress/android/widgets/NestedWebView.kt
|
2
|
+
package org.wordpress.android.widgets
|
3
|
+
|
4
|
+
import android.annotation.SuppressLint
|
5
|
+
import android.content.Context
|
6
|
+
import android.util.AttributeSet
|
7
|
+
import android.view.MotionEvent
|
8
|
+
import androidx.core.view.NestedScrollingChild3
|
9
|
+
import androidx.core.view.NestedScrollingChildHelper
|
10
|
+
import androidx.core.view.ViewCompat
|
11
|
+
import org.wordpress.android.ui.WPWebView
|
12
|
+
import android.R as AndroidR
|
13
|
+
|
14
|
+
class NestedWebView @JvmOverloads constructor(
|
15
|
+
context: Context,
|
16
|
+
attrs: AttributeSet? = null,
|
17
|
+
defStyleAttr: Int = AndroidR.attr.webViewStyle
|
18
|
+
) : WPWebView(context, attrs, defStyleAttr), NestedScrollingChild3 {
|
19
|
+
private var lastY = 0
|
20
|
+
private val scrollOffset = IntArray(2)
|
21
|
+
private val scrollConsumed = IntArray(2)
|
22
|
+
private var nestedOffsetY = 0
|
23
|
+
private val nestedScrollingChildHelper: NestedScrollingChildHelper = NestedScrollingChildHelper(this)
|
24
|
+
|
25
|
+
override fun dispatchNestedPreFling(velocityX: Float, velocityY: Float): Boolean {
|
26
|
+
return nestedScrollingChildHelper.dispatchNestedPreFling(velocityX, velocityY)
|
27
|
+
}
|
28
|
+
|
29
|
+
init {
|
30
|
+
isNestedScrollingEnabled = true
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// Taken from https://github.com/wordpress-mobile/WordPress-Android/blob/44282b137085ec230771fc2c87ad9a44610fbeb1/WordPress/src/main/java/org/wordpress/android/util/config/BloggingPromptsFeatureConfig.kt
|
2
|
+
package org.wordpress.android.util.config
|
3
|
+
|
4
|
+
import org.wordpress.android.BuildConfig
|
5
|
+
import org.wordpress.android.annotation.Feature
|
6
|
+
import org.wordpress.android.util.config.BloggingPromptsFeatureConfig.Companion.BLOGGING_PROMPTS_REMOTE_FIELD
|
7
|
+
import javax.inject.Inject
|
8
|
+
|
9
|
+
@Feature(BLOGGING_PROMPTS_REMOTE_FIELD, true)
|
10
|
+
class BloggingPromptsFeatureConfig
|
11
|
+
@Inject constructor(appConfig: AppConfig) : FeatureConfig(
|
12
|
+
appConfig,
|
13
|
+
BuildConfig.BLOGGING_PROMPTS,
|
14
|
+
BLOGGING_PROMPTS_REMOTE_FIELD
|
15
|
+
) {
|
16
|
+
override fun isEnabled(): Boolean {
|
17
|
+
return super.isEnabled() && BuildConfig.IS_JETPACK_APP
|
18
|
+
}
|
19
|
+
|
20
|
+
companion object {
|
21
|
+
const val BLOGGING_PROMPTS_REMOTE_FIELD = "blogging_prompts_remote_field"
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'spec_helper'
|
4
|
+
|
5
|
+
module Danger
|
6
|
+
describe Danger::GithubUtils do
|
7
|
+
it 'is a plugin' do
|
8
|
+
expect(described_class.new(nil)).to be_a Danger::Plugin
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'with the common_release_checker plugin' do
|
12
|
+
let(:github) do
|
13
|
+
instance_double(Danger::DangerfileGitHubPlugin, {
|
14
|
+
pr_json: {
|
15
|
+
'base' => { 'repo' => { 'full_name' => 'Automattic/dangermattic' } },
|
16
|
+
'number' => 42,
|
17
|
+
'requested_teams' => [],
|
18
|
+
'requested_reviewers' => []
|
19
|
+
},
|
20
|
+
api: instance_double(Octokit::Client),
|
21
|
+
branch_for_base: 'main',
|
22
|
+
pr_labels: [],
|
23
|
+
pr_title: 'Some PR Title'
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
before do
|
28
|
+
@dangerfile = testing_dangerfile
|
29
|
+
@plugin = @dangerfile.github_utils
|
30
|
+
|
31
|
+
allow(@plugin).to receive(:github).and_return(github)
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#active_reviewers?' do
|
35
|
+
it 'returns true when there are active reviewers' do
|
36
|
+
allow(github.api).to receive(:pull_request_reviews).and_return(%w[review1 review2])
|
37
|
+
expect(@plugin.active_reviewers?).to be(true)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns false when there are no active reviewers' do
|
41
|
+
allow(github.api).to receive(:pull_request_reviews).and_return([])
|
42
|
+
expect(@plugin.active_reviewers?).to be(false)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe '#requested_reviewers?' do
|
47
|
+
it 'returns true when there are requested reviewers' do
|
48
|
+
allow(github.pr_json).to receive(:[]).with('requested_teams').and_return(['team1'])
|
49
|
+
expect(@plugin.requested_reviewers?).to be(true)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'returns true when there are active reviewers' do
|
53
|
+
allow(github.api).to receive(:pull_request_reviews).and_return(%w[review1 review2])
|
54
|
+
expect(@plugin.requested_reviewers?).to be(true)
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'returns false when there are no requested reviewers or active reviewers' do
|
58
|
+
allow(github.api).to receive(:pull_request_reviews).and_return([])
|
59
|
+
expect(@plugin.requested_reviewers?).to be(false)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#main_branch?' do
|
64
|
+
it 'returns true when the branch is a main branch' do
|
65
|
+
allow(github).to receive(:branch_for_base).and_return('develop')
|
66
|
+
expect(@plugin.main_branch?).to be(true)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'returns false when the branch is not a main branch' do
|
70
|
+
allow(github).to receive(:branch_for_base).and_return('feature-branch')
|
71
|
+
expect(@plugin.main_branch?).to be(false)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#release_branch?' do
|
76
|
+
it 'returns true when the branch is a release branch' do
|
77
|
+
allow(github).to receive(:branch_for_base).and_return('release/30.6.0')
|
78
|
+
expect(@plugin.release_branch?).to be(true)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'returns true when the branch is a hotfix branch' do
|
82
|
+
allow(github).to receive(:branch_for_base).and_return('hotfix/fix-bug')
|
83
|
+
expect(@plugin.release_branch?).to be(true)
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'returns false when the branch is neither a release nor a hotfix branch' do
|
87
|
+
allow(github).to receive(:branch_for_base).and_return('feature-branch')
|
88
|
+
expect(@plugin.release_branch?).to be(false)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe '#wip_feature?' do
|
93
|
+
it 'returns true when there is a WIP label' do
|
94
|
+
allow(github).to receive(:pr_labels).and_return(['WIP'])
|
95
|
+
expect(@plugin.wip_feature?).to be(true)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'returns true when there is WIP in the title' do
|
99
|
+
allow(github).to receive(:pr_title).and_return('WIP: Some PR Title')
|
100
|
+
expect(@plugin.wip_feature?).to be(true)
|
101
|
+
end
|
102
|
+
|
103
|
+
it 'returns false when there is no WIP label or WIP in the title' do
|
104
|
+
allow(github).to receive_messages(pr_labels: [], pr_title: 'Some PR Title')
|
105
|
+
expect(@plugin.wip_feature?).to be(false)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'spec_helper'
|
4
|
+
|
5
|
+
module Danger
|
6
|
+
describe Danger::IosReleaseChecker do
|
7
|
+
it 'is a plugin' do
|
8
|
+
expect(described_class.new(nil)).to be_a Danger::Plugin
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'with Dangerfile' do
|
12
|
+
before do
|
13
|
+
@dangerfile = testing_dangerfile
|
14
|
+
@plugin = @dangerfile.ios_release_checker
|
15
|
+
|
16
|
+
allow(@plugin.git).to receive_messages(added_files: [], modified_files: [], deleted_files: [])
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when changing the Core Data model' do
|
20
|
+
it 'reports a warning when a PR on a release branch changes a Core Data model' do
|
21
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['./path/to/model/Model.xcdatamodeld'])
|
22
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('release/30.6')
|
23
|
+
|
24
|
+
@plugin.check_core_data_model_changed
|
25
|
+
|
26
|
+
expect(@dangerfile).to report_warnings([IosReleaseChecker::MESSAGE_CORE_DATA_UPDATED])
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'does nothing when a PR changes a Core Data model on a regular branch' do
|
30
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['./path/to/model/Model.xcdatamodeld'])
|
31
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('develop')
|
32
|
+
|
33
|
+
@plugin.check_core_data_model_changed
|
34
|
+
|
35
|
+
expect(@dangerfile).to not_report
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'does nothing when a PR ca warning when a PR does not change a Core Data model on the release branch' do
|
39
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['./path/to/view/model/MyViewModel.swift'])
|
40
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('release/30.6')
|
41
|
+
|
42
|
+
@plugin.check_core_data_model_changed
|
43
|
+
|
44
|
+
expect(@dangerfile).to not_report
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'when changing the Localizable.strings files' do
|
49
|
+
describe '#check_modified_localizable_strings_on_release' do
|
50
|
+
it 'reports a warning when a PR on a regular branch changes the source Localizable.strings' do
|
51
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['en.lproj/Localizable.strings'])
|
52
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('develop')
|
53
|
+
|
54
|
+
@plugin.check_modified_localizable_strings_on_release
|
55
|
+
|
56
|
+
expect(@dangerfile).to report_warnings([IosReleaseChecker::MESSAGE_STRINGS_FILE_UPDATED])
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'reports a warning when a PR on a regular branch changes a translated Localizable.strings' do
|
60
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['nl.lproj/Localizable.strings'])
|
61
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('trunk')
|
62
|
+
|
63
|
+
@plugin.check_modified_localizable_strings_on_release
|
64
|
+
|
65
|
+
expect(@dangerfile).to report_warnings([IosReleaseChecker::MESSAGE_STRINGS_FILE_UPDATED])
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'does nothing when a PR changes the Localizable.strings on a release branch' do
|
69
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['en.lproj/Localizable.strings'])
|
70
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('release/30.6')
|
71
|
+
|
72
|
+
@plugin.check_modified_localizable_strings_on_release
|
73
|
+
|
74
|
+
expect(@dangerfile).to not_report
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'does nothing when a PR does not change the Localizable.strings on a regular branch' do
|
78
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['./path/to/view/model/MyViewModel.swift'])
|
79
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('develop')
|
80
|
+
|
81
|
+
@plugin.check_modified_localizable_strings_on_release
|
82
|
+
|
83
|
+
expect(@dangerfile).to not_report
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '#check_modified_en_strings_on_regular_branch' do
|
88
|
+
it 'reports a warning when a PR on a release branch changes the source Localizable.strings' do
|
89
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['en.lproj/Localizable.strings'])
|
90
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('release/30.6')
|
91
|
+
|
92
|
+
@plugin.check_modified_en_strings_on_regular_branch
|
93
|
+
|
94
|
+
expect(@dangerfile).to report_warnings([IosReleaseChecker::MESSAGE_BASE_STRINGS_FILE_UPDATED])
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'does nothing when a PR changes the Localizable.strings on a regular branch' do
|
98
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['en.lproj/Localizable.strings'])
|
99
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('develop')
|
100
|
+
|
101
|
+
@plugin.check_modified_en_strings_on_regular_branch
|
102
|
+
|
103
|
+
expect(@dangerfile).to not_report
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'does nothing when a PR on a release branch changes a translated Localizable.strings' do
|
107
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['nl.lproj/Localizable.strings'])
|
108
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('release/30.6')
|
109
|
+
|
110
|
+
@plugin.check_modified_en_strings_on_regular_branch
|
111
|
+
|
112
|
+
expect(@dangerfile).to not_report
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'does nothing when a PR does not change the Localizable.strings on a release branch' do
|
116
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['./path/to/view/model/MyViewModel2.swift'])
|
117
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('release/30.6')
|
118
|
+
|
119
|
+
@plugin.check_modified_en_strings_on_regular_branch
|
120
|
+
|
121
|
+
expect(@dangerfile).to not_report
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe '#check_modified_translations_on_release_branch' do
|
126
|
+
it 'reports a warning when a PR on a regular branch changes a translation file' do
|
127
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['be.lproj/Localizable.strings'])
|
128
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('develop')
|
129
|
+
|
130
|
+
@plugin.check_modified_translations_on_release_branch
|
131
|
+
|
132
|
+
expect(@dangerfile).to report_warnings([IosReleaseChecker::MESSAGE_TRANSLATION_FILE_UPDATED])
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'does nothing when a PR changes a translation string on a release branch' do
|
136
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['fr.lproj/Localizable.strings'])
|
137
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('release/30.6')
|
138
|
+
|
139
|
+
@plugin.check_modified_translations_on_release_branch
|
140
|
+
|
141
|
+
expect(@dangerfile).to not_report
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'does nothing when a PR on a regular branch changes the source Localizable.strings' do
|
145
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['./en.lproj/Localizable.strings'])
|
146
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('develop')
|
147
|
+
|
148
|
+
@plugin.check_modified_translations_on_release_branch
|
149
|
+
|
150
|
+
expect(@dangerfile).to not_report
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'does nothing when a PR does not change a translation file on a regular branch' do
|
154
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['./path/to/view/model/MyViewModel3.swift'])
|
155
|
+
allow(@plugin.github).to receive(:branch_for_base).and_return('develop')
|
156
|
+
|
157
|
+
@plugin.check_modified_translations_on_release_branch
|
158
|
+
|
159
|
+
expect(@dangerfile).to not_report
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'when changing the release notes' do
|
165
|
+
it 'reports a warning when a PR changes the release notes but not the AppStore strings file' do
|
166
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['Resources/release_notes.txt'])
|
167
|
+
|
168
|
+
@plugin.check_release_notes_and_app_store_strings
|
169
|
+
|
170
|
+
expect(@dangerfile).to report_messages([format(CommonReleaseChecker::MESSAGE_STORE_FILE_NOT_CHANGED, 'Resources/AppStoreStrings.po', 'Resources/release_notes.txt')])
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'does nothing when a PR changes the release notes and the AppStore strings file' do
|
174
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['Resources/release_notes.txt', 'Resources/AppStoreStrings.po'])
|
175
|
+
|
176
|
+
@plugin.check_release_notes_and_app_store_strings
|
177
|
+
|
178
|
+
expect(@dangerfile).to not_report
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'does nothing when a PR does not change the release notes or the AppStore strings file' do
|
182
|
+
allow(@plugin.git).to receive(:modified_files).and_return(['MyView.swift', 'Resources/AppStoreStrings.tmp'])
|
183
|
+
|
184
|
+
@plugin.check_release_notes_and_app_store_strings
|
185
|
+
|
186
|
+
expect(@dangerfile).to not_report
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|