YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

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

        registerHierarchyRecordCount: function () {
            let hierarchyButton = $('.js-detail-hierarchy'),
                params = {
                    module: app.getModuleName(),
                    action: 'RelationAjax',
public_html/layouts/basic/modules/Competition/resources/Detail.js on lines 42..57
public_html/layouts/basic/modules/Contacts/resources/Detail.js on lines 95..110
public_html/layouts/basic/modules/Project/resources/Detail.js on lines 96..111

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

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 4 locations. Consider refactoring.
Open

        registerHierarchyRecordCount: function () {
            var hierarchyButton = $('.detailViewTitle .hierarchy');
            if (hierarchyButton.length) {
                var params = {
                    module: app.getModuleName(),
public_html/layouts/basic/modules/Accounts/resources/Detail.js on lines 57..72
public_html/layouts/basic/modules/IStorages/resources/Detail.js on lines 47..62
public_html/layouts/basic/modules/SSalesProcesses/resources/Detail.js on lines 51..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 129.

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 4 locations. Consider refactoring.
Open

        registerHierarchyRecordCount: function () {
            let hierarchyButton = $('.js-detail-hierarchy'),
                params = {
                    module: app.getModuleName(),
                    action: 'RelationAjax',
public_html/layouts/basic/modules/Contacts/resources/Detail.js on lines 95..110
public_html/layouts/basic/modules/HelpDesk/resources/Detail.js on lines 87..102
public_html/layouts/basic/modules/Project/resources/Detail.js on lines 96..111

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

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

        viewAllAction.on('change', function (e) {
            var currentTarget = jQuery(e.currentTarget);
            if (currentTarget.attr('readonly') == 'readonly') {
                var status = jQuery(e.currentTarget).is(':checked');
                if (!status) {
public_html/layouts/basic/modules/Settings/LayoutEditor/resources/LayoutEditor.js on lines 1707..1718

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

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

            contents.find(':checkbox').on('change', function (e) {
                let currentTarget = $(e.currentTarget);
                if (currentTarget.attr('readonly') == 'readonly') {
                    var status = $(e.currentTarget).is(':checked');
                    if (!status) {
public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 361..372

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

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

Method db has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function db(): array
    {
        $benchmarkCountGroup = 20;
        $insertCountGroup = 5;
        $updateCountGroup = 5;
Severity: Major
Found in app/Utils/Benchmarks.php - About 4 hrs to fix

    Validator has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Validator
    {
        /**
         * Function verifies if given value can be recognized as bool.
         *
    Severity: Minor
    Found in app/Validator.php - About 4 hrs to fix

      DateField has 36 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class DateField extends BaseField
      {
          use \App\Conditions\RecordTraits\Comparison;
          use \App\Conditions\RecordTraits\ComparisonField;
      
      
      Severity: Minor
      Found in app/Conditions/RecordFields/DateField.php - About 4 hrs to fix

        Calendar has 36 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Calendar
        {
            /**
             * Record model instance.
             *
        Severity: Minor
        Found in app/Integrations/Dav/Calendar.php - About 4 hrs to fix

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

              public function importRecord(): int
              {
                  if ($id = $this->findInMapTable($this->waproId, 'KONTRAHENT')) {
                      $this->recordModel = \Vtiger_Record_Model::getInstanceById($id, 'Accounts');
                  } else {
          Severity: Major
          Found in app/Integrations/Wapro/Synchronizer/Accounts.php and 1 other location - About 4 hrs to fix
          app/Integrations/Wapro/Synchronizer/Contacts.php on lines 86..107

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

          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

              public function importRecord(): int
              {
                  if ($id = $this->findInMapTable($this->waproId, 'KONTAKT')) {
                      $this->recordModel = \Vtiger_Record_Model::getInstanceById($id, 'Contacts');
                  } else {
          Severity: Major
          Found in app/Integrations/Wapro/Synchronizer/Contacts.php and 1 other location - About 4 hrs to fix
          app/Integrations/Wapro/Synchronizer/Accounts.php on lines 98..119

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

          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

          Method initializeListViewContents has 116 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function initializeListViewContents(App\Request $request, Vtiger_Viewer $viewer)
              {
                  $moduleName = $request->getModule();
                  $cvId = $request->getByType('viewname', 2);
                  $pageNumber = $request->getInteger('page');
          Severity: Major
          Found in modules/Users/views/List.php - About 4 hrs to fix

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

                    foreach (['Name', 'Quantity', 'Discount', 'Currency', 'DiscountMode', 'TaxMode', 'UnitPrice', 'GrossPrice', 'NetPrice', 'Tax', 'TotalPrice', 'Value'] as $fieldType) {
                        foreach ($inventory->getFieldsByType($fieldType) as $fieldModel) {
                            $columnName = $fieldModel->getColumnName();
                            if (!$fieldModel->isVisible()) {
                                continue;
            Severity: Major
            Found in app/TextParser/ProductsTable.php and 1 other location - About 4 hrs to fix
            app/TextParser/ProductsTableCorrectingBefore.php on lines 52..64

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

            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

                    foreach (['Name', 'Quantity', 'UnitPrice', 'TotalPrice', 'Discount', 'NetPrice', 'Currency', 'DiscountMode', 'Tax', 'TaxMode', 'GrossPrice', 'Value'] as $fieldType) {
                        foreach ($inventory->getFieldsByType($fieldType) as $fieldModel) {
                            $columnName = $fieldModel->getColumnName();
                            if (!$fieldModel->isVisible()) {
                                continue;
            Severity: Major
            Found in app/TextParser/ProductsTableCorrectingBefore.php and 1 other location - About 4 hrs to fix
            app/TextParser/ProductsTable.php on lines 49..61

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

            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

            Method generate has 115 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function generate(App\Request $request): void
                {
                    $pdfModuleName = $request->getModule();
                    $view = $request->getByType('fromview', \App\Purifier::STANDARD);
                    $recordId = $request->isEmpty('record', true) ? null : $request->getInteger('record');
            Severity: Major
            Found in modules/Vtiger/actions/PDF.php - About 4 hrs to fix

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

                              form.find('[id^="selectRow"]').each(function (index, checkbox) {
                                  checkbox = $(checkbox);
                                  if (!checkbox.prop('checked')) {
                                      checkbox
                                          .closest('.js-form-row-container')
              Severity: Major
              Found in public_html/layouts/basic/modules/Vtiger/resources/List.js and 1 other location - About 4 hrs to fix
              public_html/layouts/resources/Fields.js on lines 2934..2945

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

              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

                                  form.find('[id^="selectRow"]').each(function (_, checkbox) {
                                      checkbox = $(checkbox);
                                      if (!checkbox.prop('checked')) {
                                          checkbox
                                              .closest('.js-form-row-container')
              Severity: Major
              Found in public_html/layouts/resources/Fields.js and 1 other location - About 4 hrs to fix
              public_html/layouts/basic/modules/Vtiger/resources/List.js on lines 706..717

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

              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 registerParams has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                      registerParams(selectElement, params) {
                          if (typeof params.dropdownParent === 'undefined') {
                              const modalParent = $(selectElement).closest('.modal-body');
                              if (modalParent.length) {
                                  params.dropdownParent = modalParent;
              Severity: Minor
              Found in public_html/layouts/resources/Fields.js - 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 retrieveEntityInfo has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function retrieveEntityInfo(int $record, string $module)
                  {
                      if (!isset($record)) {
                          throw new \App\Exceptions\NoPermittedToRecord('LBL_RECORD_NOT_FOUND');
                      }
              Severity: Minor
              Found in include/CRMEntity.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 hardDrive has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static function hardDrive(): array
                  {
                      $countGroup = 50;
                      $maxTime = 0.2;
                      $read = $write = [];
              Severity: Minor
              Found in app/Utils/Benchmarks.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

              Severity
              Category
              Status
              Source
              Language