78% leanpress

Code Review | LeanPress

WordPress plugin LeanPress scored 78% from 54 tests.

About plugin

  • Plugin page: leanpress
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.4.2
  • WordPress version: 5.8.1
  • First release: Feb 26, 2016
  • Latest release: Feb 26, 2016
  • Number of updates: 7
  • Update frequency: N/A
  • Top authors: ibenic (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 889 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
Install script ran successfully

Server metrics [RAM: ▲0.07MB] [CPU: ▼138.71ms] Passed 4 tests

Analyzing server-side resources used by LeanPress
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.87 ▲0.1533.69 ▲13.19
Dashboard /wp-admin3.12 ▲0.0646.80 ▲6.43
Posts /wp-admin/edit.php3.20 ▲0.0945.90 ▲3.16
Add New Post /wp-admin/post-new.php5.48 ▲0.0587.87 ▼562.60
Media Library /wp-admin/upload.php3.06 ▲0.0632.32 ▼1.82
Book Import /wp-admin/admin.php?page=leanpress_books3.0530.59
Settings /wp-admin/admin.php?page=leanpress_settings3.0526.43
Coupons /wp-admin/admin.php?page=leanpress_coupons3.0631.72
LeanPub Books /wp-admin/edit.php?post_type=leanpress_books3.1031.57
Test /wp-admin/admin.php?page=leanpress_test3.0528.36

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 41 new files
Database: no new tables, 1 new option
New WordPress options
blog_name

Browser metrics Passed 4 tests

An overview of browser requirements for LeanPress
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,883 ▲28716.48 ▲0.8515.26 ▲6.7747.64 ▼0.51
Dashboard /wp-admin3,037 ▲1035.96 ▼0.05149.16 ▼6.43122.31 ▲14.31
Posts /wp-admin/edit.php2,806 ▲672.75 ▲0.0469.06 ▼1.1885.32 ▲4.10
Add New Post /wp-admin/post-new.php1,733 ▲11818.05 ▼3.39384.61 ▲99.06106.66 ▲3.59
Media Library /wp-admin/upload.php1,874 ▲675.11 ▲0.08156.07 ▼2.52116.78 ▲1.13
Book Import /wp-admin/admin.php?page=leanpress_books1,1542.3856.2868.44
Settings /wp-admin/admin.php?page=leanpress_settings1,1292.3958.2967.58
Coupons /wp-admin/admin.php?page=leanpress_coupons1,0742.3653.7261.25
LeanPub Books /wp-admin/edit.php?post_type=leanpress_books1,4732.6767.3877.54
Test /wp-admin/admin.php?page=leanpress_test1,1222.3658.0371.78

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • The uninstall procedure has failed, leaving 1 option in the database
    • blog_name

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
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/leanpress/public/partials/leanpress-public-display.php
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/leanpress/admin/partials/leanpress-admin-test.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/leanpress/admin/partials/leanpress-admin-coupons.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/leanpress/admin/partials/leanpress-admin-books.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/leanpress/admin/partials/leanpress-admin-display.php:17

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
2 plugin tags: custom post type, import

leanpress/leanpress.php Passed 13 tests

The entry point to "LeanPress" version 1.0.0 is a PHP file that has certain tags in its header comment area
86 characters long description:
Leanpub on WordPress. Import books, view them. List coupons and edit each one of them.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected1,118 lines of code in 23 files:
LanguageFilesBlank linesComment linesLines of code
PHP19442706984
JavaScript25955103
CSS29831

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity7.18
▷ Minimum class complexity1.00
▷ Maximum class complexity26.00
Average method complexity2.06
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods64
▷ Static methods34.69%
▷ Public methods5992.19%
▷ Protected methods00.00%
▷ Private methods57.81%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
10 PNG files occupy 1.67MB with 1.24MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-128x128.png21.08KB1.89KB▼ 91.03%
assets/screenshot-2.png430.65KB132.62KB▼ 69.20%
assets/screenshot-9.png162.90KB43.48KB▼ 73.31%
assets/screenshot-8.png212.77KB65.19KB▼ 69.36%
assets/screenshot-4.png213.02KB69.63KB▼ 67.31%