writesdown/app-cms

View on GitHub

Showing 107 of 233 total issues

Method up has 30 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_000014_post_comment.php - About 1 hr to fix

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

        public function actionIndex($id = null, $slug = null)
        {
            $render = 'index';
    
            if ($id) {
    Severity: Minor
    Found in frontend/controllers/PostController.php - About 1 hr to fix

      Method actionView has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function actionView($id = null, $user = null)
          {
              $render = '/user/view';
      
              if ($id) {
      Severity: Minor
      Found in frontend/controllers/UserController.php - About 1 hr to fix

        Method actionView has 30 lines of code (exceeds 25 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

          Method post has 30 lines of code (exceeds 25 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

            Method beforeAction has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function beforeAction($action)
                {
                    /*  @var $postType \common\models\PostType */
                    /*  @var $taxonomy \common\models\Taxonomy */
                    if (parent::beforeAction($action)) {
            Severity: Minor
            Found in modules/sitemap/backend/controllers/DefaultController.php - About 1 hr to fix

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

                  public function actionIndex()
                  {
                      $config = [];
                      $active = [];
                      $available = [];
              Severity: Minor
              Found in backend/controllers/WidgetController.php - About 1 hr to fix

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

                    public function run()
                    {
                        echo $this->beforeWidget;
                
                        if ($this->title) {
                Severity: Minor
                Found in widgets/meta/MetaWidget.php - About 1 hr to fix

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

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

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

                        public function search($params)
                        {
                            $query = UserModel::find();
                    
                            $query->andWhere(['<>', 'id', Yii::$app->user->id]);
                    Severity: Minor
                    Found in common/models/search/User.php - About 1 hr to fix

                      Method getMediaImage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function getMediaImage($media)
                          {
                              $result = '';
                              $model = $this->findModel(ArrayHelper::getValue($media, 'id'));
                              $meta = $model->getMeta('metadata');
                      Severity: Minor
                      Found in backend/controllers/MediaBrowserController.php - About 1 hr to fix

                        Method actionView has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function actionView($id = null, $slug = null)
                            {
                                $render = 'view';
                        
                                if ($id) {
                        Severity: Minor
                        Found in frontend/controllers/TermController.php - About 1 hr to fix

                          Method beforeSave has 28 lines of code (exceeds 25 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 1 hr to fix

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

                                protected function saveMenuItem($menuOrder, $menuParent = 0)
                                {
                                    foreach ($menuOrder as $key => $order) {
                                        $menuItem = Yii::$app->request->post('MenuItem')[$order['id']];
                                        if ($model = $this->findMenuItem($order['id'])) {
                            Severity: Minor
                            Found in backend/controllers/MenuController.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 actionUpdate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function actionUpdate($id)
                                {
                                    $model = $this->findModel($id);
                                    $this->getPermission($model);
                                    $postType = $model->postType;
                            Severity: Minor
                            Found in backend/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 actionView has 27 lines of code (exceeds 25 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

                              Function dragStart has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      dragStart: function(e)
                                      {
                                          var mouse    = this.mouse,
                                              target   = $(e.target),
                                              dragItem = target.closest(this.options.itemNodeName);
                              Severity: Minor
                              Found in public/admin/js/menu.js - About 1 hr to fix

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

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

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

                                      protected static function getTaxonomyMenus($postType)
                                      {
                                          $items = [];
                                          $items[] = [
                                              'icon' => 'fa fa-circle-o',
                                  Severity: Minor
                                  Found in common/models/PostType.php - About 1 hr to fix

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

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