YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Function getInstance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getInstance($parentModuleModel, $relatedModuleModel, $relationId = false)
    {
        $relKey = $parentModuleModel->getId() . '_' . $relatedModuleModel->getId() . '_' . $relationId;
        if (isset(self::$cachedInstances[$relKey])) {
            return self::$cachedInstances[$relKey] ? clone self::$cachedInstances[$relKey] : self::$cachedInstances[$relKey];
Severity: Minor
Found in modules/Vtiger/models/Relation.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 getInstanceFromLinkObject has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getInstanceFromLinkObject(vtlib\Link $linkObj)
    {
        $objectProperties = get_object_vars($linkObj);
        $linkModel = new self();

Severity: Minor
Found in modules/Vtiger/models/Link.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 setDataFromRequest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function setDataFromRequest(App\Request $request)
    {
        foreach ($this->getEditFields() as $fieldName => $fieldInfo) {
            if ($request->has($fieldName) && !isset($this->customFields[$fieldName])) {
                $value = $request->getByType($fieldName, $fieldInfo['purifyType']);
Severity: Minor
Found in modules/Vtiger/models/Widget.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 getRelationInventoryFields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRelationInventoryFields()
    {
        if (!$this->has('RelationInventoryFields')) {
            $this->set('RelationInventoryFields', []);
            if ($this->getRelationModuleModel()->isInventory()) {
Severity: Minor
Found in modules/Vtiger/models/Relation.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 getFields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFields($blockInstance = false)
    {
        if (empty($this->fields)) {
            $moduleBlockFields = Vtiger_Field_Model::getAllForModule($this);
            $this->fields = [];
Severity: Minor
Found in modules/Vtiger/models/Module.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 checkUserPermissions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkUserPermissions()
    {
        \App\Log::trace('Entering ' . __METHOD__ . '() method ...');
        $permissions = $this->get('permissions');
        if (empty($permissions)) {
Severity: Minor
Found in modules/Vtiger/models/MappedFields.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 getRecordsListFromRequest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRecordsListFromRequest(App\Request $request)
    {
        $cvId = $request->getByType('cvid', 2);
        $selectedIds = $request->getArray('selected_ids', 2);
        $excludedIds = $request->getArray('excluded_ids', 2);
Severity: Minor
Found in modules/Vtiger/views/IndexAjax.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 showRecentActivities has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function showRecentActivities(App\Request $request)
    {
        $moduleName = $request->getModule();
        include_once 'modules/ModTracker/ModTracker.php';
        $type = 'changes';
Severity: Minor
Found in modules/Vtiger/views/Detail.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $moduleName = $request->getModule();
        $changes = $request->getArray('changes');
        $recordStructure = $fieldInfo = [];
Severity: Minor
Found in modules/Vtiger/views/ChangesJsonModal.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 getQuery has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getQuery(App\Request $request): App\Db\Query
    {
        $moduleName = $request->getModule();
        $sourceModule = $request->getByType('sourceModule', 2);
        if ($sourceModule) {
Severity: Minor
Found in modules/Vtiger/actions/Mail.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function process()
    {
        $disable = true;
        $iterator = new \DirectoryIterator(ROOT_DIRECTORY . DIRECTORY_SEPARATOR . 'cron' . DIRECTORY_SEPARATOR . 'Batch');
        foreach ($iterator as $item) {
Severity: Minor
Found in modules/Vtiger/crons/BatchProcesses.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 checkPermission has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkPermission(App\Request $request)
    {
        $mode = $request->getMode();
        if ('verifyPhoneNumber' !== $mode) {
            $userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
Severity: Minor
Found in modules/Vtiger/actions/Fields.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 setDataFromRequest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function setDataFromRequest(App\Request $request)
    {
        if (array_intersect(array_keys($this->fieldForChartModal), $request->getKeys())) {
            $this->set('data', []);
        }
Severity: Minor
Found in modules/Vtiger/dashboards/ChartFilterModel.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function process()
    {
        $query = (new \App\Db\Query())->from('s_#__batchmethod')->limit(10);
        while ($rows = $query->all()) {
            foreach ($rows as $row) {
Severity: Minor
Found in modules/Vtiger/crons/BatchMethods.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 formatDateDiffInStrings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function formatDateDiffInStrings($dateTime)
    {
        // http://www.php.net/manual/en/datetime.diff.php#101029
        $seconds = strtotime('now') - strtotime($dateTime);
        if (0 === $seconds) {
Severity: Minor
Found in modules/Vtiger/helpers/Util.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 entityAfterSave has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function entityAfterSave(App\EventHandler $eventHandler)
    {
        $moduleName = $eventHandler->getModuleName();
        $correctionModules = ['IGRNC' => 'igrnid', 'IGDNC' => 'igdnid'];
        $recordModel = $eventHandler->getRecordModel();
Severity: Minor
Found in modules/IStorages/handlers/RecalculateStockHandler.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 getRecordDataFromXML has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRecordDataFromXML(XMLReader $xmlToImport, $keyType = 'label')
    {
        $recordData = [];
        $recordInventoryData = [];
        $isInventory = false;
Severity: Minor
Found in modules/Import/readers/XmlReader.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 calculateLevels has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function calculateLevels()
    {
        $parents = $this->getAllParentRecordsIds();
        foreach ($this->tasks as &$task) {
            $task['level'] = \count($parents[$task['id']]);
Severity: Minor
Found in modules/Project/models/Gantt.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 addPanel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        addPanel: function (module) {
            const thisInstance = this;
            let aDeferred = jQuery.Deferred(),
                progressIndicatorElement = jQuery.progressIndicator({
                    position: 'html',

    Function loadFilters has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            loadFilters: function (contener) {
                let types = ['filter', 'checkbox', 'switchHeader'];
                let selected = contener.find("select[name='relation_id'] option:selected");
                let relatedModuleInput = contener.find("input[name='relatedmodule']");
                let relatedModule = relatedModuleInput.val();
      Severity
      Category
      Status
      Source
      Language