writesdown/app-cms

View on GitHub

Showing 107 of 233 total issues

Method search has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function search($params)
    {
        $query = MediaModel::find();
        $query->innerJoinWith([
            'mediaAuthor' => function ($query) {
Severity: Minor
Found in common/models/search/Media.php - About 1 hr to fix

    Method actionBulkAction has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function actionBulkAction()
        {
            if (Yii::$app->request->post('action') === Post::STATUS_PUBLISH) {
                foreach (Yii::$app->request->post('ids', []) as $id) {
                    $model = $this->findModel($id);
    Severity: Minor
    Found in backend/controllers/PostController.php - About 1 hr to fix

      Method search has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function search($params, $type, $user = null)
          {
              $query = PostModel::find();
              $query->innerJoinWith(['postAuthor'])->from(['post' => static::tableName()]);
              $query->andWhere(['type' => $type]);
      Severity: Minor
      Found in common/models/search/Post.php - About 1 hr to fix

        Function slugify has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.fn.slugify = function (source, options) {
                var $target = this;
                var $source = $(source);
                var targetIsInput = $target.is('input') || $target.is('textarea');
        
        
        Severity: Minor
        Found in public/admin/js/site.js - About 1 hr to fix

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

              public function actionAjaxChangeHierarchical()
              {
                  if (Yii::$app->request->post('action') === 'addItem') {
                      $model = new TermRelationship();
                      $model->load(Yii::$app->request->post());
          Severity: Minor
          Found in backend/controllers/TermRelationshipController.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 search has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function search($params, $posttype, $post = null)
              {
                  $query = PostCommentModel::find();
          
                  $query->innerJoinWith([
          Severity: Minor
          Found in common/models/search/PostComment.php - About 1 hr to fix

            Method search has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function search($params, $mediaId = null)
                {
                    $query = MediaCommentModel::find();
                    $query->innerJoinWith([
                        'commentMedia' => function ($query) {
            Severity: Minor
            Found in common/models/search/MediaComment.php - About 1 hr to fix

              Method actionIndex has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function actionIndex()
                  {
                      /* @var $post \common\models\Post */
              
                      $query = Post::find()
              Severity: Minor
              Found in frontend/controllers/SiteController.php - About 1 hr to fix

                Method actionCreateMenuItem has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function actionCreateMenuItem($id)
                    {
                        $items = '';
                
                        if (Yii::$app->request->post('type') === 'link') {
                Severity: Minor
                Found in backend/controllers/MenuController.php - About 1 hr to fix

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

                      public function behaviors()
                      {
                          return [
                              'access' => [
                                  'class' => AccessControl::className(),
                  Severity: Minor
                  Found in backend/controllers/SiteController.php - About 1 hr to fix

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

                        public function actionCreate($type)
                        {
                            $model = new Post();
                            $postType = $this->findPostType($type);
                            $model->comment_status = Option::get('default_comment_status');
                    Severity: Minor
                    Found in backend/controllers/PostController.php - About 1 hr to fix

                      Function actionAjaxCreateHierarchical has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionAjaxCreateHierarchical()
                          {
                              $item = '';
                              $term = new Term();
                              $termRelationship = new TermRelationship();
                      Severity: Minor
                      Found in backend/controllers/TermController.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 actionView has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionView($id = null, $slug = null)
                          {
                              $render = 'view';
                      
                              $comment = new Comment();
                      Severity: Minor
                      Found in frontend/controllers/MediaController.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 actionBulkAction has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionBulkAction()
                          {
                              if (Yii::$app->request->post('action') === 'active') {
                                  foreach (Yii::$app->request->post('ids', []) as $id) {
                                      $this->findModel($id)->updateAttributes(['status' => Module::STATUS_ACTIVE]);
                      Severity: Minor
                      Found in backend/controllers/ModuleController.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 actionIndex has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionIndex()
                          {
                              /* @var $post \common\models\Post */
                      
                              $query = Post::find()
                      Severity: Minor
                      Found in frontend/controllers/SiteController.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 actionView has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionView($id = null, $slug = null)
                          {
                              $render = 'view';
                              $comment = new Comment();
                      
                      
                      Severity: Minor
                      Found in frontend/controllers/PostController.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 up has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function up()
                          {
                              $tableOptions = null;
                      
                              if ($this->db->driverName === 'mysql') {
                      Severity: Minor
                      Found in console/migrations/m000000_000002_user.php - About 1 hr to fix

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

                            public function post($printResponse = self::PRINT_RESPONSE)
                            {
                                if (Yii::$app->request->get('delete') && $id = Yii::$app->request->get('id')) {
                                    return $this->delete($id, $printResponse);
                                }
                        Severity: Minor
                        Found in common/components/MediaUploadHandler.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 behaviors has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function behaviors()
                            {
                                return [
                                    'access' => [
                                        'class' => AccessControl::className(),
                        Severity: Minor
                        Found in backend/controllers/MediaController.php - About 1 hr to fix

                          Method actionBulkAction has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function actionBulkAction()
                              {
                                  if (Yii::$app->request->post('action') === 'active') {
                                      foreach (Yii::$app->request->post('ids', []) as $id) {
                                          $model = $this->findModel($id);
                          Severity: Minor
                          Found in backend/controllers/UserController.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language