ios-app-review-plugin 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.
Files changed (205) hide show
  1. package/.claude/settings.local.json +42 -0
  2. package/.github/actions/ios-review/action.yml +106 -0
  3. package/.github/workflows/ci.yml +103 -0
  4. package/.github/workflows/publish.yml +57 -0
  5. package/CHANGELOG.md +66 -0
  6. package/CONTRIBUTING.md +175 -0
  7. package/LICENSE +21 -0
  8. package/README.md +205 -0
  9. package/bitrise/step.sh +128 -0
  10. package/bitrise/step.yml +101 -0
  11. package/dist/analyzer.d.ts.map +1 -0
  12. package/dist/analyzers/asc-iap.d.ts.map +1 -0
  13. package/dist/analyzers/asc-metadata.d.ts.map +1 -0
  14. package/dist/analyzers/asc-screenshots.d.ts.map +1 -0
  15. package/dist/analyzers/asc-version.d.ts.map +1 -0
  16. package/dist/analyzers/code-scanner.d.ts.map +1 -0
  17. package/dist/analyzers/deprecated-api.d.ts.map +1 -0
  18. package/dist/analyzers/entitlements.d.ts.map +1 -0
  19. package/dist/analyzers/index.d.ts.map +1 -0
  20. package/dist/analyzers/info-plist.d.ts.map +1 -0
  21. package/dist/analyzers/privacy.d.ts.map +1 -0
  22. package/dist/analyzers/private-api.d.ts.map +1 -0
  23. package/dist/analyzers/security.d.ts.map +1 -0
  24. package/dist/analyzers/ui-ux.d.ts.map +1 -0
  25. package/dist/asc/auth.d.ts.map +1 -0
  26. package/dist/asc/client.d.ts.map +1 -0
  27. package/dist/asc/endpoints/apps.d.ts.map +1 -0
  28. package/dist/asc/endpoints/iap.d.ts.map +1 -0
  29. package/dist/asc/endpoints/screenshots.d.ts.map +1 -0
  30. package/dist/asc/endpoints/versions.d.ts.map +1 -0
  31. package/dist/asc/errors.d.ts.map +1 -0
  32. package/dist/asc/index.d.ts.map +1 -0
  33. package/dist/asc/types.d.ts.map +1 -0
  34. package/dist/badge/generator.d.ts.map +1 -0
  35. package/dist/badge/index.d.ts.map +1 -0
  36. package/dist/badge/types.d.ts.map +1 -0
  37. package/dist/cache/file-cache.d.ts.map +1 -0
  38. package/dist/cache/index.d.ts.map +1 -0
  39. package/dist/cache/types.d.ts.map +1 -0
  40. package/dist/cli/commands/help.d.ts.map +1 -0
  41. package/dist/cli/commands/scan.d.ts.map +1 -0
  42. package/dist/cli/commands/version.d.ts.map +1 -0
  43. package/dist/cli/index.d.ts.map +1 -0
  44. package/dist/cli/types.d.ts.map +1 -0
  45. package/dist/git/diff.d.ts.map +1 -0
  46. package/dist/git/index.d.ts.map +1 -0
  47. package/dist/git/types.d.ts.map +1 -0
  48. package/dist/guidelines/database.d.ts.map +1 -0
  49. package/dist/guidelines/index.d.ts.map +1 -0
  50. package/dist/guidelines/matcher.d.ts.map +1 -0
  51. package/dist/guidelines/types.d.ts.map +1 -0
  52. package/dist/history/comparator.d.ts.map +1 -0
  53. package/dist/history/index.d.ts.map +1 -0
  54. package/dist/history/store.d.ts.map +1 -0
  55. package/dist/history/types.d.ts.map +1 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +994 -0
  58. package/dist/parsers/index.d.ts.map +1 -0
  59. package/dist/parsers/plist.d.ts.map +1 -0
  60. package/dist/parsers/xcodeproj.d.ts.map +1 -0
  61. package/dist/progress/index.d.ts.map +1 -0
  62. package/dist/progress/reporter.d.ts.map +1 -0
  63. package/dist/progress/types.d.ts.map +1 -0
  64. package/dist/reports/html.d.ts.map +1 -0
  65. package/dist/reports/index.d.ts.map +1 -0
  66. package/dist/reports/json.d.ts.map +1 -0
  67. package/dist/reports/markdown.d.ts.map +1 -0
  68. package/dist/reports/types.d.ts.map +1 -0
  69. package/dist/rules/engine.d.ts.map +1 -0
  70. package/dist/rules/index.d.ts.map +1 -0
  71. package/dist/rules/loader.d.ts.map +1 -0
  72. package/dist/rules/types.d.ts.map +1 -0
  73. package/dist/types/index.d.ts.map +1 -0
  74. package/docs/ANALYZERS.md +237 -0
  75. package/docs/API.md +308 -0
  76. package/docs/BADGES.md +130 -0
  77. package/docs/CI_CD.md +283 -0
  78. package/docs/CLI.md +140 -0
  79. package/docs/REPORTS.md +212 -0
  80. package/docs/ROADMAP.md +267 -0
  81. package/docs/RULES.md +182 -0
  82. package/docs/SECURITY.md +89 -0
  83. package/docs/TROUBLESHOOTING.md +227 -0
  84. package/docs/tutorials/ASC_SETUP.md +188 -0
  85. package/docs/tutorials/CI_INTEGRATION.md +292 -0
  86. package/docs/tutorials/CUSTOM_RULES.md +291 -0
  87. package/docs/tutorials/GETTING_STARTED.md +226 -0
  88. package/docs/video-scripts/01-introduction.md +106 -0
  89. package/docs/video-scripts/02-cli-usage.md +120 -0
  90. package/docs/video-scripts/03-ci-integration.md +198 -0
  91. package/eslint.config.js +33 -0
  92. package/examples/.ios-review-rules.json +82 -0
  93. package/examples/bitrise-workflow.yml +129 -0
  94. package/examples/fastlane-lane.rb +71 -0
  95. package/examples/github-action.yml +147 -0
  96. package/fastlane/Fastfile.example +114 -0
  97. package/fastlane/README.md +99 -0
  98. package/jest.config.js +36 -0
  99. package/package.json +65 -0
  100. package/scripts/benchmark.ts +112 -0
  101. package/scripts/debug-parser.ts +37 -0
  102. package/scripts/debug-pbxproj.ts +36 -0
  103. package/scripts/debug-specific.ts +47 -0
  104. package/scripts/test-analyze.ts +67 -0
  105. package/scripts/xcode-cloud-review.sh +167 -0
  106. package/src/analyzer.ts +227 -0
  107. package/src/analyzers/asc-iap.ts +300 -0
  108. package/src/analyzers/asc-metadata.ts +326 -0
  109. package/src/analyzers/asc-screenshots.ts +310 -0
  110. package/src/analyzers/asc-version.ts +368 -0
  111. package/src/analyzers/code-scanner.ts +408 -0
  112. package/src/analyzers/deprecated-api.ts +390 -0
  113. package/src/analyzers/entitlements.ts +345 -0
  114. package/src/analyzers/index.ts +12 -0
  115. package/src/analyzers/info-plist.ts +409 -0
  116. package/src/analyzers/privacy.ts +376 -0
  117. package/src/analyzers/private-api.ts +377 -0
  118. package/src/analyzers/security.ts +327 -0
  119. package/src/analyzers/ui-ux.ts +509 -0
  120. package/src/asc/auth.ts +204 -0
  121. package/src/asc/client.ts +258 -0
  122. package/src/asc/endpoints/apps.ts +115 -0
  123. package/src/asc/endpoints/iap.ts +171 -0
  124. package/src/asc/endpoints/screenshots.ts +164 -0
  125. package/src/asc/endpoints/versions.ts +174 -0
  126. package/src/asc/errors.ts +109 -0
  127. package/src/asc/index.ts +108 -0
  128. package/src/asc/types.ts +369 -0
  129. package/src/badge/generator.ts +48 -0
  130. package/src/badge/index.ts +2 -0
  131. package/src/badge/types.ts +5 -0
  132. package/src/cache/file-cache.ts +75 -0
  133. package/src/cache/index.ts +2 -0
  134. package/src/cache/types.ts +10 -0
  135. package/src/cli/commands/help.ts +41 -0
  136. package/src/cli/commands/scan.ts +44 -0
  137. package/src/cli/commands/version.ts +12 -0
  138. package/src/cli/index.ts +92 -0
  139. package/src/cli/types.ts +17 -0
  140. package/src/git/diff.ts +21 -0
  141. package/src/git/index.ts +2 -0
  142. package/src/git/types.ts +5 -0
  143. package/src/guidelines/database.ts +344 -0
  144. package/src/guidelines/index.ts +4 -0
  145. package/src/guidelines/matcher.ts +84 -0
  146. package/src/guidelines/types.ts +28 -0
  147. package/src/history/comparator.ts +114 -0
  148. package/src/history/index.ts +3 -0
  149. package/src/history/store.ts +135 -0
  150. package/src/history/types.ts +40 -0
  151. package/src/index.ts +1113 -0
  152. package/src/parsers/index.ts +3 -0
  153. package/src/parsers/plist.ts +253 -0
  154. package/src/parsers/xcodeproj.ts +265 -0
  155. package/src/progress/index.ts +2 -0
  156. package/src/progress/reporter.ts +65 -0
  157. package/src/progress/types.ts +9 -0
  158. package/src/reports/html.ts +322 -0
  159. package/src/reports/index.ts +20 -0
  160. package/src/reports/json.ts +92 -0
  161. package/src/reports/markdown.ts +187 -0
  162. package/src/reports/types.ts +26 -0
  163. package/src/rules/engine.ts +121 -0
  164. package/src/rules/index.ts +3 -0
  165. package/src/rules/loader.ts +83 -0
  166. package/src/rules/types.ts +25 -0
  167. package/src/types/index.ts +247 -0
  168. package/tests/analyzer.test.ts +142 -0
  169. package/tests/analyzers/asc-iap.test.ts +228 -0
  170. package/tests/analyzers/asc-metadata.test.ts +210 -0
  171. package/tests/analyzers/asc-screenshots.test.ts +135 -0
  172. package/tests/analyzers/asc-version.test.ts +259 -0
  173. package/tests/analyzers/code-scanner.test.ts +745 -0
  174. package/tests/analyzers/deprecated-api.test.ts +286 -0
  175. package/tests/analyzers/entitlements.test.ts +411 -0
  176. package/tests/analyzers/info-plist.test.ts +148 -0
  177. package/tests/analyzers/privacy.test.ts +623 -0
  178. package/tests/analyzers/private-api.test.ts +255 -0
  179. package/tests/analyzers/security.test.ts +300 -0
  180. package/tests/analyzers/ui-ux.test.ts +357 -0
  181. package/tests/asc/auth.test.ts +189 -0
  182. package/tests/asc/client.test.ts +207 -0
  183. package/tests/asc/endpoints.test.ts +1359 -0
  184. package/tests/badge/generator.test.ts +73 -0
  185. package/tests/cache/file-cache.test.ts +124 -0
  186. package/tests/cli/cli-index.test.ts +510 -0
  187. package/tests/cli/commands.test.ts +67 -0
  188. package/tests/cli/scan.test.ts +152 -0
  189. package/tests/git/diff.test.ts +69 -0
  190. package/tests/guidelines/matcher.test.ts +209 -0
  191. package/tests/history/comparator.test.ts +272 -0
  192. package/tests/history/store.test.ts +200 -0
  193. package/tests/integration/cli.test.ts +95 -0
  194. package/tests/integration/e2e.test.ts +130 -0
  195. package/tests/parsers/plist.test.ts +240 -0
  196. package/tests/parsers/xcodeproj.test.ts +289 -0
  197. package/tests/progress/reporter.test.ts +117 -0
  198. package/tests/reports/html.test.ts +176 -0
  199. package/tests/reports/json.test.ts +235 -0
  200. package/tests/reports/markdown.test.ts +196 -0
  201. package/tests/rules/engine.test.ts +229 -0
  202. package/tests/rules/loader.test.ts +187 -0
  203. package/tests/setup.ts +15 -0
  204. package/tsconfig.json +27 -0
  205. package/tsconfig.test.json +9 -0
@@ -0,0 +1,259 @@
1
+ import { ASCVersionAnalyzer } from '../../src/analyzers/asc-version';
2
+ import type { XcodeProject } from '../../src/types/index';
3
+
4
+ // Mock the ASC module
5
+ jest.mock('../../src/asc/index', () => ({
6
+ hasCredentials: jest.fn(),
7
+ getAppByBundleId: jest.fn(),
8
+ getLatestVersion: jest.fn(),
9
+ getLatestBuild: jest.fn(),
10
+ getEditableVersion: jest.fn(),
11
+ getVersionWithLocalizations: jest.fn(),
12
+ isASCError: jest.fn().mockReturnValue(false),
13
+ }));
14
+
15
+ // Mock the plist parser
16
+ jest.mock('../../src/parsers/plist', () => ({
17
+ parsePlist: jest.fn(),
18
+ }));
19
+
20
+ const mocks = jest.requireMock('../../src/asc/index');
21
+ const mockParsePlist = jest.requireMock('../../src/parsers/plist').parsePlist as jest.Mock;
22
+
23
+ const mockProject: XcodeProject = {
24
+ path: '/test/TestApp.xcodeproj',
25
+ name: 'TestApp',
26
+ targets: [
27
+ {
28
+ name: 'TestApp',
29
+ type: 'application',
30
+ bundleIdentifier: 'com.test.app',
31
+ infoPlistPath: '/test/TestApp/Info.plist',
32
+ sourceFiles: [],
33
+ },
34
+ ],
35
+ configurations: ['Debug', 'Release'],
36
+ };
37
+
38
+ describe('ASCVersionAnalyzer', () => {
39
+ let analyzer: ASCVersionAnalyzer;
40
+
41
+ beforeEach(() => {
42
+ analyzer = new ASCVersionAnalyzer();
43
+ jest.clearAllMocks();
44
+ });
45
+
46
+ describe('analyze', () => {
47
+ it('should return info issue when credentials are not configured', async () => {
48
+ mocks.hasCredentials.mockReturnValue(false);
49
+
50
+ const result = await analyzer.analyze(mockProject, { basePath: '/test' });
51
+
52
+ expect(result.passed).toBe(true);
53
+ expect(result.issues).toHaveLength(1);
54
+ expect(result.issues[0]?.id).toBe('asc-credentials-not-configured');
55
+ expect(result.issues[0]?.severity).toBe('info');
56
+ });
57
+
58
+ it('should return warning when no bundle ID found', async () => {
59
+ mocks.hasCredentials.mockReturnValue(true);
60
+
61
+ const projectWithoutBundleId: XcodeProject = {
62
+ ...mockProject,
63
+ targets: [{ name: 'TestApp', type: 'application', sourceFiles: [] }],
64
+ };
65
+
66
+ const result = await analyzer.analyze(projectWithoutBundleId, { basePath: '/test' });
67
+
68
+ expect(result.passed).toBe(true);
69
+ expect(result.issues[0]?.id).toBe('asc-no-bundle-id');
70
+ });
71
+
72
+ it('should detect rejected version', async () => {
73
+ mocks.hasCredentials.mockReturnValue(true);
74
+ mockParsePlist.mockResolvedValue({
75
+ CFBundleShortVersionString: '1.0.0',
76
+ CFBundleVersion: '1',
77
+ });
78
+ mocks.getAppByBundleId.mockResolvedValue({ id: 'app-1', type: 'apps' });
79
+ mocks.getLatestVersion.mockResolvedValue({
80
+ id: 'ver-1',
81
+ type: 'appStoreVersions',
82
+ attributes: { versionString: '1.0.0', appStoreState: 'READY_FOR_SALE' },
83
+ });
84
+ mocks.getLatestBuild.mockResolvedValue(null);
85
+ mocks.getEditableVersion.mockResolvedValue({
86
+ id: 'ver-2',
87
+ type: 'appStoreVersions',
88
+ attributes: { versionString: '1.1.0', appStoreState: 'REJECTED' },
89
+ });
90
+ mocks.getVersionWithLocalizations.mockResolvedValue({
91
+ version: {
92
+ id: 'ver-2',
93
+ attributes: { versionString: '1.1.0', appStoreState: 'REJECTED' },
94
+ },
95
+ localizations: [
96
+ {
97
+ id: 'loc-1',
98
+ attributes: {
99
+ locale: 'en-US',
100
+ whatsNew: 'Bug fixes',
101
+ description: 'An app',
102
+ supportUrl: 'https://example.com',
103
+ },
104
+ },
105
+ ],
106
+ build: null,
107
+ });
108
+
109
+ const result = await analyzer.analyze(mockProject, { basePath: '/test' });
110
+
111
+ expect(result.issues.some((i) => i.id === 'asc-version-rejected')).toBe(true);
112
+ });
113
+ });
114
+
115
+ describe('compareVersions', () => {
116
+ it('should return error when credentials not configured', async () => {
117
+ mocks.hasCredentials.mockReturnValue(false);
118
+
119
+ const result = await analyzer.compareVersions('com.test.app');
120
+
121
+ expect(result.passed).toBe(false);
122
+ expect(result.issues[0]?.severity).toBe('error');
123
+ });
124
+
125
+ it('should detect lower local version', async () => {
126
+ mocks.hasCredentials.mockReturnValue(true);
127
+ mocks.getAppByBundleId.mockResolvedValue({ id: 'app-1', type: 'apps' });
128
+ mocks.getLatestVersion.mockResolvedValue({
129
+ id: 'ver-1',
130
+ type: 'appStoreVersions',
131
+ attributes: { versionString: '2.0.0', appStoreState: 'READY_FOR_SALE' },
132
+ });
133
+ mocks.getLatestBuild.mockResolvedValue(null);
134
+ mocks.getEditableVersion.mockResolvedValue(null);
135
+
136
+ const result = await analyzer.compareVersions('com.test.app', '1.0.0');
137
+
138
+ expect(result.issues.some((i) => i.id === 'asc-local-version-lower')).toBe(true);
139
+ });
140
+
141
+ it('should detect build number not incremented', async () => {
142
+ mocks.hasCredentials.mockReturnValue(true);
143
+ mocks.getAppByBundleId.mockResolvedValue({ id: 'app-1', type: 'apps' });
144
+ mocks.getLatestVersion.mockResolvedValue(null);
145
+ mocks.getLatestBuild.mockResolvedValue({
146
+ id: 'build-1',
147
+ type: 'builds',
148
+ attributes: { version: '42' },
149
+ });
150
+ mocks.getEditableVersion.mockResolvedValue(null);
151
+
152
+ const result = await analyzer.compareVersions('com.test.app', undefined, '42');
153
+
154
+ expect(result.issues.some((i) => i.id === 'asc-build-number-not-incremented')).toBe(true);
155
+ });
156
+
157
+ it('should detect missing whats new text', async () => {
158
+ mocks.hasCredentials.mockReturnValue(true);
159
+ mocks.getAppByBundleId.mockResolvedValue({ id: 'app-1', type: 'apps' });
160
+ mocks.getLatestVersion.mockResolvedValue(null);
161
+ mocks.getLatestBuild.mockResolvedValue(null);
162
+ mocks.getEditableVersion.mockResolvedValue({
163
+ id: 'ver-1',
164
+ type: 'appStoreVersions',
165
+ attributes: { versionString: '1.0.0', appStoreState: 'PREPARE_FOR_SUBMISSION' },
166
+ });
167
+ mocks.getVersionWithLocalizations.mockResolvedValue({
168
+ version: {
169
+ id: 'ver-1',
170
+ attributes: { versionString: '1.0.0', appStoreState: 'PREPARE_FOR_SUBMISSION' },
171
+ },
172
+ localizations: [
173
+ {
174
+ id: 'loc-1',
175
+ attributes: {
176
+ locale: 'en-US',
177
+ whatsNew: null,
178
+ description: 'An app',
179
+ supportUrl: 'https://example.com',
180
+ },
181
+ },
182
+ ],
183
+ build: { id: 'build-1', type: 'builds', attributes: { version: '1' } },
184
+ });
185
+
186
+ const result = await analyzer.compareVersions('com.test.app');
187
+
188
+ expect(result.issues.some((i) => i.id === 'asc-missing-whats-new')).toBe(true);
189
+ });
190
+
191
+ it('should detect missing description', async () => {
192
+ mocks.hasCredentials.mockReturnValue(true);
193
+ mocks.getAppByBundleId.mockResolvedValue({ id: 'app-1', type: 'apps' });
194
+ mocks.getLatestVersion.mockResolvedValue(null);
195
+ mocks.getLatestBuild.mockResolvedValue(null);
196
+ mocks.getEditableVersion.mockResolvedValue({
197
+ id: 'ver-1',
198
+ type: 'appStoreVersions',
199
+ attributes: { versionString: '1.0.0', appStoreState: 'PREPARE_FOR_SUBMISSION' },
200
+ });
201
+ mocks.getVersionWithLocalizations.mockResolvedValue({
202
+ version: {
203
+ id: 'ver-1',
204
+ attributes: { versionString: '1.0.0', appStoreState: 'PREPARE_FOR_SUBMISSION' },
205
+ },
206
+ localizations: [
207
+ {
208
+ id: 'loc-1',
209
+ attributes: {
210
+ locale: 'en-US',
211
+ whatsNew: 'Bug fixes',
212
+ description: null,
213
+ supportUrl: 'https://example.com',
214
+ },
215
+ },
216
+ ],
217
+ build: { id: 'build-1', type: 'builds', attributes: { version: '1' } },
218
+ });
219
+
220
+ const result = await analyzer.compareVersions('com.test.app');
221
+
222
+ expect(result.issues.some((i) => i.id === 'asc-missing-description')).toBe(true);
223
+ });
224
+
225
+ it('should detect no build attached', async () => {
226
+ mocks.hasCredentials.mockReturnValue(true);
227
+ mocks.getAppByBundleId.mockResolvedValue({ id: 'app-1', type: 'apps' });
228
+ mocks.getLatestVersion.mockResolvedValue(null);
229
+ mocks.getLatestBuild.mockResolvedValue(null);
230
+ mocks.getEditableVersion.mockResolvedValue({
231
+ id: 'ver-1',
232
+ type: 'appStoreVersions',
233
+ attributes: { versionString: '1.0.0', appStoreState: 'PREPARE_FOR_SUBMISSION' },
234
+ });
235
+ mocks.getVersionWithLocalizations.mockResolvedValue({
236
+ version: {
237
+ id: 'ver-1',
238
+ attributes: { versionString: '1.0.0', appStoreState: 'PREPARE_FOR_SUBMISSION' },
239
+ },
240
+ localizations: [
241
+ {
242
+ id: 'loc-1',
243
+ attributes: {
244
+ locale: 'en-US',
245
+ whatsNew: 'Bug fixes',
246
+ description: 'An app',
247
+ supportUrl: 'https://example.com',
248
+ },
249
+ },
250
+ ],
251
+ build: null,
252
+ });
253
+
254
+ const result = await analyzer.compareVersions('com.test.app');
255
+
256
+ expect(result.issues.some((i) => i.id === 'asc-no-build-attached')).toBe(true);
257
+ });
258
+ });
259
+ });