howardjones/network-weathermap

View on GitHub
lib/Weathermap/Core/ConfigReader.php

Summary

Maintainability
F
4 days
Test Coverage

File ConfigReader.php has 1559 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

<?php

namespace Weathermap\Core;

/**
Severity: Major
Found in lib/Weathermap/Core/ConfigReader.php - About 4 days to fix

    Function selfValidate has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        public function selfValidate()
        {
            $classes = array(
                'GLOBAL' => 'Weathermap\\Core\\Map',
                'LINK' => 'Weathermap\\Core\\MapLink',
    Severity: Minor
    Found in lib/Weathermap/Core/ConfigReader.php - About 4 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

    ConfigReader has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ConfigReader
    {
        private $lineCount = 0;
        /** @var MapDataItem $currentObject */
        private $currentObject = null;
    Severity: Minor
    Found in lib/Weathermap/Core/ConfigReader.php - About 3 hrs to fix

      Function parseString has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function parseString($input)
          {
              $output = array(); // Array of Output
              $cPhraseQuote = null; // Record of the quote that opened the current phrase
              $sPhrase = null; // Temp storage for the current phrase we are building
      Severity: Minor
      Found in lib/Weathermap/Core/ConfigReader.php - About 3 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 dumpKeywords has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          public function dumpKeywords()
          {
              $count = 0;
              print "# Complete configuration keyword list\n\n";
              foreach ($this->configKeywords as $scope => $keywords) {
      Severity: Minor
      Found in lib/Weathermap/Core/ConfigReader.php - About 3 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 handleNODES has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          private function handleNODES($fullcommand, $args, $matches)
          {
              $offsetDX = array();
              $offsetDY = array();
              $nodeNames = array();
      Severity: Minor
      Found in lib/Weathermap/Core/ConfigReader.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

      Method interpretNodeSpec has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function interpretNodeSpec($input)
          {
              $endOffset = 'C';
              $nodeName = $input;
              $xOffset = 0;
      Severity: Minor
      Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

        Method handleNODES has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function handleNODES($fullcommand, $args, $matches)
            {
                $offsetDX = array();
                $offsetDY = array();
                $nodeNames = array();
        Severity: Minor
        Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

          Method parseString has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function parseString($input)
              {
                  $output = array(); // Array of Output
                  $cPhraseQuote = null; // Record of the quote that opened the current phrase
                  $sPhrase = null; // Temp storage for the current phrase we are building
          Severity: Minor
          Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

            Method selfValidate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function selfValidate()
                {
                    $classes = array(
                        'GLOBAL' => 'Weathermap\\Core\\Map',
                        'LINK' => 'Weathermap\\Core\\MapLink',
            Severity: Minor
            Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

              Method handleSCALE has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function handleSCALE($fullcommand, $args, $matches)
                  {
              
                      // The default scale name is DEFAULT
                      if ($matches[1] == '') {
              Severity: Minor
              Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

                Method handleNODE_USESCALE has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function handleNODE_USESCALE($fullcommand, $args, $matches)
                    {
                        $svar = '';
                        $stype = 'percent';
                        // in or out?
                Severity: Minor
                Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

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

                      private function readConfigLine($args, $buffer)
                      {
                          $matches = null;
                  
                          if (!isset($args[0])) {
                  Severity: Minor
                  Found in lib/Weathermap/Core/ConfigReader.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

                  Method dumpKeywords has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function dumpKeywords()
                      {
                          $count = 0;
                          print "# Complete configuration keyword list\n\n";
                          foreach ($this->configKeywords as $scope => $keywords) {
                  Severity: Minor
                  Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

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

                        private function handleFONTDEFINE($fullcommand, $args, $matches)
                        {
                            if (isset($args[3])) {
                                MapUtility::debug("New TrueType font in slot %d\n", $args[1]);
                    
                    
                    Severity: Minor
                    Found in lib/Weathermap/Core/ConfigReader.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 readConfigLines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function readConfigLines($inputLines)
                        {
                            MapUtility::debug("in readConfigLines\n");
                    
                            foreach ($inputLines as $buffer) {
                    Severity: Minor
                    Found in lib/Weathermap/Core/ConfigReader.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 readConfigSimpleAssignment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function readConfigSimpleAssignment($keyword, $matches)
                        {
                            foreach ($keyword[1] as $key => $val) {
                                // so we can poke in numbers too, if the value starts with #
                                // then take the # off, and treat the rest as a number literal
                    Severity: Minor
                    Found in lib/Weathermap/Core/ConfigReader.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 handleSCALE has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function handleSCALE($fullcommand, $args, $matches)
                        {
                    
                            // The default scale name is DEFAULT
                            if ($matches[1] == '') {
                    Severity: Minor
                    Found in lib/Weathermap/Core/ConfigReader.php - About 35 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 interpretNodeSpec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function interpretNodeSpec($input)
                        {
                            $endOffset = 'C';
                            $nodeName = $input;
                            $xOffset = 0;
                    Severity: Minor
                    Found in lib/Weathermap/Core/ConfigReader.php - About 35 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 too many return statements within this method.
                    Open

                            return false;
                    Severity: Major
                    Found in lib/Weathermap/Core/ConfigReader.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return array($xOffset, $yOffset, $nodeName, $endOffset, false);
                      Severity: Major
                      Found in lib/Weathermap/Core/ConfigReader.php - About 30 mins to fix

                        Function handleNODE has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function handleNODE($fullcommand, $args, $matches)
                            {
                                $this->commitItem();
                                unset($this->currentObject);
                        
                        
                        Severity: Minor
                        Found in lib/Weathermap/Core/ConfigReader.php - About 25 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 handleTEMPLATE has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function handleTEMPLATE($fullcommand, $args, $matches)
                            {
                                $templateName = $matches[1];
                        
                                if (($this->currentType == 'NODE' && isset($this->mapObject->nodes[$templateName]))
                        Severity: Minor
                        Found in lib/Weathermap/Core/ConfigReader.php - About 25 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 handleLINK has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function handleLINK($fullcommand, $args, $matches)
                            {
                                $this->commitItem();
                                unset($this->currentObject);
                        
                        
                        Severity: Minor
                        Found in lib/Weathermap/Core/ConfigReader.php - About 25 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 handleSET has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function handleSET($fullcommand, $args, $matches)
                            {
                                global $weathermap_error_suppress;
                        
                                $key = null;
                        Severity: Minor
                        Found in lib/Weathermap/Core/ConfigReader.php - About 25 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 handleNODE_USESCALE has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function handleNODE_USESCALE($fullcommand, $args, $matches)
                            {
                                $svar = '';
                                $stype = 'percent';
                                // in or out?
                        Severity: Minor
                        Found in lib/Weathermap/Core/ConfigReader.php - About 25 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

                        Class "ConfigReader" has 30 methods, which is greater than 20 authorized. Split it into smaller classes.
                        Open

                        class ConfigReader

                        A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

                        Reduce the number of returns of this function 5, down to the maximum allowed 3.
                        Open

                            private function interpretNodeSpec($input)

                        Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function myFunction(){ // Noncompliant as there are 4 return statements
                          if (condition1) {
                            return true;
                          } else {
                            if (condition2) {
                              return false;
                            } else {
                              return true;
                            }
                          }
                          return false;
                        }
                        

                        Reduce the number of returns of this function 5, down to the maximum allowed 3.
                        Open

                            private function readConfigLine($args, $buffer)

                        Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function myFunction(){ // Noncompliant as there are 4 return statements
                          if (condition1) {
                            return true;
                          } else {
                            if (condition2) {
                              return false;
                            } else {
                              return true;
                            }
                          }
                          return false;
                        }
                        

                        Refactor this function to reduce its Cognitive Complexity from 22 to the 15 allowed.
                        Open

                            public function dumpKeywords()
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                        See

                        Refactor this function to reduce its Cognitive Complexity from 33 to the 15 allowed.
                        Open

                            public function selfValidate()
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                        See

                        Refactor this function to reduce its Cognitive Complexity from 46 to the 15 allowed.
                        Open

                            public function parseString($input)
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                        See

                        Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
                        Open

                            private function handleNODES($fullcommand, $args, $matches)
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

                        See

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleNODE_USESCALE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleCOLOR($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$args".
                        Open

                            private function handleARROWSTYLE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "DEFAULT" 11 times.
                        Open

                                if ($args[1] == 'DEFAULT') {
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove this commented out code.
                        Open

                                    # last_seen = 'broken';

                        Programmers should not comment out code as it bloats programs and reduces readability.

                        Unused code should be deleted and can be retrieved from source control history if required.

                        See

                        • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                        • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                        • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                        • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                        Remove the unused function parameter "$args".
                        Open

                            private function handleVIA($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleLINK($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$args".
                        Open

                            private function handleDEFINEOFFSET($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "originalX" 3 times.
                        Open

                                                'originalX' => 1,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "GLOBAL" 6 times.
                        Open

                            private $currentType = 'GLOBAL';
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "overlibcaption[OUT]" 3 times.
                        Open

                                                'overlibcaption[OUT]' => 1
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove the unused function parameter "$args".
                        Open

                            private function handleNODES($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$args".
                        Open

                            private function handleSET($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$matches".
                        Open

                            private function handleGLOBALCOLOR($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleARROWSTYLE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "OVERLIBGRAPH" 3 times.
                        Open

                                    'OVERLIBGRAPH' => array(
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "iconfile" 4 times.
                        Open

                                                'iconfile' => 1,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "labeloffset" 3 times.
                        Open

                                            array('labeloffset' => 1)
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleGLOBALCOLOR($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleTARGET($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleINCLUDE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "labelStyle" 6 times.
                        Open

                                                'labelStyle' => 'bits',
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "/^\s*NODE\s+(\S+)\s*$/i" 3 times.
                        Open

                                        array('/^\s*NODE\s+(\S+)\s*$/i', 'handleNODE'),
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleKEYSTYLE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleKEYPOS($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "handleNODE" 3 times.
                        Open

                                        array('/^\s*NODE\s+(\S+)\s*$/i', 'handleNODE'),
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "handleSET" 3 times.
                        Open

                                            'handleSET'
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "handleCOLOR" 22 times.
                        Open

                                            'handleCOLOR'
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleOVERLIB($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$args".
                        Open

                            private function handleSCALE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleTEMPLATE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$args".
                        Open

                            private function handleTEMPLATE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$matches".
                        Open

                            private function handleFONTDEFINE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$args".
                        Open

                            private function handleKEYPOS($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$args".
                        Open

                            private function handleINCLUDE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "handleGLOBALCOLOR" 8 times.
                        Open

                                            'handleGLOBALCOLOR'
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "notestext[OUT]" 3 times.
                        Open

                                                'notestext[OUT]' => 1
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "handleFONTDEFINE" 3 times.
                        Open

                                        array('/^\s*FONTDEFINE\s+(\d+)\s+(\S+)\s+(\d+)\s+(-?\d+)\s*$/i', 'handleFONTDEFINE'),
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "bwlabelformats[OUT]" 5 times.
                        Open

                                                'bwlabelformats[OUT]' => MapLink::FMT_BITS_OUT,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "/^\s*LINK\s+(\S+)\s*$/i" 3 times.
                        Open

                                        array('/^\s*LINK\s+(\S+)\s*$/i', 'handleLINK'),
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove this commented out code.
                        Open

                                    #}

                        Programmers should not comment out code as it bloats programs and reduces readability.

                        Unused code should be deleted and can be retrieved from source control history if required.

                        See

                        • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                        • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                        • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                        • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                        Define a constant instead of duplicating this literal "infourl[IN]" 3 times.
                        Open

                                                'infourl[IN]' => 1,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "notestext[IN]" 3 times.
                        Open

                                                'notestext[IN]' => 1,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleNODE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "positionRelativeTo" 3 times.
                        Open

                                                'positionRelativeTo' => 1,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "originalY" 3 times.
                        Open

                                                'originalY' => 2
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "bwlabelformats[IN]" 5 times.
                        Open

                                                'bwlabelformats[IN]' => MapLink::FMT_BITS_IN,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "overlibcaption[IN]" 3 times.
                        Open

                                                'overlibcaption[IN]' => 1,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove the unused function parameter "$matches".
                        Open

                            private function handleCOLOR($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleDEFINEOFFSET($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "maxValuesConfigured[IN]" 6 times.
                        Open

                                                'maxValuesConfigured[IN]' => 2,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "handleOVERLIB" 4 times.
                        Open

                                        array('/^OVERLIBGRAPH\s+(.+)$/i', 'handleOVERLIB')
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "maxValuesConfigured[OUT]" 6 times.
                        Open

                                                'maxValuesConfigured[OUT]' => 3,
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove this commented out code.
                        Open

                                    } #else {

                        Programmers should not comment out code as it bloats programs and reduces readability.

                        Unused code should be deleted and can be retrieved from source control history if required.

                        See

                        • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
                        • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
                        • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
                        • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleFONTDEFINE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$matches".
                        Open

                            private function handleTARGET($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Remove the unused function parameter "$fullcommand".
                        Open

                            private function handleSCALE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "usescale" 3 times.
                        Open

                                            array('usescale' => 1)
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "relativePositionResolved" 3 times.
                        Open

                                                'relativePositionResolved' => false
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Remove the unused function parameter "$args".
                        Open

                            private function handleKEYSTYLE($fullcommand, $args, $matches)

                        Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.

                        Noncompliant Code Example

                        function doSomething($a, $b) { // "$a" is unused
                          return compute($b);
                        }
                        

                        Compliant Solution

                        function doSomething($b) {
                          return compute($b);
                        }
                        

                        Exceptions

                        Functions in classes that override a class or implement interfaces are ignored.

                        class C extends B {
                        
                          function doSomething($a, $b) {     // no issue reported on $b
                            compute($a);
                          }
                        
                        }
                        

                        See

                        • MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
                        • MISRA C:2012, 2.7 - There should be no unused parameters in functions
                        • CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
                        • CERT, MSC12-CPP. - Detect and remove code that has no effect

                        Define a constant instead of duplicating this literal "INCLUDE" 3 times.
                        Open

                                    'INCLUDE' => array(
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "TARGET" 4 times.
                        Open

                                    'TARGET' => array(
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "infourl[OUT]" 3 times.
                        Open

                                                'infourl[OUT]' => 1
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "handleINCLUDE" 3 times.
                        Open

                                        array('/^\s*INCLUDE\s+(.*)\s*$/i', 'handleINCLUDE'),
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "/^\s*INCLUDE\s+(.*)\s*$/i" 3 times.
                        Open

                                        array('/^\s*INCLUDE\s+(.*)\s*$/i', 'handleINCLUDE'),
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "iconscaleh" 3 times.
                        Open

                                                'iconscaleh' => '#0'
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "iconscalew" 3 times.
                        Open

                                                'iconscalew' => '#0',
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "handleLINK" 3 times.
                        Open

                                        array('/^\s*LINK\s+(\S+)\s*$/i', 'handleLINK'),
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        Define a constant instead of duplicating this literal "width" 3 times.
                        Open

                                            array('width' => 1)
                        Severity: Critical
                        Found in lib/Weathermap/Core/ConfigReader.php by sonar-php

                        Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

                        On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

                        Noncompliant Code Example

                        With the default threshold of 3:

                        function run() {
                          prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
                          execute('action1');
                          release('action1');
                        }
                        

                        Compliant Solution

                        ACTION_1 = 'action1';
                        
                        function run() {
                          prepare(ACTION_1);
                          execute(ACTION_1);
                          release(ACTION_1);
                        }
                        

                        Exceptions

                        To prevent generating some false-positives, literals having less than 5 characters are excluded.

                        There are no issues that match your filters.

                        Category
                        Status