22
33class PHPCS_Diff {
44
5- // SVN credentials used for checking out individual revisions.
6- private $ svn_username = '' ; // @todo: add your SVN username here
7- private $ svn_password = '' ; // @todo: add your SVN password here
8-
95 // PHPCS configuration.
106 private $ phpcs_command = 'phpcs ' ; // You might need to provde a path to phpcs.phar file.
117 private $ standards_location = '~/PHP_CodeSniffer/Standards ' ; // @todo: adjust the path to standards
@@ -16,8 +12,6 @@ class PHPCS_Diff {
1612
1713 public $ excluded_extensions = array ();
1814
19- public $ repo_url = 'https://plugins.svn.wordpress.org/ ' ;
20-
2115 public $ lines_mapping ;
2216
2317 private $ phpcs_standard = 'WordPress ' ;
@@ -162,18 +156,8 @@ private function run_phpcs_for_file_revision( $filename, $revision ) {
162156
163157 if ( false === $ result ) {
164158
165- $ command_string = sprintf ( 'svn cat %s --non-interactive --no-auth-cache --username %s --password %s -r %d | %s --runtime-set installed_paths %s --standard=%s --stdin-path=%s ' ,
166- escapeshellarg ( esc_url_raw ( $ this ->repo_url . $ filename ) ),
167- escapeshellarg ( $ this ->svn_username ),
168- escapeshellarg ( $ this ->svn_password ),
169- absint ( $ revision ),
170- escapeshellcmd ( $ this ->phpcs_command ),
171- escapeshellarg ( $ this ->standards_location ),
172- escapeshellarg ( $ this ->phpcs_standard ),
173- escapeshellarg ( $ filename )
174- );
175-
176- $ result = shell_exec ( $ command_string );
159+ $ result = $ this ->diff_parser ->run_phpcs_for_file_at_revision ( $ filename , $ revision , $ this ->phpcs_command , $ this ->standards_location , $ this ->phpcs_standard );
160+
177161 if ( true !== $ this ->nocache ) {
178162 wp_cache_set ( $ cache_key , $ result , $ cache_group , 6 *HOUR_IN_SECONDS );
179163 }
0 commit comments