YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Method process has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $viewer = $this->getViewer($request);
        $moduleName = $request->getModule();
        $requiredFieldType = ['currency', 'currencyInventory', 'double', 'percentage', 'integer'];
Severity: Major
Found in modules/Vtiger/views/ChartFilter.php - About 2 hrs to fix

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

            loadConditions: function (fieldSelect) {
                var row = fieldSelect.closest('div.js-conditions-row');
                var conditionSelectElement = row.find('select[name="comparator"]');
                var conditionSelected = conditionSelectElement.val();
                var fieldSelected = fieldSelect.find('option:selected');
    Severity: Minor
    Found in public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilterEx.js - 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 loadConditions has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

            loadConditions: function (fieldSelect) {
                var row = fieldSelect.closest('div.js-conditions-row');
                var conditionSelectElement = row.find('select[name="comparator"]');
                var group = row.find('[name="column_condition"]');
                var conditionSelected = conditionSelectElement.val();
    Severity: Minor
    Found in public_html/layouts/basic/modules/Vtiger/resources/AdvanceFilter.js - 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 getValidator has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

            getValidator: function (field) {
                let listOfValidators = [],
                    fieldData = field.data(),
                    fieldInfo = fieldData.fieldinfo;
                if (typeof fieldInfo === 'string') {
    Severity: Minor
    Found in public_html/layouts/resources/validator/BaseValidator.js - 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 importUpdate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function importUpdate()
        {
            $dirName = 'cache/updates/updates';
            $db = \App\Db::getInstance();
            $startTime = microtime(true);
    Severity: Minor
    Found in vtlib/Vtiger/PackageImport.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 getRelatedFieldForModule has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getRelatedFieldForModule($moduleName = false, $forModule = false)
        {
            $key = 'all';
            if (Cache::has('getRelatedFieldForModule', $key)) {
                $fields = Cache::get('getRelatedFieldForModule', $key);
    Severity: Minor
    Found in app/Field.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 relatedRecordsList has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function relatedRecordsList($params)
        {
            [$relatedModuleName, $columns, $conditions, $viewIdOrName, $limit, $maxLength] = array_pad(explode('|', $params), 6, '');
            if (is_numeric($relatedModuleName)) {
                if ($relationListView = \Vtiger_RelationListView_Model::getInstance($this->recordModel, '', $relatedModuleName)) {
    Severity: Minor
    Found in app/TextParser.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 recalculatePasswords has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function recalculatePasswords(string $method, string $password, string $vector, int $target)
        {
            $dbAdmin = \App\Db::getInstance('admin');
            $decryptInstance = static::getInstance($target);
            if (!$decryptInstance->getTarget() || ($decryptInstance->get('method') === $method && $decryptInstance->get('vector') === $vector && $decryptInstance->get('pass') === $password)) {
    Severity: Minor
    Found in app/Encryptions/Module.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 htmlTruncateByWords has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function htmlTruncateByWords(string $html, int $length = 0, string $ending = '...'): string
        {
            if (!$length) {
                $length = Config::main('listview_max_textlength');
            }
    Severity: Minor
    Found in app/TextUtils.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 parseInventoryData has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function parseInventoryData(\Vtiger_Record_Model $recordModel, array $item, Maps\Inventory $mapModel): array
        {
            $mapModel->setDataInv($item);
            $inventoryModel = \Vtiger_Inventory_Model::getInstance($recordModel->getModuleName());
            $inventoryRow = $inventoryModel->loadRowData($item['crmProductId'], ['currency' => $mapModel->dataCrm['currency_id']]);
    Severity: Minor
    Found in app/Integrations/Magento/Synchronizer/Base.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 addField has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addField($fieldType, $blockId, $params)
        {
            $label = $params['fieldLabel'];
            $name = strtolower($params['fieldName']);
            $pickListValues = [];
    Severity: Minor
    Found in modules/Settings/LayoutEditor/models/Module.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 save has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function save($saveMapping = false)
        {
            \App\Log::trace('Entering ' . __METHOD__ . '(' . $saveMapping . ') method ...');
            $db = \App\Db::getInstance();
            $fields = self::$allFields;
    Severity: Minor
    Found in modules/Settings/MappedFields/models/Module.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 process has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process(App\Request $request)
        {
            $step = $request->getByType('step', 2);
            if ($request->isEmpty('record', true)) {
                $pdfModel = Settings_PDF_Record_Model::getCleanInstance($request->getByType('module_name', 2));
    Severity: Minor
    Found in modules/Settings/PDF/actions/Save.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 validate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate($value, $isUserFormat = false)
        {
            $hashValue = \is_array($value) ? md5(print_r($value, true)) : $value;
            if (isset($this->validate[$hashValue]) || empty($value)) {
                return;
    Severity: Minor
    Found in modules/Settings/Media/uitypes/Image.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 getDisplayValue has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getDisplayValue(string $key)
        {
            $value = $this->get($key);
            switch ($key) {
                case 'smtp_id':
    Severity: Minor
    Found in modules/Settings/Mail/models/Record.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 validate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate($value, $isUserFormat = false)
        {
            $hashValue = \is_array($value) ? md5(print_r($value, true)) : $value;
            if (isset($this->validate[$hashValue]) || empty($value)) {
                return;
    Severity: Minor
    Found in modules/Vtiger/uitypes/MultiImage.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 validate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate($value, $isUserFormat = false)
        {
            $hashValue = \is_array($value) ? md5(print_r($value, true)) : $value;
            if (isset($this->validate[$hashValue]) || empty($value)) {
                return;
    Severity: Minor
    Found in modules/Vtiger/uitypes/MultiAttachment.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 getValuesForSave has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getValuesForSave()
        {
            $moduleModel = $this->getModule();
            $saveFields = $this->getModule()->getFieldsForSave($this);
            $forSave = $this->getEntityDataForSave();
    Severity: Minor
    Found in modules/Vtiger/models/Record.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 getStructure has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getStructure()
        {
            if (!empty($this->structuredValues)) {
                return $this->structuredValues;
            }
    Severity: Minor
    Found in modules/Vtiger/models/QuickCreateRecordStructure.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 PDF.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Basic PDF Model Class.
     *
    Severity: Minor
    Found in modules/Vtiger/models/PDF.php - About 2 hrs to fix
      Severity
      Category
      Status
      Source
      Language