|
4 | 4 | * Version number. |
5 | 5 | */ |
6 | 6 |
|
7 | | -define( 'VIPGOCI_VERSION', '1.0.7' ); |
| 7 | +define( 'VIPGOCI_VERSION', '1.0.7' ); |
8 | 8 |
|
9 | 9 | /* |
10 | 10 | * Define minimum version requirements. |
11 | 11 | */ |
12 | | -define( 'VIPGOCI_GIT_VERSION_MINIMUM', '2.10' ); |
| 12 | +define( 'VIPGOCI_GIT_VERSION_MINIMUM', '2.10' ); |
13 | 13 |
|
14 | 14 | /* |
15 | 15 | * Client-ID for curl-requests, etc. |
16 | 16 | */ |
17 | 17 |
|
18 | | -define( 'VIPGOCI_CLIENT_ID', 'automattic-vip-go-ci' ); |
19 | | -define( 'VIPGOCI_SYNTAX_ERROR_STR', 'PHP Syntax Errors Found' ); |
20 | | -define( 'VIPGOCI_GITHUB_ERROR_STR', 'GitHub API communication error. ' . |
21 | | - 'Please contact a human.' ); |
| 18 | +define( 'VIPGOCI_CLIENT_ID', 'automattic-vip-go-ci' ); |
| 19 | +define( 'VIPGOCI_SYNTAX_ERROR_STR', 'PHP Syntax Errors Found' ); |
| 20 | +define( 'VIPGOCI_GITHUB_ERROR_STR', 'GitHub API communication error. ' . |
| 21 | + 'Please contact a human.' ); |
22 | 22 | /* |
23 | 23 | * Base URLs for GitHub |
24 | 24 | */ |
25 | | -define( 'VIPGOCI_GITHUB_WEB_BASE_URL', 'https://github.com' ); |
| 25 | +define( 'VIPGOCI_GITHUB_WEB_BASE_URL', 'https://github.com' ); |
26 | 26 |
|
27 | 27 | /* Define if not defined. Unit-tests can define this for testing. */ |
28 | 28 | if ( ! defined( 'VIPGOCI_GITHUB_BASE_URL' ) ) { |
29 | | - define( 'VIPGOCI_GITHUB_BASE_URL', 'https://api.github.com' ); |
| 29 | + define( 'VIPGOCI_GITHUB_BASE_URL', 'https://api.github.com' ); |
30 | 30 | } |
31 | 31 |
|
32 | 32 | /* |
33 | 33 | * Various messages. |
34 | 34 | */ |
35 | 35 |
|
36 | 36 | define( 'VIPGOCI_FILE_IS_APPROVED_MSG', 'File is approved in review database ' . |
37 | | - '(hashes-to-hashes).' ); |
| 37 | + '(hashes-to-hashes).' ); |
38 | 38 |
|
39 | 39 | define( 'VIPGOCI_REVIEW_COMMENTS_TOTAL_MAX', |
40 | | - 'Total number of active review comments per ' . |
41 | | - 'Pull-Request has been reached and some ' . |
42 | | - 'comments might not appear as a result. ' . |
43 | | - 'Please resolve some issues to see more' ); |
| 40 | + 'Total number of active review comments per ' . |
| 41 | + 'Pull-Request has been reached and some ' . |
| 42 | + 'comments might not appear as a result. ' . |
| 43 | + 'Please resolve some issues to see more' ); |
44 | 44 |
|
45 | 45 | define( 'VIPGOCI_PHPCS_INVALID_SNIFFS', |
46 | | - 'Invalid PHPCS sniff(s) specified in ' . |
47 | | - 'options or options file. Those have ' . |
48 | | - 'been ignored temporarily. Please ' . |
49 | | - 'update the options so that scanning ' . |
50 | | - 'can continue as expected. ' ); |
| 46 | + 'Invalid PHPCS sniff(s) specified in ' . |
| 47 | + 'options or options file. Those have ' . |
| 48 | + 'been ignored temporarily. Please ' . |
| 49 | + 'update the options so that scanning ' . |
| 50 | + 'can continue as expected. ' ); |
51 | 51 |
|
52 | 52 | define( 'VIPGOCI_PHPCS_INVALID_SNIFFS_CONT', |
53 | | - '<br />' . |
54 | | - PHP_EOL . PHP_EOL . |
55 | | - '* Option name: `%s`' . PHP_EOL . |
56 | | - '* Invalid sniff(s): `%s`' . PHP_EOL |
57 | | - ); |
| 53 | + '<br />' . |
| 54 | + PHP_EOL . PHP_EOL . |
| 55 | + '* Option name: `%s`' . PHP_EOL . |
| 56 | + '* Invalid sniff(s): `%s`' . PHP_EOL |
| 57 | +); |
58 | 58 |
|
59 | 59 | define( 'VIPGOCI_PHPCS_DUPLICATE_SNIFFS', |
60 | | - 'Sniff(s) has been found in duplicate in ' . |
61 | | - 'options or options file. Those have ' . |
62 | | - 'been ignored temporarily. Please ' . |
63 | | - 'update the options so that scanning ' . |
64 | | - 'can continue as expected. ' . |
65 | | - '<br /> '); |
| 60 | + 'Sniff(s) has been found in duplicate in ' . |
| 61 | + 'options or options file. Those have ' . |
| 62 | + 'been ignored temporarily. Please ' . |
| 63 | + 'update the options so that scanning ' . |
| 64 | + 'can continue as expected. ' . |
| 65 | + '<br /> ' ); |
66 | 66 |
|
67 | 67 | define( 'VIPGOCI_PHPCS_DUPLICATE_SNIFFS_CONT', |
68 | | - '<br />' . |
69 | | - PHP_EOL . PHP_EOL . |
70 | | - '* Options: `%s` and `%s`' . PHP_EOL . |
71 | | - '* Sniff(s) in duplicate: `%s`' . PHP_EOL . |
72 | | - '<br />' ); |
| 68 | + '<br />' . |
| 69 | + PHP_EOL . PHP_EOL . |
| 70 | + '* Options: `%s` and `%s`' . PHP_EOL . |
| 71 | + '* Sniff(s) in duplicate: `%s`' . PHP_EOL . |
| 72 | + '<br />' ); |
73 | 73 |
|
74 | 74 | /* |
75 | 75 | * Define exit-codes |
76 | 76 | */ |
77 | 77 |
|
78 | | -define( 'VIPGOCI_EXIT_NORMAL', 0 ); |
79 | | -define( 'VIPGOCI_EXIT_EXEC_TIME', 249 ); |
80 | | -define( 'VIPGOCI_EXIT_CODE_ISSUES', 250 ); |
81 | | -define( 'VIPGOCI_EXIT_SYSTEM_PROBLEM', 251 ); |
82 | | -define( 'VIPGOCI_EXIT_GITHUB_PROBLEM', 252 ); |
83 | | -define( 'VIPGOCI_EXIT_USAGE_ERROR', 253 ); |
| 78 | +define( 'VIPGOCI_EXIT_NORMAL', 0 ); |
| 79 | +define( 'VIPGOCI_EXIT_EXEC_TIME', 249 ); |
| 80 | +define( 'VIPGOCI_EXIT_CODE_ISSUES', 250 ); |
| 81 | +define( 'VIPGOCI_EXIT_SYSTEM_PROBLEM', 251 ); |
| 82 | +define( 'VIPGOCI_EXIT_GITHUB_PROBLEM', 252 ); |
| 83 | +define( 'VIPGOCI_EXIT_USAGE_ERROR', 253 ); |
84 | 84 |
|
85 | 85 |
|
86 | 86 | /* |
|
91 | 91 | * -- altering these is not recommended. |
92 | 92 | */ |
93 | 93 |
|
94 | | -define( 'VIPGOCI_STATS_PHPCS', 'phpcs' ); |
95 | | -define( 'VIPGOCI_STATS_LINT', 'lint' ); |
96 | | -define( 'VIPGOCI_STATS_HASHES_API', 'hashes-api' ); |
| 94 | +define( 'VIPGOCI_STATS_PHPCS', 'phpcs' ); |
| 95 | +define( 'VIPGOCI_STATS_LINT', 'lint' ); |
| 96 | +define( 'VIPGOCI_STATS_HASHES_API', 'hashes-api' ); |
97 | 97 |
|
98 | 98 | /* |
99 | 99 | * Define auto-approval types |
100 | 100 | */ |
101 | 101 |
|
102 | | -define( 'VIPGOCI_APPROVAL_AUTOAPPROVE', 'auto-approval' ); |
103 | | -define( 'VIPGOCI_APPROVAL_HASHES_API', 'hashes-api' ); |
| 102 | +define( 'VIPGOCI_APPROVAL_AUTOAPPROVE', 'auto-approval' ); |
| 103 | +define( 'VIPGOCI_APPROVAL_HASHES_API', 'hashes-api' ); |
104 | 104 |
|
105 | 105 |
|
106 | 106 | /* |
|
115 | 115 | * Defines for vipgoci_counter_report() |
116 | 116 | */ |
117 | 117 |
|
118 | | -define( 'VIPGOCI_COUNTERS_DUMP', 'dump' ); |
119 | | -define( 'VIPGOCI_COUNTERS_DO', 'do' ); |
| 118 | +define( 'VIPGOCI_COUNTERS_DUMP', 'dump' ); |
| 119 | +define( 'VIPGOCI_COUNTERS_DO', 'do' ); |
120 | 120 |
|
121 | 121 | /* |
122 | 122 | * Define for vipgoci_cache() |
123 | 123 | */ |
124 | 124 |
|
125 | | -define( 'VIPGOCI_CACHE_CLEAR', '--VIPGOCI-CACHE-CLEAR-0x321--' ); |
| 125 | +define( 'VIPGOCI_CACHE_CLEAR', '--VIPGOCI-CACHE-CLEAR-0x321--' ); |
126 | 126 |
|
127 | 127 | /* |
128 | 128 | * Defines for files. |
129 | 129 | */ |
130 | 130 |
|
131 | | -define( 'VIPGOCI_OPTIONS_FILE_NAME', '.vipgoci_options' ); |
| 131 | +define( 'VIPGOCI_OPTIONS_FILE_NAME', '.vipgoci_options' ); |
132 | 132 |
|
133 | 133 | /* |
134 | 134 | * Define for vipgoci_git_diffs_fetch() |
135 | 135 | */ |
136 | 136 |
|
137 | | -define( 'VIPGOCI_GIT_DIFF_CALC_CHANGES', array ('+' => 'additions', '-' => 'deletions') ); |
138 | | -define( 'VIPGOCI_GIT_DIFF_DATA_SOURCE_GIT_REPO', 'local-git-repo' ); |
139 | | -define( 'VIPGOCI_GIT_DIFF_DATA_SOURCE_GITHUB_API', 'github-api' ); |
140 | | - |
| 137 | +define( 'VIPGOCI_GIT_DIFF_CALC_CHANGES', array( '+' => 'additions', '-' => 'deletions' ) ); |
| 138 | +define( 'VIPGOCI_GIT_DIFF_DATA_SOURCE_GIT_REPO', 'local-git-repo' ); |
| 139 | +define( 'VIPGOCI_GIT_DIFF_DATA_SOURCE_GITHUB_API', 'github-api' ); |
141 | 140 |
|
142 | 141 |
|
143 | 142 | /** |
144 | | - * Define file number of lines limit |
| 143 | + * Defines skip large files constants |
| 144 | + * Should be called in the run constructor/injected |
145 | 145 | */ |
146 | | -define( 'VIPGOCI_SKIPPED_FILES', 'skipped-files' ); |
147 | | - |
148 | | -define( 'VIPGOCI_VALIDATION_MAXIMUM_LINES_LIMIT', 15000 ); |
149 | | -define( 'VIPGOCI_VALIDATION_MAXIMUM_LINES', 'max-lines' ); |
150 | | -define( |
151 | | - 'VIPGOCI_VALIDATION', |
152 | | - [ |
153 | | - VIPGOCI_VALIDATION_MAXIMUM_LINES |
| 146 | +function vipgoci_define_skip_large_files_dependencies( array $options ): void { |
| 147 | + define( 'VIPGOCI_SKIPPED_FILES', 'skipped-files' ); |
| 148 | + define( 'VIPGOCI_VALIDATION_MAXIMUM_LINES_LIMIT', $options['skip-large-files-limit'] ); |
| 149 | + define( 'VIPGOCI_VALIDATION_MAXIMUM_LINES', 'large-files-limit' ); |
| 150 | + define( |
| 151 | + 'VIPGOCI_VALIDATION', |
| 152 | + [ |
| 153 | + VIPGOCI_VALIDATION_MAXIMUM_LINES |
154 | 154 | => 'Maximum number of lines exceeded (' . VIPGOCI_VALIDATION_MAXIMUM_LINES_LIMIT . ')' |
155 | | - ] |
156 | | -); |
| 155 | + ] |
| 156 | + ); |
| 157 | +} |
0 commit comments