writesdown/app-cms

View on GitHub

Showing 233 of 233 total issues

Identical blocks of code found in 3 locations. Consider refactoring.
Open

<?= $form->field($model, 'date', ['template' => "{label}\n{input}"])->widget(DateTimePicker::className(), [
    'template' => '{reset}{button}{input}',
    'pickButtonIcon' => 'glyphicon glyphicon-time',
    'options' => [
        'value' => date('M d, Y H:i:s', strtotime($model->date)),
Severity: Major
Found in backend/views/media/update.php and 2 other locations - About 1 hr to fix
backend/views/media-comment/update.php on lines 108..120
backend/views/post-comment/update.php on lines 114..126

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 102.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      /**
       * @link http://www.writesdown.com/
       * @copyright Copyright (c) 2015 WritesDown
       * @license http://www.writesdown.com/license
      Severity: Major
      Found in backend/assets/MediaModalAsset.php and 1 other location - About 1 hr to fix
      backend/assets/MenuAsset.php on lines 1..36

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      <?= $form->field($model, 'date', ['template' => "{label}\n{input}"])->widget(DateTimePicker::className(), [
          'template' => '{reset}{button}{input}',
          'pickButtonIcon' => 'glyphicon glyphicon-time',
          'options' => [
              'value' => date('M d, Y H:i:s', strtotime($model->date)),
      Severity: Major
      Found in backend/views/post-comment/update.php and 2 other locations - About 1 hr to fix
      backend/views/media-comment/update.php on lines 108..120
      backend/views/media/update.php on lines 89..101

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

      <?= $form->field($model, 'date', ['template' => "{label}\n{input}"])->widget(DateTimePicker::className(), [
          'template' => '{reset}{button}{input}',
          'pickButtonIcon' => 'glyphicon glyphicon-time',
          'options' => [
              'value' => date('M d, Y H:i:s', strtotime($model->date)),
      Severity: Major
      Found in backend/views/media-comment/update.php and 2 other locations - About 1 hr to fix
      backend/views/media/update.php on lines 89..101
      backend/views/post-comment/update.php on lines 114..126

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      /**
       * @link http://www.writesdown.com/
       * @copyright Copyright (c) 2015 WritesDown
       * @license http://www.writesdown.com/license/
      Severity: Major
      Found in backend/assets/MenuAsset.php and 1 other location - About 1 hr to fix
      backend/assets/MediaModalAsset.php on lines 1..36

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 102.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function reset has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              reset: function()
              {
                  this.mouse = {
                      offsetX   : 0,
                      offsetY   : 0,
      Severity: Minor
      Found in public/admin/js/menu.js - 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' => [
          Severity: Minor
          Found in backend/controllers/TaxonomyController.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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          <?= Html::dropDownList(
                              'Option[front_page][value]',
                              $model->front_page->value,
                              Post::findOne($model->front_page->value) ? ArrayHelper::map(Post::find()->select([
                                  'id',
              Severity: Minor
              Found in backend/views/setting/reading.php and 1 other location - About 55 mins to fix
              backend/views/setting/reading.php on lines 80..89

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 99.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          <?= Html::dropDownList(
                              'Option[posts_page][value]',
                              $model->posts_page->value,
                              Post::findOne($model->posts_page->value) ? ArrayHelper::map(Post::find()->select([
                                  'id',
              Severity: Minor
              Found in backend/views/setting/reading.php and 1 other location - About 55 mins to fix
              backend/views/setting/reading.php on lines 68..77

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 99.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                  public function beforeSave($insert)
                  {
                      if (parent::beforeSave($insert)) {
                          if ($this->isNewRecord) {
                              $this->created_at = new Expression('NOW()');
              Severity: Minor
              Found in common/models/User.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 actionIndex has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionIndex()
                  {
                      $config = [];
                      $active = [];
                      $available = [];
              Severity: Minor
              Found in backend/controllers/WidgetController.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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          this.dragEl.css({
                              'left' : e.pageX - mouse.offsetX,
                              'top'  : e.pageY - mouse.offsetY
                          });
              Severity: Minor
              Found in public/admin/js/menu.js and 1 other location - About 50 mins to fix
              public/admin/js/menu.js on lines 273..276

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          this.dragEl.css({
                              'left' : e.pageX - mouse.offsetX,
                              'top'  : e.pageY - mouse.offsetY
                          });
              Severity: Minor
              Found in public/admin/js/menu.js and 1 other location - About 50 mins to fix
              public/admin/js/menu.js on lines 308..311

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 52.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              <?php
              /**
               * @link http://www.writesdown.com/
               * @author Agiel K. Saputra <13nightevil@gmail.com>
               * @copyright Copyright (c) 2015 WritesDown
              Severity: Major
              Found in backend/views/taxonomy/create.php and 2 other locations - About 50 mins to fix
              backend/views/setting/create.php on lines 1..20
              backend/views/user/create.php on lines 1..20

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              <?php
              /**
               * @link http://www.writesdown.com/
               * @author Agiel K. Saputra <13nightevil@gmail.com>
               * @copyright Copyright (c) 2015 WritesDown
              Severity: Major
              Found in backend/views/setting/create.php and 2 other locations - About 50 mins to fix
              backend/views/taxonomy/create.php on lines 1..20
              backend/views/user/create.php on lines 1..20

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              <?php
              /**
               * @link http://www.writesdown.com/
               * @author Agiel K. Saputra <13nightevil@gmail.com>
               * @copyright Copyright (c) 2015 WritesDown
              Severity: Major
              Found in backend/views/user/create.php and 2 other locations - About 50 mins to fix
              backend/views/setting/create.php on lines 1..20
              backend/views/taxonomy/create.php on lines 1..20

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 97.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language