Showing 599 of 599 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    private function mkSupportContacts() {
        $url = (!empty($this->attributes['support:url'][0])) ? $this->attributes['support:url'][0] : $this->support_url_substitute;
        $email = (!empty($this->attributes['support:email'][0])) ? $this->attributes['support:email'][0] : $this->support_email_substitute;
        return ['url'=>$url, 'email'=>$email];
    }   
Severity: Minor
Found in devices/linux/DeviceLinux.php and 1 other location - About 45 mins to fix
devices/linux/DeviceLinuxSh.php on lines 265..269

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if (\config\Master::MAILSETTINGS['user'] === NULL && \config\Master::MAILSETTINGS['pass'] === NULL) {
            $mail->SMTPAuth = false;
        } else {
            $mail->SMTPAuth = true;
            $mail->Username = \config\Master::MAILSETTINGS['user'];
Severity: Minor
Found in core/SanityTests.php and 1 other location - About 45 mins to fix
core/common/OutsideComm.php on lines 79..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    private function mkSupportContacts() {
        $url = (!empty($this->attributes['support:url'][0])) ? $this->attributes['support:url'][0] : $this->support_url_substitute;
        $email = (!empty($this->attributes['support:email'][0])) ? $this->attributes['support:email'][0] : $this->support_email_substitute;
        return ['url'=>$url, 'email'=>$email];
    }
Severity: Minor
Found in devices/linux/DeviceLinuxSh.php and 1 other location - About 45 mins to fix
devices/linux/DeviceLinux.php on lines 262..266

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if (\config\Master::MAILSETTINGS['user'] === NULL && \config\Master::MAILSETTINGS['pass'] === NULL) {
            $mail->SMTPAuth = false;
        } else {
            $mail->SMTPAuth = true;
            $mail->Username = \config\Master::MAILSETTINGS['user'];
Severity: Minor
Found in core/common/OutsideComm.php and 1 other location - About 45 mins to fix
core/SanityTests.php on lines 964..970

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 96.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function divOtherinstallers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function divOtherinstallers() {
        $retval = "
<div class='sub_h'>
    <div id='other_installers'>".$this->Gui->textTemplates->templates[user\DOWNLOAD_CHOOSE]."
        <table id='device_list' style='padding:0px;'>";
Severity: Minor
Found in web/skins/modern/Divs.php - About 45 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 string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function string($input, $allowWhitespace = FALSE)
    {
        // always chop out invalid characters, and surrounding whitespace
        $retvalStep0 = iconv("UTF-8", "UTF-8//TRANSLIT", $input);
        if ($retvalStep0 === FALSE) {
Severity: Minor
Found in web/lib/common/InputValidation.php - About 45 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

Avoid deeply nested control flow statements.
Open

                    if ($oneLine === FALSE) {
                        break;
                    }
Severity: Major
Found in web/admin/edit_silverbullet.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if ($number === FALSE) { // invalid input received, default to sane
                            $number = 5;
                        }
    Severity: Major
    Found in web/admin/edit_silverbullet.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if ($retval["SENT"]) {
                                  $additionalInfo["EMAIL TRANSPORT SECURE"] = $retval["TRANSPORT"];
                              }
      Severity: Major
      Found in web/admin/API.php - About 45 mins to fix

        Function selectElement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function selectElement($rowid, $list)
            {
                $jsmagic = "onchange='
                                       if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) {
                                           document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\";
        Severity: Minor
        Found in web/lib/admin/OptionDisplay.php - About 45 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 consentBlock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function consentBlock()
            {
                \core\common\Entity::intoThePotatoes();
                if (isset($this->attributes['support:info_file'])) {
                    return MobileconfigSuperclass::BUFFER_CONSENT_PRE . htmlspecialchars(iconv("UTF-8", "UTF-8//TRANSLIT", $this->attributes['support:info_file'][0]), ENT_XML1, 'UTF-8') . MobileconfigSuperclass::BUFFER_CONSENT_POST;
        Severity: Minor
        Found in devices/apple_mobileconfig/MobileconfigSuperclass.php - About 45 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

        Avoid deeply nested control flow statements.
        Open

                            if (count($elements) < 2) {
                                break;
                            }
        Severity: Major
        Found in web/admin/edit_silverbullet.php - About 45 mins to fix

          Function combineLogo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function combineLogo($logos = NULL, $fedLogo = NULL)
              {
                  // maximum size to which we want to resize the logos
          
                  $maxSize = 120;
          Severity: Minor
          Found in devices/ms/WindowsCommon.php - About 45 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 getAuthMethodsList has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getAuthMethodsList() {
                  $methodList = [];
                  if ($this->allEaps) {
                      $eapmethods = [];
                      foreach ($this->attributes['all_eaps'] as $eap) {
          Severity: Minor
          Found in devices/eap_config/DeviceXML.php - About 45 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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct()
              {
                  $this->databaseType = "INST";
                  parent::__construct();
                  $this->rootPem = file_get_contents(CertificationAuthorityEmbeddedRSA::LOCATION_ROOT_CA);
          Severity: Minor
          Found in core/CertificationAuthorityEmbeddedRSA.php - About 45 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

          Method generateInstaller has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function generateInstaller($device, $profileId, $generatedFor = "user", $openRoaming = 0, $token = NULL, $password = NULL)
          Severity: Minor
          Found in core/UserAPI.php - About 45 mins to fix

            Method generateWlanProfile has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private function generateWlanProfile($networkName, $ssids, $authentication, $encryption, $ois, $hs20 = false)
            Severity: Minor
            Found in devices/ms/DeviceW8W10.php - About 45 mins to fix

              Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function __construct($database)
                  {
                      $this->loggerInstance = new \core\common\Logging();
                      $databaseCapitalised = strtoupper($database);
                      if (isset(\config\Master::DB[$databaseCapitalised])) {
              Severity: Minor
              Found in core/DBConnection.php - About 45 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

              Method downloadInstaller has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function downloadInstaller($device, $prof_id, $generated_for = 'user', $openRoaming = 0, $token = NULL, $password = NULL)
              Severity: Minor
              Found in core/UserAPI.php - About 45 mins to fix

                Function getInstallerBasename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getInstallerBasename()
                    {
                        $baseName = $this->customTranslit(\config\ConfAssistant::CONSORTIUM['name'])."-".$this->getDeviceId();
                        if (isset($this->attributes['profile:customsuffix'][1])) {
                            // this string will end up as a filename on a filesystem, so always
                Severity: Minor
                Found in core/DeviceConfig.php - About 45 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