howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

Function getConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getConfig()
    {
        assert(isset($this->owner));

        $output = '';
Severity: Minor
Found in lib/Weathermap/Core/Legend.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 copyParamsFromCacti has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function copyParamsFromCacti($profileName, $hostId)
    {
        $params = array();

        foreach ($this->snmpParamDefaults as $keyname => $default) {
Severity: Minor
Found in lib/Weathermap/Plugins/Datasources/SNMP3.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 drawViaOverlay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function drawViaOverlay($imageRef, $overlayColor)
    {
        foreach ($this->links as $link) {
            foreach ($link->viaList as $via) {
                if (isset($via[2])) {
Severity: Minor
Found in lib/Weathermap/Core/Map.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 writeImageFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function writeImageFile($imageFileName, $imageRef)
    {
        $extension = strtolower(substr($imageFileName, -4, 4));

        $types = array(
Severity: Minor
Found in lib/Weathermap/Core/Map.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 getMapTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getMapTitle($fileName)
    {
        $title = "";
        $fileHandle = fopen($fileName, "r");
        if ($fileHandle) {
Severity: Minor
Found in lib/Weathermap/Tests/TestSupport.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

Function getConfigValue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getConfigValue($keyname)
    {
        if (isset($this->config[$keyname])) {
            return array($this->config[$keyname], self::CONF_FOUND_DIRECT);
        }
Severity: Minor
Found in lib/Weathermap/Core/MapBase.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 calculateScaleColours has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function calculateScaleColours()
    {
        $channels = $this->getChannelList();

        $scale = $this->owner->getScale($this->usescale);
Severity: Minor
Found in lib/Weathermap/Core/MapDataItem.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 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 setPropSub has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setPropSub($which, $what, $where)
    {
        $count = 0;
        foreach ($this->shapes as $shape) {
            if (($where == '') || (strstr($shape->name, $where) != false)) {
Severity: Minor
Found in lib/Weathermap/Core/HTMLImagemap.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 cloneNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function cloneNode($sourceNodeName, $targetName = "", $orFail = false)
    {
        if (!$this->isLoaded()) {
            throw new WeathermapInternalFail("Map must be loaded before editing API called.");
        }
Severity: Minor
Found in lib/Weathermap/Editor/Editor.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 scaleImage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function scaleImage($scaleWidth, $scaleHeight, $iconImageRef)
    {
        $iconWidth = imagesx($iconImageRef);
        $iconHeight = imagesy($iconImageRef);

Severity: Minor
Found in lib/Weathermap/Core/ImageLoader.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 setEndNodes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setEndNodes($node1, $node2)
    {
        if (null !== $node1 && null === $node2) {
            throw new WeathermapInternalFail('PartiallyRealLink');
        }
Severity: Minor
Found in lib/Weathermap/Core/MapLink.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 getTitleFromConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getTitleFromConfig($filename, $defaultTitle = "")
    {
        $title = "";

        $fileHandle = fopen($filename, "r");
Severity: Minor
Found in lib/Weathermap/Editor/EditorUI.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 previewConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function previewConfig(
        $file
    ) {
        chdir($this->configPath);

Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.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 handleMapSettingsSave has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleMapSettingsSave(
        $request,
        $appObject
    ) {
        $mapid = null;
Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.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 null;
Severity: Major
Found in lib/Weathermap/Core/Legend.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return false;
    Severity: Major
    Found in lib/Weathermap/Plugins/Datasources/CactiDSStats.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $this->drawLegendClassic(true);
      Severity: Major
      Found in lib/Weathermap/Core/Legend.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $this->getLink($itemname);
        Severity: Major
        Found in lib/Weathermap/Core/Map.php - About 30 mins to fix
          Severity
          Category
          Status
          Source
          Language