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

Add php codesniffer with wordpress standards #39

Merged
merged 23 commits into from
Jul 27, 2024
Merged

Conversation

carlHandy
Copy link
Contributor

Ensures the code is following recommended coding practices

Copy link

PHP CodeSniffer Summary

......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used

PHP CodeSniffer Results

Click to expand full report
......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 349 | WARNING | base64_decode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 405 | WARNING | Processing form data without nonce verification.
 405 | WARNING | Processing form data without nonce verification.
--------------------------------------------------------------------------------


FILE: /home/runner/work/mmg-wp-plugin/mmg-wp-plugin/tests/bootstrap.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 26 | WARNING | putenv() found. Changing configuration values at runtime is
    |         | strongly discouraged.
--------------------------------------------------------------------------------

Time: 1.42 secs; Memory: 18MB


Copy link

PHP CodeSniffer Summary

......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used

PHP CodeSniffer Results

Click to expand full report
......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 349 | WARNING | base64_decode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 405 | WARNING | Processing form data without nonce verification.
 405 | WARNING | Processing form data without nonce verification.
--------------------------------------------------------------------------------


FILE: /home/runner/work/mmg-wp-plugin/mmg-wp-plugin/tests/bootstrap.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 26 | WARNING | putenv() found. Changing configuration values at runtime is
    |         | strongly discouraged.
--------------------------------------------------------------------------------

Time: 1.41 secs; Memory: 18MB


Copy link

PHPUnit Test Summary

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				

PHPUnit Test Results

Click to expand full report
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				
				
				
				
				
				ORDER BY webhook_id DESC</code></p></div>PHPUnit 9.6.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.33
Configuration: phpunit.xml

Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' started
Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' ended
Test 'Test_MMG_Checkout_Payment::test_generate_checkout_url' started
{"success":false,"data":"Error generating checkout URL: Invalid security token"}

Copy link

PHP CodeSniffer Summary

......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used

PHP CodeSniffer Results

Click to expand full report
......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 349 | WARNING | base64_decode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 405 | WARNING | Processing form data without nonce verification.
 405 | WARNING | Processing form data without nonce verification.
--------------------------------------------------------------------------------


FILE: /home/runner/work/mmg-wp-plugin/mmg-wp-plugin/tests/bootstrap.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 26 | WARNING | putenv() found. Changing configuration values at runtime is
    |         | strongly discouraged.
--------------------------------------------------------------------------------

Time: 1.48 secs; Memory: 18MB


Copy link

PHPUnit Test Summary

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				

PHPUnit Test Results

Click to expand full report
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				
				
				
				
				
				ORDER BY webhook_id DESC</code></p></div>PHPUnit 9.6.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.33
Configuration: phpunit.xml

Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' started
Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' ended
Test 'Test_MMG_Checkout_Payment::test_generate_checkout_url' started
{"success":false,"data":"Error generating checkout URL: Invalid security token"}

Copy link

PHP CodeSniffer Summary

......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used

PHP CodeSniffer Results

Click to expand full report
......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 349 | WARNING | base64_decode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 405 | WARNING | Processing form data without nonce verification.
 405 | WARNING | Processing form data without nonce verification.
--------------------------------------------------------------------------------


FILE: /home/runner/work/mmg-wp-plugin/mmg-wp-plugin/tests/bootstrap.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 26 | WARNING | putenv() found. Changing configuration values at runtime is
    |         | strongly discouraged.
--------------------------------------------------------------------------------

Time: 1.46 secs; Memory: 18MB


Copy link

PHPUnit Test Summary

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				

PHPUnit Test Results

Click to expand full report
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				
				
				
				
				
				ORDER BY webhook_id DESC</code></p></div>PHPUnit 9.6.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.33
Configuration: phpunit.xml

Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' started
Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' ended
Test 'Test_MMG_Checkout_Payment::test_generate_checkout_url' started
{"success":false,"data":"Error generating checkout URL: Invalid security token"}

Copy link

PHP CodeSniffer Summary

......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used

PHP CodeSniffer Results

Click to expand full report
......WW.... 12 / 12 (100%)



FILE: ...r/work/mmg-wp-plugin/mmg-wp-plugin/includes/class-mmg-checkout-payment.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------------
 251 | WARNING | base64_encode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 349 | WARNING | base64_decode() can be used to obfuscate code which is
     |         | strongly discouraged. Please verify that the function is used
     |         | for benign reasons.
 405 | WARNING | Processing form data without nonce verification.
 405 | WARNING | Processing form data without nonce verification.
--------------------------------------------------------------------------------


FILE: /home/runner/work/mmg-wp-plugin/mmg-wp-plugin/tests/bootstrap.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 26 | WARNING | putenv() found. Changing configuration values at runtime is
    |         | strongly discouraged.
--------------------------------------------------------------------------------

Time: 1.42 secs; Memory: 18MB


Copy link

PHPUnit Test Summary

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				

PHPUnit Test Results

Click to expand full report
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
<div id="error"><p class="wpdberror"><strong>WordPress database error:</strong> [Table &#039;wordpress_test.wptests_wc_webhooks&#039; doesn&#039;t exist]<br /><code>SELECT webhook_id
				FROM wptests_wc_webhooks
				WHERE 1=1
				AND `status` = &#039;active&#039;
				
				
				
				
				
				ORDER BY webhook_id DESC</code></p></div>PHPUnit 9.6.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.33
Configuration: phpunit.xml

Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' started
Test 'Test_MMG_Checkout_Payment_Confirmation::test_handle_payment_confirmation' ended
Test 'Test_MMG_Checkout_Payment::test_generate_checkout_url' started
{"success":false,"data":"Error generating checkout URL: Invalid security token"}

@carlHandy carlHandy merged commit 560d99b into main Jul 27, 2024
4 checks passed
@carlHandy carlHandy deleted the add-code-sniffer branch July 27, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant