kai-jacobsen/kontentblocks

View on GitHub

Showing 4,293 of 4,293 total issues

The class Field has an overall complexity of 80 which is very high. The configured complexity threshold is 50.
Open

abstract class Field implements ExportableFieldInterface
{

    /**
     * Unique id generated on run time
Severity: Minor
Found in core/Fields/Field.php by phpmd

The class ImageObjectDeprecated has 11 public methods. Consider refactoring ImageObjectDeprecated to keep number of public methods under 10.
Open

class ImageObjectDeprecated
{

    public $attachment;

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Field has 15 public methods. Consider refactoring Field to keep number of public methods under 10.
Open

abstract class Field implements ExportableFieldInterface
{

    /**
     * Unique id generated on run time
Severity: Minor
Found in core/Fields/Field.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class StandardFieldSection has 11 public methods. Consider refactoring StandardFieldSection to keep number of public methods under 10.
Open

class StandardFieldSection implements ExportableFieldInterface
{

    /**
     * Preset defaults
Severity: Minor
Found in core/Fields/StandardFieldSection.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class StandardFieldSection has an overall complexity of 83 which is very high. The configured complexity threshold is 50.
Open

class StandardFieldSection implements ExportableFieldInterface
{

    /**
     * Preset defaults
Severity: Minor
Found in core/Fields/StandardFieldSection.php by phpmd

The class ImageResize has an overall complexity of 55 which is very high. The configured complexity threshold is 50.
Open

        class ImageResize
        {
            /**
             * The singleton instance
             */
Severity: Minor
Found in core/Utils/ImageResize.php by phpmd

The class StandardFieldController has 14 public methods. Consider refactoring StandardFieldController to keep number of public methods under 10.
Open

class StandardFieldController
{

    /**
     * Collection of added Sections / Fields ...

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class JSONTransport has 13 public methods. Consider refactoring JSONTransport to keep number of public methods under 10.
Open

class JSONTransport
{

    protected $data = array();
    protected $publicData = array();
Severity: Minor
Found in core/Utils/JSONTransport.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Utilities has an overall complexity of 104 which is very high. The configured complexity threshold is 50.
Open

class Utilities
{

    protected static $postEnvironments = array();
    protected static $termEnvironments = array();
Severity: Minor
Found in core/Utils/Utilities.php by phpmd

The class Module has an overall complexity of 65 which is very high. The configured complexity threshold is 50.
Open

abstract class Module implements EntityInterface, FieldEntityInterface
{

    /**
     * Module Properties Object
Severity: Minor
Found in core/Modules/Module.php by phpmd

The class Enqueues has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
Open

class Enqueues
{

    protected static $styles;
    protected static $adminScripts = array();
Severity: Minor
Found in core/Hooks/Enqueues.php by phpmd

The class PostPanel has 12 public methods. Consider refactoring PostPanel to keep number of public methods under 10.
Open

abstract class PostPanel extends AbstractPanel implements FormInterface
{

    /**
     * @var int
Severity: Minor
Found in core/Panels/PostPanel.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Utilities has 15 public methods. Consider refactoring Utilities to keep number of public methods under 10.
Open

class Utilities
{

    protected static $postEnvironments = array();
    protected static $termEnvironments = array();
Severity: Minor
Found in core/Utils/Utilities.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class Module has 13 public methods. Consider refactoring Module to keep number of public methods under 10.
Open

abstract class Module implements EntityInterface, FieldEntityInterface
{

    /**
     * Module Properties Object
Severity: Minor
Found in core/Modules/Module.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class OptionPanel has 12 public methods. Consider refactoring OptionPanel to keep number of public methods under 10.
Open

abstract class OptionPanel extends AbstractPanel
{

    /**
     * @var SerOptionsDataProvider
Severity: Minor
Found in core/Panels/OptionPanel.php by phpmd

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  prepareViews: function (views) {
    return _.map(views, function (view) {
      view.selected = (view.filename === this.moduleModel.get('viewfile')) ? 'selected="selected"' : '';
      view.isActive = (view.filename === this.moduleModel.get('viewfile'));
      return view;
Severity: Major
Found in js/src/backend/Views/TemplateEditor/CodemirrorOverlay.js and 1 other location - About 3 hrs to fix
js/src/shared/ModuleStatusBar/status/TemplateStatus.js on lines 34..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  prepareViews: function (views) {
    return _.map(views, function (view) {
      view.selected = (view.filename === this.model.get('viewfile')) ? 'selected="selected"' : '';
      view.isActive = (view.filename === this.model.get('viewfile'));
      return view;
Severity: Major
Found in js/src/shared/ModuleStatusBar/status/TemplateStatus.js and 1 other location - About 3 hrs to fix
js/src/backend/Views/TemplateEditor/CodemirrorOverlay.js on lines 84..90

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 101.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File kontentblocks.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
  Plugin Name: Kontentblocks
  Plugin URI: https://github.com/kai-jacobsen/kontentblocks
  Description: Content modularization framework
Severity: Minor
Found in kontentblocks.php - About 3 hrs to fix

    Method registerScripts has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function registerScripts()
        {
            $folder = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? 'dev' : 'dist';
            $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
            $version = Kontentblocks::VERSION;
    Severity: Major
    Found in core/Hooks/Enqueues.php - About 3 hrs to fix

      File UI.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       *
       * These is a collection of helper functions to handle
       * the user interface / user interaction such as
       * - Sorting
      Severity: Minor
      Found in js/src/common/UI.js - About 3 hrs to fix
        Severity
        Category
        Status
        Source
        Language