Commit ce4896f6 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(simpleplugin) Fix Cognitive Complexity for Sonar

issue #5817
Showing with 2 additions and 10 deletions
+2 -10
...@@ -1805,11 +1805,7 @@ class simplePlugin ...@@ -1805,11 +1805,7 @@ class simplePlugin
/* Try to use plain entry first */ /* Try to use plain entry first */
$dn = $attribute.'='.ldap_escape_dn($this->$attribute).','.$base; $dn = $attribute.'='.ldap_escape_dn($this->$attribute).','.$base;
if ($dn == $this->orig_dn) { if (($dn == $this->orig_dn) || !$ldap->dn_exists($dn)) {
return $dn;
}
$ldap->cat($dn, array('dn'));
if (!$ldap->fetch()) {
return $dn; return $dn;
} }
...@@ -1827,11 +1823,7 @@ class simplePlugin ...@@ -1827,11 +1823,7 @@ class simplePlugin
$dn .= '+'.$attr.'='.ldap_escape_dn($this->$attr); $dn .= '+'.$attr.'='.ldap_escape_dn($this->$attr);
} }
$dn .= ','.$base; $dn .= ','.$base;
if ($dn == $this->orig_dn) { if (($dn == $this->orig_dn) || !$ldap->dn_exists($dn)) {
return $dn;
}
$ldap->cat($dn, array('dn'));
if (!$ldap->fetch()) {
return $dn; return $dn;
} }
} }
......
  • SonarQube analysis reported 1 issue

    • :no_entry_sign: 1 critical

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. :no_entry_sign: Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. :blue_book:

    By Ghost User on 2018-04-18T09:20:00 (imported from GitLab)

  • bmortier @bmortier

    mentioned in commit 855c6d20

    By Côme Chilliet on 2018-04-25T09:27:26 (imported from GitLab)

    ·

    mentioned in commit 855c6d20

    By Côme Chilliet on 2018-04-25T09:27:26 (imported from GitLab)

    Toggle commit list
  • bmortier @bmortier

    mentioned in merge request !249

    By Côme Chilliet on 2018-04-25T09:27:45 (imported from GitLab)

    ·

    mentioned in merge request !249

    By Côme Chilliet on 2018-04-25T09:27:45 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment