howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

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

    private function drawLabel(&$map, $textPoint, $backgroundColour, $nodeImageRef, $labelBox)
    {
        MapUtility::debug("Label colour is $backgroundColour\n");

        // if there's an icon, then you can choose to have no background
Severity: Minor
Found in lib/Weathermap/Core/MapNode.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function 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

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

    private function checkPaths()
    {
        $version = explode('.', PHP_VERSION);
        self::$phpTag = "php-" . $version[0] . "." . $version[1];

Severity: Minor
Found in lib/Weathermap/Tests/ConfigTest.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public static function simplifyOffset($xOffset, $yOffset)
    {
        if ($xOffset == 0 && $yOffset == 0) {
            return "";
        }
Severity: Minor
Found in lib/Weathermap/Editor/Editor.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public function preCalculate(&$map)
    {
        MapUtility::debug('Link ' . $this->name . ": Calculating geometry.\n");

        // don't bother doing anything if it's a template
Severity: Minor
Found in lib/Weathermap/Core/MapLink.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public function run()
    {
        if (!$this->preChecks()) {
            return false;
        }
Severity: Minor
Found in lib/Weathermap/Poller/MapRuntime.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    private function processStringFindReferredObject(&$context, $itemname, $type)
    {
        if (($itemname == "this") && ($type == strtolower($context->myType()))) {
            return $context;
        }
Severity: Minor
Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

function weathermap_page_title($t)
{
    if (preg_match('/plugins\/weathermap\//', $_SERVER['REQUEST_URI'], $matches)) {
        $t .= " - Weathermap";

Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public function handleDefaultView($request, $appObject)
    {
        global $wm_showOldUI, $config;

        $weathermapPath = $config['url_path'] . 'plugins/weathermap/';
Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

function weathermap_page_title($t)
{
    if (preg_match('/plugins\/weathermap\//', $_SERVER['REQUEST_URI'], $matches)) {
        $t .= " - Weathermap";

Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/cacti10-plugin-hooks.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 get_cidr has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function get_cidr($mask)
{
    $lookup = array(
        "255.255.255.255" => "32",
        "255.255.255.254" => "31",
Severity: Minor
Found in random-bits/cacti-mapper.php - About 1 hr to fix

    Method warn has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function warn($string, $noticeOnly = false)
        {
            global $weathermap_map;
            global $weathermap_warncount;
            global $weathermap_error_suppress;
    Severity: Minor
    Found in lib/Weathermap/Core/MapUtility.php - About 1 hr to fix

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

        render() {
          return <div className='wm-create-map-container wm-popup'>
            <h3>Create a new map</h3>
            <p>Map name: <input type="text"/></p>
            <p>source map: <Selector id="sourceselector"
      Severity: Minor
      Found in websrc/cacti-mgmt/src/components/CreateMap.js - About 1 hr to fix

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

            public function selfValidate()
            {
                $result = true;
        
                foreach ($this->types as $type => $validator) {
        Severity: Minor
        Found in lib/Weathermap/UI/UIBase.php - About 1 hr to fix

          Method prepareForDataCollection has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function prepareForDataCollection()
              {
                  /** @var Target $target */
                  foreach ($this->targets as $target) {
                      MapUtility::debug("ProcessTargets: New Target: $target\n");
          Severity: Minor
          Found in lib/Weathermap/Core/MapDataItem.php - About 1 hr to fix

            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

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

                  public function findIndexNearDistance($targetDistance)
                  {
                      $left = 0;
                      $right = count($this->elements) - 1;
              
              
              Severity: Minor
              Found in lib/Weathermap/Core/Spine.php - About 1 hr to fix

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

                    private function calculateAICONColours($labelColour, &$map)
                    {
                        $finalFillColour = new Colour('none');
                        $finalInkColour = new Colour('none');
                
                
                Severity: Minor
                Found in lib/Weathermap/Core/MapNode.php - About 1 hr to fix

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

                      public function init(&$map)
                      {
                          global $config;
                  
                          if ($map->context == 'cacti') {
                  Severity: Minor
                  Found in lib/Weathermap/Plugins/Datasources/RRDTool.php - About 1 hr to fix

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

                        public static function formatTimeTicks($value, $prefix, $tokenCharacter, $precision)
                        {
                            $joinCharacter = ' ';
                            if ($prefix == '-') {
                                $joinCharacter = '';
                    Severity: Minor
                    Found in lib/Weathermap/Core/StringUtility.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language