88% civil-publisher

Code Review | Civil Publisher Tools

WordPress plugin Civil Publisher Tools scored 88% from 54 tests.

About plugin

  • Plugin page: civil-publisher
  • Plugin version: 1.0.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.3
  • WordPress version: 5.8.1
  • First release: Dec 10, 2019
  • Latest release: Jan 14, 2020
  • Number of updates: 4
  • Update frequency: every 92.3 days
  • Top authors: joincivil (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 466 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.37MB] [CPU: ▼144.08ms] Passed 4 tests

This is a short check of server-side resources used by Civil Publisher Tools
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.12 ▲0.4036.94 ▲16.48
Dashboard /wp-admin3.45 ▲0.4044.82 ▼7.02
Posts /wp-admin/edit.php3.50 ▲0.3945.56 ▼1.79
Add New Post /wp-admin/post-new.php5.79 ▲0.3687.41 ▼566.54
Media Library /wp-admin/upload.php3.33 ▲0.3333.31 ▼0.96
Credibility Indicators /wp-admin/admin.php?page=civil-publisher-credibiity-indicators3.3032.27
Story Boosts /wp-admin/admin.php?page=civil-publisher-story-boosts-settings3.3029.71

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 94 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Civil Publisher Tools
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,776 ▲17016.24 ▲0.259.43 ▲0.8046.18 ▼3.52
Dashboard /wp-admin3,046 ▲1125.86 ▼0.23143.31 ▼3.25108.12 ▼7.77
Posts /wp-admin/edit.php2,816 ▲772.71 ▲0.0167.72 ▼0.5490.95 ▲0.61
Add New Post /wp-admin/post-new.php1,828 ▲32816.67 ▼1.97339.39 ▼34.75118.24 ▲6.22
Media Library /wp-admin/upload.php1,884 ▲745.01 ▼0.00151.78 ▲3.45115.43 ▼5.22
Credibility Indicators /wp-admin/admin.php?page=civil-publisher-credibiity-indicators1,1872.2155.4283.44
Story Boosts /wp-admin/admin.php?page=civil-publisher-story-boosts-settings1,1812.0855.9895.79

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/civil-publisher/tests/bootstrap.php
    • > /wp-content/plugins/civil-publisher/content-viewer.php
  • 14× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Civil_Publisher\\is_manager_enabled() in wp-content/plugins/civil-publisher/custom-meta.php:56
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Civil_Publisher\\add_action() in wp-content/plugins/civil-publisher/story-boosts.php:23
    • > PHP Fatal error
      Trait 'Civil_Publisher\\Singleton' not found in wp-content/plugins/civil-publisher/classes/class-rest-api.php on line 13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/civil-publisher/story-boosts-settings.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Civil_Publisher\\esc_html_e() in wp-content/plugins/civil-publisher/newsroom-manager.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CivilTestCase' not found in wp-content/plugins/civil-publisher/tests/test-rest-api.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Civil_Publisher\\get_option() in wp-content/plugins/civil-publisher/utils.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/civil-publisher/tests/class-base.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/civil-publisher/credibililty-indicators.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Civil_Publisher\\is_manager_enabled() in wp-content/plugins/civil-publisher/admin.php:28

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 14 tag instead of maximum 10
The official readme.txt might help

civil-publisher/civil-publisher.php 92% from 13 tests

The main file in "Civil Publisher Tools" v. 1.0.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Description: Keep the plugin description shorter than 140 characters (currently 318 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected6,616 lines of code in 69 files:
LanguageFilesBlank linesComment linesLines of code
TypeScript42393374,153
PHP193937042,142
JSON310100
XML2264195
JavaScript14467
Markdown134053
SVG1106

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity16.88
▷ Minimum class complexity2.00
▷ Maximum class complexity41.00
Average method complexity3.95
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces2
Interfaces0
Traits1
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes114.29%
Methods43
▷ Static methods818.60%
▷ Public methods3888.37%
▷ Protected methods00.00%
▷ Private methods511.63%
Functions62
▷ Named functions6096.77%
▷ Anonymous functions23.23%
Constants36
▷ Global constants3391.67%
▷ Class constants38.33%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
22 PNG files occupy 0.25MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/ico-error-red@2x.png0.79KB0.80KB0.00%
images/img-grant-submitted@2x.png4.20KB2.61KB▼ 37.91%
images/img-firefox-logo@2x.png3.49KB2.16KB▼ 38.24%
images/img-metamask-modalconfirm@2x.png28.94KB15.19KB▼ 47.50%
images/img-metamask-small-front@2x.png1.75KB1.75KB0.06%