yii-ui/yii2-rubaxa-sortable

View on GitHub

Showing 8 of 8 total issues

Method renderItems has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function renderItems()
    {
        $items = '';

        foreach ($this->items as $item) {
Severity: Minor
Found in Sortable.php - About 1 hr to fix

    Avoid excessively long variable names like $_availableClientEvents. Keep variable name length under 20.
    Open

        private $_availableClientEvents = [
            'choose',
            'start',
            'end',
            'add',
    Severity: Minor
    Found in Sortable.php by phpmd

    LongVariable

    Since: 0.2

    Detects when a field, formal or local variable is declared with a long name.

    Example

    class Something {
        protected $reallyLongIntName = -3; // VIOLATION - Field
        public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
            $otherReallyLongName = -5; // VIOLATION - Local
            for ($interestingIntIndex = 0; // VIOLATION - For
                 $interestingIntIndex < 10;
                 $interestingIntIndex++ ) {
            }
        }
    }

    Source https://phpmd.org/rules/naming.html#longvariable

    Method initIcons has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function initIcons()
        {
            if (empty($this->handleLabel) || empty($this->deleteLabel)) {
                $deleteIconTag = 'span';
                $deleteIconContent = '';
    Severity: Minor
    Found in Sortable.php - About 1 hr to fix

      Function renderItems has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          private function renderItems()
          {
              $items = '';
      
              foreach ($this->items as $item) {
      Severity: Minor
      Found in Sortable.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function initIcons has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function initIcons()
          {
              if (empty($this->handleLabel) || empty($this->deleteLabel)) {
                  $deleteIconTag = 'span';
                  $deleteIconContent = '';
      Severity: Minor
      Found in Sortable.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function registerClientEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function registerClientEvents($containerId)
          {
              if (!empty($this->clientEvents)) {
                  $jsEvents = '';
      
      
      Severity: Minor
      Found in Sortable.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function initClientOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function initClientOptions()
          {
              if (($this->addHandle || $this->itemHasEnabledOption('addHandle')) && empty($this->clientOptions['handle'])) {
                  $this->clientOptions['handle'] = '.rubaxa-sortable-handle';
              }
      Severity: Minor
      Found in Sortable.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function initSortableType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function initSortableType()
          {
              switch ($this->type) {
                  case self::TYPE_BS_LIST:
                      Html::addCssClass($this->containerOptions, 'list-group');
      Severity: Minor
      Found in Sortable.php - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Severity
      Category
      Status
      Source
      Language