YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Function saveHistory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function saveHistory($title)
    {
        if (empty(App\User::getCurrentUserId())) {
            return false;
        }
Severity: Minor
Found in modules/Vtiger/helpers/BrowsingHistory.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 reloadApprovals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function reloadApprovals(int $approvalId): void
    {
        $moduleName = 'Approvals';
        if (\App\Record::isExists($approvalId, $moduleName)) {
            $contactModal = \Vtiger_Module_Model::getInstance('Contacts');
Severity: Minor
Found in modules/Approvals/handlers/Approvals.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 saveRecord has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveRecord(App\Request $request)
    {
        $this->getRecordModelFromRequest($request);
        $eventHandler = $this->record->getEventHandler();
        foreach ($eventHandler->getHandlers(\App\EventHandler::EDIT_VIEW_PRE_SAVE) as $handler) {
Severity: Minor
Found in modules/PriceBooks/actions/Save.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function initialize(App\Request $request, App\User $user)
    {
        $zipfile = Import_Utils_Helper::getImportFilePath($user);
        $this->importFolderLocation = "{$zipfile}_{$this->extension}";
        // clean old data
Severity: Minor
Found in modules/Import/readers/ZipReader.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 saveRecord has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveRecord(App\Request $request)
    {
        $this->getRecordModelFromRequest($request);
        $eventHandler = $this->record->getEventHandler();
        foreach ($eventHandler->getHandlers(\App\EventHandler::EDIT_VIEW_PRE_SAVE) as $handler) {
Severity: Minor
Found in modules/PriceBooks/actions/SaveAjax.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 getListTplForXmlType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getListTplForXmlType($moduleName)
    {
        $output = [];
        $path = 'modules/Import/tpl/';
        if (is_dir($path)) {
Severity: Minor
Found in modules/Import/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 getProductBundles has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function getProductBundles(): array
    {
        $products = [];
        $productRelationModel = \Vtiger_Relation_Model::getInstance($this->recordModel->getModule(), $this->recordModel->getModule());
        $productRelationModel->set('parentRecord', $this->recordModel);
Severity: Minor
Found in api/webservice/WebservicePremium/Products/Record.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 getProductsByInventory has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function getProductsByInventory()
    {
        $isUserPermissions = \Api\WebservicePremium\Privilege::USER_PERMISSIONS === $this->permissionType;
        $this->products = [];
        $crmIds = array_keys($this->inventory);
Severity: Minor
Found in api/webservice/WebservicePremium/Inventory.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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $response = [];
        $moduleName = $this->controller->request->getModule();
        $columns = array_flip(['id', 'type', 'label', 'wcol', 'sequence', 'data', 'name']);
Severity: Minor
Found in api/webservice/WebservicePremium/BaseModule/Widgets.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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(): array
    {
        $file = $pdfFiles = $increment = [];
        $recordId = $this->controller->request->getInteger('record');
        foreach ($this->controller->request->getArray('templates', 'Integer') as $templateId) {
Severity: Minor
Found in api/webservice/WebservicePremium/BaseModule/Pdf.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 getUserData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUserData(string $key, string $param = '')
    {
        if (!isset($this->userData[$key])) {
            return null;
        }
Severity: Minor
Found in api/webservice/Core/BaseAction.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 createQuery has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function createQuery(): void
    {
        $this->isUserPermissions = \Api\WebservicePremium\Privilege::USER_PERMISSIONS === $this->getPermissionType();
        if ($this->isUserPermissions) {
            parent::createQuery();
Severity: Minor
Found in api/webservice/WebservicePremium/Products/RecordsTree.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 getRecordModelFromRequest has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getRecordModelFromRequest(\App\Request $request)
    {
        $fieldModelList = $this->record->getModule()->getFields();
        $requestKeys = $request->getAllRaw();
        unset($requestKeys['module'],$requestKeys['action'],$requestKeys['record']);
Severity: Minor
Found in api/webservice/WebserviceStandard/Save.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 validationFileZipPath has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        validationFileZipPath: function (form) {
            form.on('submit', function (e) {
                if (typeof form.data('submit') !== 'undefined') {
                    return false;
                } else {

    Function confirmedCallback has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    confirmedCallback: () => {
                        AppConnector.request(deleteUrl).done(function (data) {
                            let response = data.result;
                            if (response && response.success) {
                                currentRow.fadeOut('slow');

      Function validateModuleName has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              validateModuleName(field, rules, i, options) {
                  let returnVal = false;
                  const progressIndicatorElement = jQuery.progressIndicator();
                  AppConnector.request({
                      async: false,

        Function changeRelatedViewType has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                changeRelatedViewType: function (currentTarget) {
                    var relatedModule = currentTarget.closest('.relatedModule');
                    AppConnector.request({
                        module: app.getModuleName(),
                        parent: app.getParentModuleName(),

          Function registerAdd has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  registerAdd: function (content) {
                      var thisInstance = this;
                      content.find('.addItem').on('click', function (e) {
                          var data = [];
                          content.find('.switchUsersTable tbody tr').each(function (index) {

            Function changeOperationalHoursView has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    changeOperationalHoursView() {
                        if (this.operationalHours === 1) {
                            let progress = $.progressIndicator({
                                position: 'html',
                                blockInfo: {

              Function makeFieldsListSortable has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      makeFieldsListSortable: function () {
                          var thisInstance = this;
                          var contents = this.container.find('.contents');
                          var table = contents.find('.editFieldsTable');
                          table.each(function () {
                Severity
                Category
                Status
                Source
                Language