rootlocal/yii2-crud

View on GitHub

Showing 12 of 12 total issues

Function findModel has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findModel($id = null)
    {
        $model = $this->getModel();
        $objectClass = null;

Severity: Minor
Found in src/actions/ValidateAction.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

Method actions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function actions()
    {
        if (empty($this->_actions)) {
            $actions = [
                'index' => [
Severity: Minor
Found in src/controllers/ActiveController.php - About 1 hr to fix

    Function getModel has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getModel(): SearchModelInterface
        {
            if ($this->_model === null) {
    
                if (is_string($this->getSearchModel())) {
    Severity: Minor
    Found in src/actions/IndexAction.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

    Method findModel has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function findModel($id = null)
        {
            $model = $this->getModel();
            $objectClass = null;
    
    
    Severity: Minor
    Found in src/actions/ValidateAction.php - About 1 hr to fix

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

          public function run($id)
          {
              $model = $this->findModel($id);
      
              if (Yii::$app->request->isAjax) {
      Severity: Minor
      Found in src/actions/UpdateAction.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 run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function run($redirect = null)
          {
              if (Yii::$app->request->isAjax) {
                  Yii::$app->response->format = Response::FORMAT_JSON;
              }
      Severity: Minor
      Found in src/actions/CreateAction.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 setModel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function setModel($model): void
          {
              if (is_string($model)) {
                  $objectConfig['class'] = $model;
                  $objectConfig['scenario'] = $this->getScenario();
      Severity: Minor
      Found in src/actions/CreateAction.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

      Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run($redirect = null)
          {
              if (Yii::$app->request->isAjax) {
                  Yii::$app->response->format = Response::FORMAT_JSON;
              }
      Severity: Minor
      Found in src/actions/CreateAction.php - About 1 hr to fix

        Function findModel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function findModel($id)
            {
                $model = $this->getModel();
                $objectClass = null;
        
        
        Severity: Minor
        Found in src/actions/UpdateAction.php - About 55 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 findModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function findModel($id): ActiveRecord
            {
                $model = $this->getModel();
                $objectClass = null;
        
        
        Severity: Minor
        Found in src/actions/ViewAction.php - About 35 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 findModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function findModel($id)
            {
                $model = $this->getModel();
                $objectClass = null;
        
        
        Severity: Minor
        Found in src/actions/DeleteAction.php - About 35 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 verbs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function verbs()
            {
                $actions = $this->actions();
        
                if (empty($this->_verbs) && !empty($actions)) {
        Severity: Minor
        Found in src/controllers/ActiveController.php - About 35 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