hauntd/help-center

View on GitHub

Showing 20 of 276 total issues

Function init has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init: function() {
        this.treeElement = $('#category-list');
        if (!this.treeElement.length) {
            return false;
        }
Severity: Major
Found in modules/management/assets/static/js/management-categories.js - About 4 hrs to fix

    Function display has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        display: function() {
            var options = {
                dragAndDrop: true,
                selectable: true,
                autoOpen: true,
    Severity: Major
    Found in modules/management/assets/static/js/management-categories.js - About 2 hrs to fix

      Function performModelSave has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function performModelSave(ActiveRecord $model, array $params)
          {
              $ajax = Yii::$app->request->isAjax;
              if ($model->save()) {
                  if ($ajax) {
      Severity: Minor
      Found in modules/management/controllers/ManagementController.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 actionIndex has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function actionIndex()
          {
              if (!$this->confirm('Remove all data and insert demo data?')) {
                  return false;
              }
      Severity: Minor
      Found in commands/DataController.php - About 1 hr to fix

        Method safeUp has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function safeUp()
            {
                $this->createTable('{{%user}}', [
                    'id' => $this->primaryKey(),
                    'username' => $this->string()->notNull()->unique(),
        Severity: Minor
        Found in migrations/m160225_083657_init.php - About 1 hr to fix

          Function exports has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (grunt) {
              grunt.initConfig({
                  less: {
                      prod: {
                          options: {
          Severity: Minor
          Found in Gruntfile.js - About 1 hr to fix

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

                protected function matchRole($user)
                {
                    if (empty($this->roles)) {
                        return true;
                    }
            Severity: Minor
            Found in components/AccessRule.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 renderItems has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                public function renderItems()
                {
                    $items = [];
                    foreach ($this->items as $i => $item) {
                        if ($item instanceof NavItemInterface) {
            Severity: Minor
            Found in widgets/navigation/Nav.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 renderCategories has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                private function renderCategories($categories, $parentId = null, $level = 0)
                {
                    $html = '';
            
                    foreach ($categories as $category) {
            Severity: Minor
            Found in widgets/CategoriesWidget.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 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function run()
                {
                    if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
                        // action has been invoked not from error handler, but by direct route, so we display '404 Not Found'
                        $exception = new HttpException(404, Yii::t('yii', 'Page not found.'));
            Severity: Minor
            Found in actions/ErrorAction.php - About 1 hr to fix

              Function onCreateLi has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          onCreateLi: function(node, li) {
                              if (node.isEmpty) {
                                  li.addClass('jqtree-empty');
                                  return;
                              }
              Severity: Minor
              Found in modules/management/assets/static/js/management-categories.js - About 1 hr to fix

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

                    public function performModelSave(ActiveRecord $model, array $params)
                    {
                        $ajax = Yii::$app->request->isAjax;
                        if ($model->save()) {
                            if ($ajax) {
                Severity: Minor
                Found in modules/management/controllers/ManagementController.php - About 1 hr to fix

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

                      public function run()
                      {
                          $classes = ['posts-widget'];
                          if ($this->renderCategories) {
                              $classes[] = 'with-categories';
                  Severity: Minor
                  Found in widgets/PostsWidget.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()
                      {
                          if (($exception = Yii::$app->getErrorHandler()->exception) === null) {
                              // action has been invoked not from error handler, but by direct route, so we display '404 Not Found'
                              $exception = new HttpException(404, Yii::t('yii', 'Page not found.'));
                  Severity: Minor
                  Found in actions/ErrorAction.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 performModelDelete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function performModelDelete(ActiveRecord $model, array $params)
                      {
                          Yii::$app->response->format = Response::FORMAT_JSON;
                          if ($model->delete()) {
                              if (isset($params['afterDelete']) && is_callable($params['afterDelete'])) {
                  Severity: Minor
                  Found in modules/management/controllers/ManagementController.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 actionSortItems has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function actionSortItems()
                      {
                          $form = new CategorySortForm();
                          if ($form->load(Yii::$app->request->post()) && !$form->validate()) {
                              throw new InvalidParamException(VarDumper::dumpAsString($form->errors));
                  Severity: Minor
                  Found in modules/management/controllers/CategoryController.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

                  Avoid too many return statements within this method.
                  Open

                          return false;
                  Severity: Major
                  Found in components/AccessRule.php - About 30 mins to fix

                    Function actionSignup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function actionSignup()
                        {
                            $model = new SignupForm();
                            if ($model->load(Yii::$app->request->post())) {
                                if ($user = $model->signup()) {
                    Severity: Minor
                    Found in controllers/SiteController.php - About 25 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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function init()
                        {
                            parent::init();
                    
                            $session = \Yii::$app->session;
                    Severity: Minor
                    Found in widgets/Alert.php - About 25 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 buildTree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function buildTree($categories, $parentId = null, $level = 0)
                        {
                            $items = [];
                    
                            foreach ($categories as $category) {
                    Severity: Minor
                    Found in modules/management/models/Category.php - About 25 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