68% lockr

Code Review | Lockr

WordPress plugin Lockr scored68%from 54 tests.

About plugin

  • Plugin page: lockr
  • Plugin version: 3.0.4
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.7-5.7
  • WordPress version: 6.3.1
  • First release: Jun 27, 2016
  • Latest release: Jun 2, 2021
  • Number of updates: 24
  • Update frequency: every 75.0 days
  • Top authors: tynor (58.33%)cteitzel (45.83%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /2,962 total downloads

Benchmarks

Plugin footprint 65% 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.05MB] [CPU: ▼5.42ms] Passed 4 tests

Analyzing server-side resources used by Lockr
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0343.54 ▲3.92
Dashboard /wp-admin3.35 ▲0.0548.85 ▼5.68
Posts /wp-admin/edit.php3.47 ▲0.1149.23 ▼2.49
Add New Post /wp-admin/post-new.php5.95 ▲0.0685.78 ▼15.80
Media Library /wp-admin/upload.php3.27 ▲0.0439.81 ▲2.31
Add Key /wp-admin/admin.php?page=lockr-add-key3.48435.25
All Keys /wp-admin/admin.php?page=lockr3.33276.41
Lockr Configuration /wp-admin/admin.php?page=lockr-site-config3.39287.66
Edit Key /wp-admin/admin.php?page=lockr-edit-key3.33271.31
Override Option /wp-admin/admin.php?page=lockr-override-option7.51262.54

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 286 new files
Database: 1 new table, 9 new options
New tables
wp_lockr_keys
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
lockr_dev_abstract_migrated
lockr_prod_abstract_migrated
widget_recent-comments
lockr_db_version
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Lockr
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,883 ▲12214.74 ▲0.361.75 ▼0.0342.81 ▲2.67
Dashboard /wp-admin2,293 ▲875.02 ▲0.15116.09 ▲8.1138.56 ▼9.85
Posts /wp-admin/edit.php2,172 ▲722.03 ▼0.0034.53 ▼1.2835.90 ▲3.28
Add New Post /wp-admin/post-new.php1,574 ▲4523.42 ▲5.53678.04 ▲78.8957.69 ▲3.38
Media Library /wp-admin/upload.php1,468 ▲654.22 ▲0.02108.01 ▲3.7749.65 ▲2.10
Add Key /wp-admin/admin.php?page=lockr-add-key8442.0724.5724.70
All Keys /wp-admin/admin.php?page=lockr8382.0224.2126.25
Lockr Configuration /wp-admin/admin.php?page=lockr-site-config1,0792.2225.2335.88
Edit Key /wp-admin/admin.php?page=lockr-edit-key8372.0424.3122.99
Override Option /wp-admin/admin.php?page=lockr-override-option8622.2023.3926.05

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie tables detected upon uninstall: 1 table
    • wp_lockr_keys
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_recent-posts
    • lockr_db_version
    • lockr_dev_abstract_migrated
    • lockr_prod_abstract_migrated
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • 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 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 9× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/lockr/lockr-admin-add.php
    • > /wp-content/plugins/lockr/lockr-admin-override.php
    • > /wp-content/plugins/lockr/lockr-admin.php
    • > /wp-content/plugins/lockr/lockr-admin-config.php
    • > /wp-content/plugins/lockr/lockr.php
    • > /wp-content/plugins/lockr/class-lockr-status.php
    • > /wp-content/plugins/lockr/lockr-secure-posts.php
    • > /wp-content/plugins/lockr/lockr-admin-edit.php
    • > /wp-content/plugins/lockr/lockr-overrides.php
  • 82× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\RequestInterface' not found in wp-content/plugins/lockr/vendor/psr/http-message/src/ServerRequestInterface.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/lockr/vendor/lockr/lockr/tests/KeyWrapper/LockrAes256CbcSha256RawKeyWrapperTest.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Promise\\RejectionException' not found in wp-content/plugins/lockr/vendor/guzzlehttp/promises/src/AggregateException.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/lockr/vendor/guzzlehttp/psr7/src/FnStream.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/lockr/vendor/guzzlehttp/psr7/src/Stream.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromisorInterface' not found in wp-content/plugins/lockr/vendor/guzzlehttp/promises/src/EachPromise.php:8
    • > PHP Fatal error
      Uncaught Error: Interface 'Lockr\\KeyWrapper\\KeyWrapperInterface' not found in wp-content/plugins/lockr/vendor/lockr/lockr/src/KeyWrapper/LockrAes256CbcSha256KeyWrapper.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Defuse\\Crypto\\Exception\\CryptoException' not found in wp-content/plugins/lockr/vendor/defuse/php-encryption/src/Exception/EnvironmentIsBrokenException.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Promise\\PromiseInterface' not found in wp-content/plugins/lockr/vendor/guzzlehttp/promises/src/Promise.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Defuse\\Crypto\\Exception\\CryptoException' not found in wp-content/plugins/lockr/vendor/defuse/php-encryption/src/Exception/IOException.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 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
Attributes that require attention:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === lockr === )
You can look at the official readme.txt

lockr/lockr.php 92% from 13 tests

The principal PHP file in "Lockr" v. 3.0.4 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 203 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin28,104 lines of code in 263 files:
LanguageFilesBlank linesComment linesLines of code
PHP1763,7228,24918,571
Markdown271,66604,824
YAML29129893,258
JSON15001,157
JavaScript27087
XML57678
Bourne Again Shell417064
make213433
CSS14019
Dockerfile18010
Bourne Shell1203

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
The following items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 112)
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity13.35
▷ Minimum class complexity1.00
▷ Maximum class complexity256.00
Average method complexity2.70
▷ Minimum method complexity1.00
▷ Maximum method complexity112.00
Code structure
Namespaces24
Interfaces22
Traits4
Classes126
▷ Abstract classes21.59%
▷ Concrete classes12498.41%
▷ Final classes1814.52%
Methods1,159
▷ Static methods19416.74%
▷ Public methods95882.66%
▷ Protected methods211.81%
▷ Private methods18015.53%
Functions228
▷ Named functions12755.70%
▷ Anonymous functions10144.30%
Constants131
▷ Global constants43.05%
▷ Class constants12796.95%
▷ Public constants127100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There were not PNG files found in your plugin