YetiForceCompany/YetiForceCRM

View on GitHub

Showing 306,333 of 306,333 total issues

Function getEmployeeHierarchy has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getEmployeeHierarchy($id)
    {
        \App\Log::trace('Entering getEmployeeHierarchy(' . $id . ') method ...');

        $listViewHeader = [];
Severity: Minor
Found in modules/OSSEmployees/OSSEmployees.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 getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        $moduleName = 'Partners';
        $currentUser = \App\User::getCurrentUserModel();
        $hasRecordViewAccess = $currentUser->isAdmin() || \App\Privilege::isPermitted($moduleName, 'DetailView', $recordId);
Severity: Minor
Found in modules/Partners/Partners.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 getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
        $currentUser = Users_Privileges_Model::getCurrentUserModel();
        $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('MultiCompany', 'DetailView', $recordId);
Severity: Minor
Found in modules/MultiCompany/MultiCompany.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 getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData($id, $baseInfo, $recordId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
        $currentUser = Users_Privileges_Model::getCurrentUserModel();
        $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Competition', 'DetailView', $recordId);
Severity: Minor
Found in modules/Competition/Competition.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 getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData($id, $salesProcessesInfoBase, $salesProcessesId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $salesProcessesId . ') method ...');

        $currentUser = Users_Privileges_Model::getCurrentUserModel();
Severity: Minor
Found in modules/SSalesProcesses/SSalesProcesses.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 performTasks has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    private function performTasks(App\EventHandler $eventHandler, $condition = [])
    {
        $recordModel = $eventHandler->getRecordModel();
        $moduleName = $eventHandler->getModuleName();
        if (!isset($this->workflows[$moduleName])) {
Severity: Minor
Found in modules/Vtiger/handlers/Workflow.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 initializeListViewContents has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function initializeListViewContents(App\Request $request, Vtiger_Viewer $viewer)
    {
        $moduleName = $request->getModule();
        $pageNumber = $request->getInteger('page');
        $orderBy = $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL);
Severity: Minor
Found in modules/Vtiger/views/List.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 getStructure has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getStructure(Vtiger_Record_Model $recordModel, App\Request $request): array
    {
        Vtiger_Field_Model::$tabIndexDefaultSeq = 1000;
        $values = [];
        $moduleModel = $recordModel->getModule();
Severity: Minor
Found in modules/Vtiger/views/QuickEditModal.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 getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData($id, $iStorageInfoBase, $iStorageId, &$listviewEntries, $getRawData = false, $getLinks = true)
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $iStorageId . ') method ...');

        $hasRecordViewAccess = \App\Privilege::isPermitted('IStorages', 'DetailView', $iStorageId);
Severity: Minor
Found in modules/IStorages/IStorages.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 getRecordDataFromXMLTemplate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRecordDataFromXMLTemplate(XMLReader $xmlToImport)
    {
        $recordData = [];
        $recordNum = 0;
        $firstElement = '';
Severity: Minor
Found in modules/Import/readers/XmlReader.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 getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
        $currentUser = Users_Privileges_Model::getCurrentUserModel();
        $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('HelpDesk', 'DetailView', $recordId);
Severity: Minor
Found in modules/HelpDesk/models/Module.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 getHierarchyData has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHierarchyData(int $id, array $baseInfo, int $recordId, array &$listviewEntries, bool $getRawData = false, bool $getLinks = true): array
    {
        \App\Log::trace('Entering getHierarchyData(' . $id . ',' . $recordId . ') method ...');
        $currentUser = Users_Privileges_Model::getCurrentUserModel();
        $hasRecordViewAccess = $currentUser->isAdminUser() || \App\Privilege::isPermitted('Project', 'DetailView', $recordId);
Severity: Minor
Found in modules/Project/Project.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

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

                    AppConnector.request(params).done(function (data) {
                        if (data && data.result && data.result.notify) {
                            Vtiger_Helper_Js.showMessage(data.result.notify);
                        }
                        listInstance.getListViewRecords({
public_html/layouts/basic/modules/RecycleBin/resources/List.js on lines 53..62

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

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

        registerShowHierarchy: function () {
            var thisInstance = this;
            var hierarchyButton = $('.detailViewTitle');
            var params = {
                module: app.getModuleName(),
public_html/layouts/basic/modules/MultiCompany/resources/Detail.js on lines 63..76

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

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

        registerShowHierarchy: function () {
            var thisInstance = this;
            var hierarchyButton = $('.detailViewTitle');
            var params = {
                module: app.getModuleName(),
public_html/layouts/basic/modules/SSalesProcesses/resources/Detail.js on lines 67..80

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

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

                    AppConnector.request(params).done(function (data) {
                        if (data && data.result && data.result.notify) {
                            Vtiger_Helper_Js.showMessage(data.result.notify);
                        }
                        listInstance.getListViewRecords({
public_html/layouts/basic/modules/RecycleBin/resources/List.js on lines 23..32

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

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 getListSearchParams has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        getListSearchParams: function (urlSearchParams) {
            let listViewPageDiv = this.getContainer();
            let listViewTable = listViewPageDiv.find('.listViewEntriesTable');
            let searchParams = [];
            listViewTable.find('.listSearchContributor').each(function (index, domElement) {
Severity: Major
Found in public_html/layouts/basic/modules/Vtiger/resources/ListSearch.js - About 4 hrs to fix

    Method getAllByType has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function getAllByType($tabid, $type = false, $parameters = false)
        {
            if (\App\Cache::has('AllLinks', 'ByType')) {
                $rows = \App\Cache::get('AllLinks', 'ByType');
            } else {
    Severity: Major
    Found in vtlib/Vtiger/Link.php - About 4 hrs to fix

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

          public function initializeListViewContents(App\Request $request, Vtiger_Viewer $viewer)
          {
              $moduleName = $request->getModule();
              $pageNumber = $request->getInteger('page');
              $orderBy = $request->getArray('orderby', \App\Purifier::STANDARD, [], \App\Purifier::SQL);
      Severity: Major
      Found in modules/Vtiger/views/List.php - About 4 hrs to fix

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

            public function checkPermission(App\Request $request)
            {
                if ((explode('-', $request->getByType('query', 'AlnumExtended'))[0] ?? '') !== substr(\App\YetiForce\Register::getInstanceKey(), 0, 30)) {
                    $this->error = 'LBL_PERMISSION_DENIED';
                    \App\Log::error("Incorrect integration key: {$request->getByType('query', 'AlnumExtended')}.");
        Severity: Major
        Found in modules/MailIntegration/views/MessageDetail.php and 1 other location - About 4 hrs to fix
        modules/MailIntegration/views/MessageCompose.php on lines 35..47

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

        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