79% pygment-it

Code Review | Pygment It

WordPress plugin Pygment It scored79%from 54 tests.

About plugin

  • Plugin page: pygment-it
  • Plugin version: 0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-3.4
  • WordPress version: 6.3.1
  • First release: Aug 8, 2014
  • Latest release: Sep 27, 2014
  • Number of updates: 9
  • Update frequency: every 5.6 days
  • Top authors: glauco_dsc (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,032 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▲0.98ms] Passed 4 tests

Analyzing server-side resources used by Pygment It
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0338.50 ▲0.34
Dashboard /wp-admin3.34 ▼0.0054.38 ▼1.66
Posts /wp-admin/edit.php3.39 ▲0.0347.17 ▲2.64
Add New Post /wp-admin/post-new.php5.92 ▲0.0493.62 ▲2.60
Media Library /wp-admin/upload.php3.26 ▲0.0336.54 ▲3.99
Pygment It /wp-admin/options-general.php?page=TpN6aJc5tLk40rVxIA5DCNg3434RQXL13.2328.86

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 25 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

Pygment It: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,795 ▲4914.27 ▼0.291.87 ▲0.3448.03 ▲8.85
Dashboard /wp-admin2,202 ▲215.62 ▼0.0783.79 ▼18.4240.27 ▲0.00
Posts /wp-admin/edit.php2,104 ▲71.99 ▲0.0640.29 ▲5.0336.26 ▲2.68
Add New Post /wp-admin/post-new.php1,529 ▲323.13 ▼0.55659.43 ▲12.1553.26 ▼12.14
Media Library /wp-admin/upload.php1,398 ▼24.22 ▲0.01102.00 ▲5.5547.73 ▲0.32
Pygment It /wp-admin/options-general.php?page=TpN6aJc5tLk40rVxIA5DCNg3434RQXL19262.0024.1125.21

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/pygment-it/webservice.php
    • > /wp-content/plugins/pygment-it/test.php
  • 23× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      Use of undefined constant PYGMENT_INS - assumed 'PYGMENT_INS' (this will throw an Error in a future version of PHP) in wp-content/plugins/pygment-it/config.php on line 46
    • > PHP Notice
      Undefined index: lang in wp-content/plugins/pygment-it/webservice.php on line 10
    • > PHP Warning
      Use of undefined constant PYGMENT_INS - assumed 'PYGMENT_INS' (this will throw an Error in a future version of PHP) in wp-content/plugins/pygment-it/config.php on line 46
    • > PHP Warning
      Use of undefined constant PYGMENT_INS - assumed 'PYGMENT_INS' (this will throw an Error in a future version of PHP) in wp-content/plugins/pygment-it/config.php on line 27
    • > PHP Notice
      Undefined index: code in wp-content/plugins/pygment-it/webservice.php on line 9
    • > PHP Warning
      Use of undefined constant PYGMENT_INS - assumed 'PYGMENT_INS' (this will throw an Error in a future version of PHP) in wp-content/plugins/pygment-it/config.php on line 27
    • > PHP Notice
      Undefined index: hl_lines in wp-content/plugins/pygment-it/webservice.php on line 14
    • > PHP Warning
      Use of undefined constant PYGMENT_INS - assumed 'PYGMENT_INS' (this will throw an Error in a future version of PHP) in wp-content/plugins/pygment-it/config.php on line 46
    • > PHP Notice
      Undefined index: linenostart in wp-content/plugins/pygment-it/webservice.php on line 12
    • > PHP Warning
      Use of undefined constant PYGMENT_INS - assumed 'PYGMENT_INS' (this will throw an Error in a future version of PHP) in wp-content/plugins/pygment-it/config.php on line 46

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
4 plugin tags: highlighting, highlighter, syntax, pygment

pygment-it/pygment-it.php Passed 13 tests

"Pygment It" version 0.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
80 characters long description:
Syntax highlighting with Pygments. Usage: [code language="ruby"]code here[/code]

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin1,190 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
CSS1300894
PHP75131231
Markdown227065

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.15
Average class complexity3.00
▷ Minimum class complexity3.00
▷ Maximum class complexity3.00
Average method complexity3.00
▷ Minimum method complexity3.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods1
▷ Static methods1100.00%
▷ Public methods1100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants32
▷ Global constants32100.00%
▷ Class constants00.00%
▷ Public constants00.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.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
css/screen.png18.55KB7.69KB▼ 58.54%