72% sunrise

Code Review | Sunrise

WordPress plugin Sunrise scored 72% from 54 tests.

About plugin

  • Plugin page: sunrise
  • Plugin version: 2.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.0
  • WordPress version: 5.8.1
  • First release: Mar 13, 2013
  • Latest release: Aug 8, 2013
  • Number of updates: 10
  • Update frequency: every 16.3 days
  • Top authors: gn_themes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 2,406 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
This plugin's installer ran successfully

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

An overview of server-side resources used by Sunrise
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.86 ▲0.0225.24 ▲1.96
Dashboard /wp-admin3.08 ▲0.0234.86 ▼3.71
Posts /wp-admin/edit.php3.14 ▲0.0331.59 ▼15.47
Add New Post /wp-admin/post-new.php5.45 ▲0.0168.79 ▼595.87
Media Library /wp-admin/upload.php3.03 ▲0.0222.92 ▼4.37
Plugin name /wp-admin/options-general.php?page=pluginname2.7614.67

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 34 new files
Database: no new tables, 1 new option
New WordPress options
pluginname_options

Browser metrics Passed 4 tests

Sunrise: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,671 ▲7015.97 ▲0.334.89 ▼2.7076.77 ▼0.07
Dashboard /wp-admin2,935 ▲426.04 ▼0.14113.34 ▼20.50167.78 ▼6.90
Posts /wp-admin/edit.php2,742 ▼13.24 ▲0.0062.28 ▼3.11134.62 ▼3.14
Add New Post /wp-admin/post-new.php3,746 ▲4819.20 ▲1.55429.23 ▲1.98158.74 ▼21.73
Media Library /wp-admin/upload.php1,757 ▲55.53 ▲0.06149.52 ▼3.35180.90 ▼4.21
Plugin name /wp-admin/options-general.php?page=pluginname1,6313.0061.85116.65

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
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 1 option
    • pluginname_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=pluginname
    • > Notice in wp-content/plugins/sunrise/classes/sunrise.class.php+206
    Undefined index: action
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=pluginname
    • > Notice in wp-content/plugins/sunrise/inc/views/notifications.php+33
    Undefined index: message
  • 10 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=pluginname
    • > Notice in wp-content/plugins/sunrise/inc/views/code.php+1
    Undefined index: triggable
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=pluginname
    • > Notice in wp-content/plugins/sunrise/inc/views/select.php+2
    Undefined index: trigger
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=pluginname
    • > Notice in wp-content/plugins/sunrise/inc/views/closetab.php+2
    Undefined index: actions

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
Please fix the following items
  • 13× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/sunrise/inc/views/textarea.php
    • > /wp-content/plugins/sunrise/inc/views/checkbox.php
    • > /wp-content/plugins/sunrise/inc/views/title.php
    • > /wp-content/plugins/sunrise/inc/views/radio.php
    • > /wp-content/plugins/sunrise/inc/views/select.php
    • > /wp-content/plugins/sunrise/inc/views/text.php
    • > /wp-content/plugins/sunrise/inc/views/html.php
    • > /wp-content/plugins/sunrise/inc/views/size.php
    • > /wp-content/plugins/sunrise/inc/views/hidden.php
    • > /wp-content/plugins/sunrise/inc/views/color.php
  • 203× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/sunrise/inc/views/size.php on line 4
    • > PHP Notice
      Undefined variable: option in wp-content/plugins/sunrise/inc/views/hidden.php on line 1
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/sunrise/inc/views/upload.php on line 3
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/sunrise/inc/views/select.php on line 10
    • > PHP Notice
      Undefined variable: option in wp-content/plugins/sunrise/inc/views/size.php on line 4
    • > PHP Notice
      Undefined variable: settings in wp-content/plugins/sunrise/inc/views/hidden.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/sunrise/inc/views/settings.php:1
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/sunrise/inc/views/hidden.php on line 1
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/sunrise/inc/views/upload.php on line 7
    • > PHP Notice
      Undefined variable: option in wp-content/plugins/sunrise/inc/views/textarea.php on line 5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that need to be fixed:
  • Screenshots: These screenshots require images: #1 (Standard control panel fields), #2 (Additional fields), #3 (Installed plugin), #4 (Example of options definition)
  • Tags: Please reduce the number of tags, currently 13 tag instead of maximum 10
The official readme.txt might help

sunrise/plugin-example.php 85% from 13 tests

"Sunrise" version 2.0.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("sunrise.php" instead of "plugin-example.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected1,323 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript2135223668
PHP2243152522
CSS13021103
PO File11016
Markdown15014

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity30.00
▷ Minimum class complexity30.00
▷ Maximum class complexity30.00
Average method complexity2.71
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods17
▷ Static methods00.00%
▷ Public methods17100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
6 PNG files occupy 0.10MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/code.png0.94KB0.10KB▼ 89.75%
screenshot-1.png28.85KB14.34KB▼ 50.28%
assets/images/success.png0.62KB0.62KB0.00%
screenshot-3.png6.03KB3.99KB▼ 33.78%
screenshot-2.png34.46KB17.64KB▼ 48.82%