yii-ui/yii2-rubaxa-sortable

View on GitHub

Showing 7 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

    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 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

      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

      Severity
      Category
      Status
      Source
      Language