79% preserve-code-formatting

Code Review | Preserve Code Formatting

WordPress plugin Preserve Code Formatting scored 79% from 54 tests.

About plugin

  • Plugin page: preserve-code-for...
  • Plugin version: 4.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.7
  • WordPress version: 6.3.1
  • First release: Apr 14, 2005
  • Latest release: Apr 14, 2021
  • Number of updates: 26
  • Update frequency: every 224.8 days
  • Top authors: coffee2code (100%)matt (7.69%)

Code review

54 tests

User reviews

3 reviews

Install metrics

800+ active / 45,594 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.21MB] [CPU: ▼0.51ms] Passed 4 tests

An overview of server-side resources used by Preserve Code Formatting
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2137.43 ▼3.72
Dashboard /wp-admin3.52 ▲0.2146.88 ▼1.61
Posts /wp-admin/edit.php3.63 ▲0.2747.65 ▲2.97
Add New Post /wp-admin/post-new.php6.10 ▲0.2195.72 ▲11.29
Media Library /wp-admin/upload.php3.44 ▲0.2137.10 ▲0.31
Code Formatting /wp-admin/options-general.php?page=preserve-code-formatting/preserve-code-formatting.php3.4333.50

Server storage [IO: ▲0.12MB] [DB: ▲0.00MB] Passed 3 tests

Filesystem and database footprint
No storage issues were detected
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

Preserve Code Formatting: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6913.19 ▼1.194.63 ▲2.4841.34 ▼5.67
Dashboard /wp-admin2,207 ▲195.88 ▲0.02109.64 ▼7.2840.72 ▼2.33
Posts /wp-admin/edit.php2,093 ▲41.99 ▲0.0239.38 ▲5.5334.21 ▼2.76
Add New Post /wp-admin/post-new.php1,537 ▲423.47 ▲0.03577.23 ▼89.8252.69 ▼10.70
Media Library /wp-admin/upload.php1,395 ▲104.27 ▲0.1092.43 ▼7.3641.53 ▼4.44
Code Formatting /wp-admin/options-general.php?page=preserve-code-formatting/preserve-code-formatting.php9321.6831.2444.71

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/preserve-code-formatting/tests/bootstrap.php
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      require_once(): Failed opening required '/tmp/wordpress-tests-lib/tests/phpunit/includes/functions.php' (include_path='.:/usr/share/php') in wp-content/plugins/preserve-code-formatting/tests/bootstrap.php on line 17
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/tests/phpunit/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/preserve-code-formatting/tests/bootstrap.php on line 17

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
8 plugin tags: coffee2code, code, escape, formatting, writing...

preserve-code-formatting/preserve-code-formatting.php Passed 13 tests

The entry point to "Preserve Code Formatting" version 4.0.1 is a PHP file that has certain tags in its header comment area
134 characters long description:
Preserve formatting of code for display by preventing its modification by WordPress and other plugins while also retaining whitespace.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected1,517 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP62825841,173
Markdown3580309
Bourne Shell16221
XML10014

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity44.50
▷ Minimum class complexity3.00
▷ Maximum class complexity140.00
Average method complexity2.71
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes125.00%
▷ Concrete classes375.00%
▷ Final classes133.33%
Methods104
▷ Static methods109.62%
▷ Public methods9086.54%
▷ Protected methods1211.54%
▷ Private methods21.92%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
c2c_minilogo.png3.49KB1.91KB▼ 45.43%