antaresproject/core

View on GitHub

Showing 306 of 306 total issues

Function getRecipients has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRecipients()
    {
        if (empty($this->recipients)) {
            return [];
        }
Severity: Minor
Found in src/components/view/src/Notification/AbstractNotificationTemplate.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

File Fieldset.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Part of the Antares package.
 *
Severity: Minor
Found in src/components/html/src/Form/Fieldset.php - About 2 hrs to fix

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

        public function updatePermissions($name, $values, $isNew = false, $brandId = null)
        {
            try {
                if ($name === null) {
                    return false;
    Severity: Major
    Found in src/components/memory/src/Model/Permission.php - About 2 hrs to fix

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

          public function up()
          {
              $this->down();
      
              Schema::create('tbl_notifications', function(Blueprint $table) {

        File JSMin.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Part of the Antares package.
         *
        Severity: Minor
        Found in src/utils/asset/src/JSMin.php - About 2 hrs to fix

          File Foundation.php has 278 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * Part of the Antares package.
           *
          Severity: Minor
          Found in src/utils/twig/Extension/Foundation.php - About 2 hrs to fix

            Fieldset has 24 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Fieldset extends BaseGrid implements FieldsetContract
            {
            
                /**
                 * Fieldset name.
            Severity: Minor
            Found in src/components/html/src/Form/Fieldset.php - About 2 hrs to fix

              HtmlBuilder has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class HtmlBuilder
              {
              
                  use Macroable,
                      ObfuscateTrait;
              Severity: Minor
              Found in src/components/html/src/Support/HtmlBuilder.php - About 2 hrs to fix

                AbstractNotificationTemplate has 24 functions (exceeds 20 allowed). Consider refactoring.
                Open

                abstract class AbstractNotificationTemplate extends Job implements NotificationContract, ShouldQueue
                {
                
                    use InteractsWithQueue,
                        SerializesModels;
                Severity: Minor
                Found in src/components/view/src/Notification/AbstractNotificationTemplate.php - About 2 hrs to fix

                  Function verify has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function verify(array $items = [], $brandId = null)
                      {
                  
                          $items   = $this->clear($items);
                          $changed = [];
                  Severity: Minor
                  Found in src/components/memory/src/Component/ComponentHandler.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

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

                          Schema::table('tbl_brand_options', function(Blueprint $table) {
                              $table->foreign('brand_id', 'tbl_brand_options_ibfk_1')->references('id')->on('tbl_brands')->onUpdate('NO ACTION')->onDelete('CASCADE');
                              $table->foreign('country_id', 'tbl_brand_options_ibfk_2')->references('id')->on('tbl_country')->onUpdate('NO ACTION')->onDelete('CASCADE');
                              $table->foreign('language_id', 'tbl_brand_options_ibfk_3')->references('id')->on('tbl_languages')->onUpdate('NO ACTION')->onDelete('CASCADE');
                          });
                  src/components/auth/resources/database/migrations/2017_07_24_082030_create_notifications_table.php on lines 87..91

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

                  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

                          Schema::table('tbl_notifications', function(Blueprint $table) {
                              $table->foreign('severity_id', 'fk_severity_id')->references('id')->on('tbl_notification_severity')->onUpdate('NO ACTION')->onDelete('CASCADE');
                              $table->foreign('category_id', 'fk_not_category_id')->references('id')->on('tbl_notification_categories')->onUpdate('NO ACTION')->onDelete('CASCADE');
                              $table->foreign('type_id', 'fk_not_type_id')->references('id')->on('tbl_notification_types')->onUpdate('NO ACTION')->onDelete('CASCADE');
                          });
                  src/components/memory/resources/database/migrations/2016_11_16_152342_create_tbl_brand_options_table.php on lines 62..66

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

                  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

                  File User.php has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * Part of the Antares package.
                   *
                  Severity: Minor
                  Found in src/components/model/src/User.php - About 2 hrs to fix

                    Function attributes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function attributes(FieldView $field)
                        {
                            if (is_null($field)) {
                                return $this;
                            }
                    Severity: Minor
                    Found in src/utils/customfield/src/CustomField.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 wrap_html has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        function wrap_html($str, $size = 50, $splitter = '<br />')
                        {
                            $html   = false;
                            $i      = 0;
                            $chars  = str_split($str);
                    Severity: Minor
                    Found in src/foundation/src/helpers.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 attributes has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function attributes(FieldView $field)
                        {
                            if (is_null($field)) {
                                return $this;
                            }
                    Severity: Major
                    Found in src/utils/customfield/src/CustomField.php - About 2 hrs to fix

                      Method inline has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function inline()
                          {
                              $inline = <<<EOD
                                 $(document).ready(function(){                         
                                  var element =null;
                      Severity: Major
                      Found in src/ui/components/templates/src/Adapter/GridStackAdapter.php - About 2 hrs to fix

                        Method beforeTable has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function beforeTable()
                            {
                                $hasMassActions  = $this->hasMassActions();
                                $filters         = $this->filterAdapter->getFilters();
                                $hasColumnFilter = $this->hasColumnFilter();
                        Severity: Major
                        Found in src/ui/components/datatables/src/Html/Builder.php - About 2 hrs to fix

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

                              public function up()
                              {
                                  try {
                                      $this->down();
                                      Schema::create('tbl_log_priorities', function(Blueprint $table) {

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

                                public function finish(array $items = [])
                                {
                                    $changed = false;
                                    foreach ($items as $key => $value) {
                                        $isNew = $this->isNewKey($key);
                            Severity: Major
                            Found in src/components/html/src/Memory/Config.php and 1 other location - About 2 hrs to fix
                            src/components/html/src/Memory/Handler.php on lines 170..187

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

                            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