writesdown/app-cms

View on GitHub

Showing 107 of 233 total issues

Function MediaBrowser has 297 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function MediaBrowser(browser, options) {
        this.document = $(document);
        this.browser = $(browser);
        this.upload = this.browser.find('.media-upload');
        this.dropzone = this.upload.find('.dropzone');
Severity: Major
Found in public/admin/js/media.browser.js - About 1 day to fix

    File MediaUploadHandler.php has 559 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * @link http://www.writesdown.com/
     * @copyright Copyright (c) 2015 WritesDown
     * @license http://www.writesdown.com/license/
    Severity: Major
    Found in common/components/MediaUploadHandler.php - About 1 day to fix

      File menu.js has 469 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
       * Dual-licensed under the BSD or MIT licenses
       */
      (function($, window, document, undefined)
      Severity: Minor
      Found in public/admin/js/menu.js - About 7 hrs to fix

        Function actionIndex has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

            public function actionIndex()
            {
                /* @var $postType PostType */
                /* @var $post Post */
                /* @var $taxonomies Taxonomy[] */
        Severity: Minor
        Found in modules/sitemap/frontend/controllers/DefaultController.php - About 4 hrs 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 dragMove has 117 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                dragMove: function(e)
                {
                    var list, parent, prev, next, depth,
                        opt   = this.options,
                        mouse = this.mouse;
        Severity: Major
        Found in public/admin/js/menu.js - About 4 hrs to fix

          MediaUploadHandler has 34 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class MediaUploadHandler
          {
              const PRINT_RESPONSE = true;
              const NOT_PRINT_RESPONSE = false;
          
          
          Severity: Minor
          Found in common/components/MediaUploadHandler.php - About 4 hrs to fix

            Function actionCreate has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                public function actionCreate()
                {
                    $errors = [];
                    $model = new Module(['scenario' => 'create']);
            
            
            Severity: Minor
            Found in backend/controllers/ModuleController.php - About 3 hrs 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 actionIndex has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function actionIndex()
                {
                    /* @var $postType PostType */
                    /* @var $post Post */
                    /* @var $taxonomies Taxonomy[] */
            Severity: Major
            Found in modules/sitemap/frontend/controllers/DefaultController.php - About 3 hrs to fix

              Function actionBulkAction has a Cognitive Complexity of 25 (exceeds 5 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 3 hrs 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

              File media.browser.js has 312 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              (function ($) {
                  'use strict';
              
                  function MediaBrowser(browser, options) {
                      this.document = $(document);
              Severity: Minor
              Found in public/admin/js/media.browser.js - About 3 hrs to fix

                Function actionCreate has a Cognitive Complexity of 24 (exceeds 5 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 3 hrs 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 actionCreateMenuItem has a Cognitive Complexity of 24 (exceeds 5 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 3 hrs 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 actionCreate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function actionCreate()
                    {
                        $errors = [];
                        $model = new Widget(['scenario' => 'upload']);
                
                
                Severity: Minor
                Found in backend/controllers/WidgetController.php - About 3 hrs 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 actionUpload has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function actionUpload()
                    {
                        $errors = [];
                        $model = new DynamicModel(['file']);
                        $model->addRule(['file'], 'required')
                Severity: Minor
                Found in backend/controllers/ThemeController.php - About 3 hrs 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 actionView has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function actionView($type, $slug, $page = 1)
                    {
                        /* @var $taxonomy Taxonomy */
                        /* @var $postType PostType */
                        /* @var $posts Post[] */
                Severity: Major
                Found in modules/sitemap/frontend/controllers/DefaultController.php - About 3 hrs to fix

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

                      public function actionCreate()
                      {
                          $errors = [];
                          $model = new Module(['scenario' => 'create']);
                  
                  
                  Severity: Major
                  Found in backend/controllers/ModuleController.php - About 2 hrs to fix

                    Function beforeSave has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function beforeSave($insert)
                        {
                            if (parent::beforeSave($insert)) {
                                if ($this->isNewRecord) {
                                    if (!Yii::$app->user->isGuest) {
                    Severity: Minor
                    Found in common/models/BaseComment.php - About 2 hrs 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 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function actionView($type, $slug, $page = 1)
                        {
                            /* @var $taxonomy Taxonomy */
                            /* @var $postType PostType */
                            /* @var $posts Post[] */
                    Severity: Minor
                    Found in modules/sitemap/frontend/controllers/DefaultController.php - About 2 hrs 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 renderToolbar has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function renderToolbar($event)
                        {
                            /* @var $view View */
                            /* @var $urlBack \yii\web\UrlManager */
                    
                    
                    Severity: Major
                    Found in modules/toolbar/frontend/Module.php - About 2 hrs to fix

                      Method up has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function up()
                          {
                              $tableOptions = null;
                              if ($this->db->driverName === 'mysql') {
                                  $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
                      Severity: Major
                      Found in console/migrations/m000000_000011_post.php - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language