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

Check Readme Third Parties must have Privacy Notes in the readme #832

Draft
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use WordPress\Plugin_Check\Checker\Checks\Abstract_File_Check;
use WordPress\Plugin_Check\Traits\Amend_Check_Result;
use WordPress\Plugin_Check\Traits\Find_Readme;
use WordPress\Plugin_Check\Traits\TLD_Names;
use WordPress\Plugin_Check\Traits\External_Utils;
use WordPress\Plugin_Check\Traits\License_Utils;
use WordPress\Plugin_Check\Traits\Stable_Check;
use WordPressdotorg\Plugin_Directory\Readme\Parser;
Expand All @@ -27,6 +29,8 @@ class Plugin_Readme_Check extends Abstract_File_Check {

use Amend_Check_Result;
use Find_Readme;
use TLD_Names;
use External_Utils;
use Stable_Check;
use License_Utils;

Expand Down Expand Up @@ -106,6 +110,9 @@ protected function check_files( Check_Result $result, array $files ) {

// Check the readme file for contributors.
$this->check_for_contributors( $result, $readme_file );

// Check for third parties privacy notes.
$this->check_for_privacy_notes( $result, $readme_file, $parser, $files );
}

/**
Expand Down Expand Up @@ -652,6 +659,27 @@ private function check_for_contributors( Check_Result $result, string $readme_fi
}
}

/**
* Checks the readme file for external privacy notes.
*
* @since 1.4.0
*
* @param Check_Result $result The Check Result to amend.
* @param string $readme_file Readme file.
*/
private function check_for_privacy_notes( Check_Result $result, string $readme_file, Parser $parser, array $files ) {
$existing_tld_names = $this->get_tld_names();
$domains = $this->load_domains_mentioned_in_readme( $readme_file, $existing_tld_names );
$files_ext = self::filter_files_by_extensions( $files, array( 'php', 'css', 'js' ) );

foreach( $files_ext as $file ) {
$result = $this->find_external_calls( $file );

}


}

/**
* Returns current major WordPress version.
*
Expand Down
Loading
Loading