YetiForceCompany/YetiForceCRM

View on GitHub

Showing 4,652 of 306,333 total issues

Function loadFromBase has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function loadFromBase(string $contents, array $param = []): ?self
    {
        $result = explode(',', $contents, 2);
        $contentType = $isBase64 = false;
        if (2 === \count($result)) {
Severity: Minor
Found in app/Fields/File.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate(?string $type = null): bool
    {
        $return = true;
        try {
            if ($type && $this->getShortMimeType(0) !== $type) {
Severity: Minor
Found in app/Fields/File.php - About 55 mins 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 getInstance has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getInstance($moduleName = false, $currentUser = false)
    {
        if ($currentUser && $currentUser instanceof \Users) {
            $currentUser = \App\User::getUserModel($currentUser->id);
        } elseif (false === $currentUser) {
Severity: Minor
Found in app/Fields/Owner.php - About 55 mins 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 getAccessibleUsers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAccessibleUsers($private = '', $fieldType = false)
    {
        $cacheKey = $private . $this->moduleName . $fieldType . $this->currentUser->getRole();
        if (!\App\Cache::has('getAccessibleUsers', $cacheKey)) {
            $currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
Severity: Minor
Found in app/Fields/Owner.php - About 55 mins 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 truncateZeros has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function truncateZeros(string $value)
    {
        $seperator = \App\User::getCurrentUserModel()->getDetail('currency_decimal_separator');
        if (false === strpos($value, $seperator)) {
            return $value;
Severity: Minor
Found in app/Fields/Double.php - About 55 mins 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 getDiff has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getDiff($start, $end, $format = '%a')
    {
        $interval = (new \DateTime($start))->diff(new \DateTime($end));
        switch ($format) {
            case 'years':
Severity: Minor
Found in app/Fields/DateTime.php - About 55 mins 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 addAdditionalInvData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function addAdditionalInvData(): array
    {
        $additionalData = [];
        $additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
        if (!empty($additionalAmount)) {
Severity: Minor
Found in app/Integrations/Magento/Synchronizer/Maps/Order.php - About 55 mins 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 loadFromDav has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function loadFromDav(string $calendar)
    {
        $instance = new self();
        $instance->record = \Vtiger_Record_Model::getCleanInstance('Calendar');
        $instance->vcalendar = VObject\Reader::read($calendar, \Sabre\VObject\Reader::OPTION_FORGIVING);
Severity: Minor
Found in app/Integrations/Dav/Calendar.php - About 55 mins 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 getDataFromApi has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function getDataFromApi(string $cnpj): void
    {
        try {
            $this->setApiKey();
            if ($this->apiKey) {
Severity: Minor
Found in app/RecordCollectors/BrReceitaWsCnpj.php - About 55 mins 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 cron has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function cron($crons): array
    {
        if (!$crons) {
            return [];
        }
Severity: Minor
Found in app/Db/Updater.php - About 55 mins 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 merge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function merge(array $array1, array $array2): array
    {
        foreach ($array2 as $key => $value) {
            if (isset($array1[$key])) {
                if (\is_array($array1[$key]) && \is_array($value)) {
Severity: Minor
Found in app/Utils.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function save()
    {
        $entityInstance = $this->getModule()->getEntityInstance();
        $entityInstance->column_fields['user_name'] = $this->get('user_name');
        if (!$this->isNew() && empty($this->getPreviousValue())) {
Severity: Minor
Found in modules/Users/models/Record.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function process($auth, $password)
    {
        \App\Log::trace('Start LDAP authentication', 'UserAuthentication');
        if (!empty($password) && ('PLL_LDAP' === $this->userRecordModel->get('login_method') || 'PLL_LDAP_2FA' === $this->userRecordModel->get('login_method'))) {
            $port = '' == $auth['port'] ? 389 : $auth['port'];
Severity: Minor
Found in modules/Users/authmethods/Ldap.php - About 55 mins 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 setSharedOwner has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setSharedOwner($userIds, $record)
    {
        $saveFull = true;
        $db = \App\Db::getInstance();
        if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {
Severity: Minor
Found in modules/Users/models/Privileges.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function setDataFromRequest(App\Request $request)
    {
        $searchParams = \App\Condition::validSearchParams($this->moduelName, $request->getArray('search_params'));
        $operator = $request->isEmpty('operator') ? '' : $request->getByType('operator');
        if ($operator && $searchValue = \App\Condition::validSearchValue($request->getByType('search_value', \App\Purifier::TEXT), $this->moduelName, $request->getByType('search_key', \App\Purifier::ALNUM), $operator)) {
Severity: Minor
Found in modules/Users/actions/ExportData.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function save(App\Request $request)
    {
        if ($request->isEmpty('record')) {
            //get instance from currency name, Aleady deleted and adding again same currency case
            $recordModel = Settings_Currency_Record_Model::getInstance($request->getByType('currency_name', 'Text'));
Severity: Minor
Found in modules/Settings/Currency/actions/SaveAjax.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function process(App\Request $request)
    {
        $response = new Vtiger_Response();
        $qualifiedModuleName = $request->getModule(false);
        $type = $request->has('type') ? $request->getByType('type', \App\Purifier::STANDARD) : 'Main';
Severity: Minor
Found in modules/Settings/ConfigEditor/actions/SaveAjax.php - About 55 mins 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 getTableName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTableName($type)
    {
        if (\is_int($type)) {
            $focus = CRMEntity::getInstance($this->getSourceModule()->getName());
            if (0 == $type) {
Severity: Minor
Found in modules/Settings/LayoutEditor/models/Module.php - About 55 mins 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 step1 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function step1(App\Request $request)
    {
        $qualifiedModuleName = $request->getModule(false);

        $params = $request->getByType('param', 'Text');
Severity: Minor
Found in modules/Settings/MappedFields/actions/SaveAjax.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkPermission(App\Request $request)
    {
        $moduleName = $request->getModule();
        $currentUserModel = Users_Record_Model::getCurrentUserModel();
        if (!App\Config::security('SHOW_MY_PREFERENCES')) {
Severity: Minor
Found in modules/Users/views/PreferenceEdit.php - About 55 mins 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