Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small updates: Use new functions introduced in #273; update HTTP wait function; update URL in README.md; update tests #281

Merged
merged 19 commits into from
Jul 12, 2022
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
fb1a644
Using new function introduced in #273.
gudmdharalds Jun 24, 2022
42bb642
Wait only in case of GitHub API.
gudmdharalds Jun 24, 2022
7369a73
Adding VIPGOCI_HTTP_API_WAIT_APIS_ARRAY constant.
gudmdharalds Jun 24, 2022
fb965cc
Update vipgoci_http_api_wait() so to wait only when certain APIs are …
gudmdharalds Jun 24, 2022
f556431
Update test for vipgoci_http_api_wait()
gudmdharalds Jun 24, 2022
6de21d0
Update URL to use 'latest' instead of 'trunk'.
gudmdharalds Jun 24, 2022
5b8e6c2
Remove temporary file.
gudmdharalds Jul 8, 2022
dfa1641
Ensure to remove temporary file when test is complete.
gudmdharalds Jul 8, 2022
a1161e8
Update PHPCS setting due to changes to pull request needed for #282.
gudmdharalds Jul 8, 2022
9bed546
Merge branch 'add-wpscan-support' into updates-relating-to-pr273
gudmdharalds Jul 12, 2022
82dc9bd
Use vipgoci_github_files_affected_by_commit() function.
gudmdharalds Jul 12, 2022
2451ebb
Use vipgoci_github_files_affected_by_commit() function.
gudmdharalds Jul 12, 2022
5f84175
Use vipgoci_github_files_affected_by_commit() function.
gudmdharalds Jul 12, 2022
6ebf236
Use vipgoci_github_files_affected_by_commit() function.
gudmdharalds Jul 12, 2022
c09febe
Remove test as function is removed.
gudmdharalds Jul 12, 2022
1334298
Use VIPGOCI_ISSUE_TYPE_INFO, VIPGOCI_ISSUE_TYPE_WARNING and VIPGOCI_I…
gudmdharalds Jul 12, 2022
802d79a
Use VIPGOCI_ISSUE_TYPE_INFO, VIPGOCI_ISSUE_TYPE_WARNING and VIPGOCI_I…
gudmdharalds Jul 12, 2022
c761127
Rename VIPGOCI_SYNTAX_ERROR_STR to VIPGOCI_LINT_ERROR_STR
gudmdharalds Jul 12, 2022
9088745
Re-arranging order of defines.
gudmdharalds Jul 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use vipgoci_github_files_affected_by_commit() function.
  • Loading branch information
gudmdharalds committed Jul 12, 2022
commit 5f84175e9fa02d207710a25bd10b62fb0c7bfc10
80 changes: 29 additions & 51 deletions phpcs-scan.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,58 +532,28 @@ function vipgoci_phpcs_scan_commit(
)
);

$pr_item_files_changed = array();
$pr_item_files_changed['all'] = array();
$commit_skipped_files_empty = array();

foreach ( $prs_implicated as $pr_item ) {
/*
* Make sure that the PR is defined in the array
*/
if ( ! isset( $pr_item_files_changed[ $pr_item->number ] ) ) {
$pr_item_files_changed[ $pr_item->number ] = array();
}

/*
* Get list of all files changed
* in this pull request.
*/

$pr_item_files_tmp = vipgoci_git_diffs_fetch(
$options['local-git-repo'],
$options['repo-owner'],
$options['repo-name'],
$options['token'],
$pr_item->base->sha,
$commit_id,
false, // Exclude renamed files.
false, // Exclude removed files.
false, // Exclude permission changes.
array(
'file_extensions' =>
// If SVG-checks are enabled, include it in the file-extensions.
array_merge(
array( 'php', 'js', 'twig' ),
( $options['svg-checks'] ?
array( 'svg' ) :
array()
)
),
'skip_folders' => $options['phpcs-skip-folders'],
)
);

foreach ( $pr_item_files_tmp['files'] as $pr_item_file_name => $_tmp ) {
vipgoci_array_push_uniquely(
$pr_item_files_changed['all'],
$pr_item_file_name
);

vipgoci_array_push_uniquely(
$pr_item_files_changed[ $pr_item->number ],
$pr_item_file_name
);
}
}
$pr_item_files_changed = vipgoci_github_files_affected_by_commit(
$options,
$commit_id,
$commit_skipped_files_empty,
false, // Exclude renamed files.
false, // Exclude removed files.
false, // Exclude permission changes.
array(
// If SVG-checks are enabled, include it in the file-extensions.
'file_extensions' => array_merge(
array( 'php', 'js', 'twig' ),
( $options['svg-checks'] ?
array( 'svg' ) :
array()
)
),
'skip_folders' => $options['phpcs-skip-folders'],
),
true
);

$files_issues_arr = array();

Expand Down Expand Up @@ -612,6 +582,14 @@ function vipgoci_phpcs_scan_commit(
*/
$files_failed_phpcs_scanning = array();

/*
* Get first PR array item found. Needed
* for skipped files logic below.
*/
foreach ( $prs_implicated as $pr_item ) {
break;
}

foreach ( $pr_item_files_changed['all'] as $file_name ) {
if (
isset( $commit_skipped_files[ $pr_item->number ]['issues'][ VIPGOCI_VALIDATION_MAXIMUM_LINES ] )
Expand Down