XoopsModules25x/mylinks

View on GitHub

Showing 370 of 370 total issues

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

function gif_outputAsPng($gif, $lpszFileName, $bgColor = -1)
{
  if(!isSet($gif) || (@get_class($gif) <> 'cgif') || !$gif->loaded() || ($lpszFileName == '')) {
    return false;
  }
Severity: Major
Found in fpdf/gif.php and 1 other location - About 5 hrs to fix
fpdf/gif.php on lines 33..52

Duplicated Code

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

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

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

Tuning

This issue has a mass of 188.

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

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

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

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

Refactorings

Further Reading

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

    while ($row = $xoopsDB->fetchArray($result)) {
        $ret[$i]['link']     = "{$moduleURL}/singlelink.php?lid={$row['lid']}";
        $ret[$i]['cat_link'] = "{$moduleURL}/viewcat.php?cid={$row['cid']}";
        $ret[$i]['title']    = $row['ltitle'];
        $ret[$i]['time']     = $row['date'];
Severity: Major
Found in include/data.inc.php and 1 other location - About 5 hrs to fix
include/feeddata.inc.php on lines 32..44

Duplicated Code

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

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

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

Tuning

This issue has a mass of 188.

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

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

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

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

Refactorings

Further Reading

Function diff has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function diff($from_lines, $to_lines)
    {
        $n_from = count($from_lines);
        $n_to   = count($to_lines);

Severity: Minor
Found in class/Text_Diff.php - About 5 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

File korean.php has 378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
if (!defined('XOOPS_ROOT_PATH')) {
  die('XOOPS root path not defined');
}

Severity: Minor
Found in fpdf/korean.php - About 5 hrs to fix

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

      function LZWCommand(&$data, $bInit)
      {
        if($bInit) {
          $this->SetCodeSize = ord($data{0});
          $data = substr($data, 1);
    Severity: Minor
    Found in fpdf/gif.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

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

    function Image($file,$x,$y,$w=0,$h=0,$type='',$link='')
    {
      //Put an image on the page
      if(!isset($this->images[$file]))
      {
    Severity: Minor
    Found in fpdf/fpdf.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

    File makefont.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    * Utility to generate font definition files                                    *
    * Version: 1.13                                                                *
    * Date:    2004-12-31                                                          *
    Severity: Minor
    Found in fpdf/font/makefont/makefont.php - About 4 hrs to fix

      Function myblocksadmin_update_block has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      function myblocksadmin_update_block(
          $bid,
          $bside,
          $bweight,
          $bvisible,
      Severity: Minor
      Found in include/blocksadmin.inc.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

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

      function AddCIDFont($family,$style,$name,$cw,$CMap,$registry)
      {
        $fontkey=strtolower($family).strtoupper($style);
        if(isset($this->fonts[$fontkey]))
          $this->Error("Font already added: $family $style");
      Severity: Major
      Found in fpdf/chinese.php and 1 other location - About 4 hrs to fix
      fpdf/korean.php on lines 21..29

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 176.

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

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

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

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

      Refactorings

      Further Reading

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

      function AddCIDFont($family,$style,$name,$cw,$CMap,$registry)
      {
        $fontkey=strtolower($family).strtoupper($style);
        if(isset($this->fonts[$fontkey]))
          $this->Error("Font already added: $family $style");
      Severity: Major
      Found in fpdf/korean.php and 1 other location - About 4 hrs to fix
      fpdf/chinese.php on lines 32..40

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 176.

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

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

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

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

      Refactorings

      Further Reading

      Function Output has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

      function Output($name='',$dest='')
      {
        //Output PDF to some destination
        //Finish document if necessary
        if($this->state<3)
      Severity: Minor
      Found in fpdf/fpdf.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

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

                  while ($counter <= $total_pages) {
                      if ($counter == $current_page) {
                          $ret .= '<td class="pagact"><b>' . $counter . '</b></td>';
                      } elseif (($counter > $current_page - $offset && $counter < $current_page + $offset) || $counter == 1
                                || $counter == $total_pages
      Severity: Major
      Found in class/mylinkspagenav.php and 1 other location - About 4 hrs to fix
      class/mylinkspagenav.php on lines 50..65

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 172.

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

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

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

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

      Refactorings

      Further Reading

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

                  while ($counter <= $total_pages) {
                      if ($counter == $current_page) {
                          $ret .= '<strong>(' . $counter . ')</strong> ';
                      } elseif (($counter > $current_page - $offset && $counter < $current_page + $offset) || $counter == 1
                                || $counter == $total_pages
      Severity: Major
      Found in class/mylinkspagenav.php and 1 other location - About 4 hrs to fix
      class/mylinkspagenav.php on lines 128..143

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 172.

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

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

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

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

      Refactorings

      Further Reading

      Method MakeFont has 107 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function MakeFont($fontfile,$afmfile,$enc='cp1252',$patch=array(),$type='TrueType')
      {
        //Generate a font definition file
        set_magic_quotes_runtime(0);
        ini_set('auto_detect_line_endings','1');
      Severity: Major
      Found in fpdf/font/makefont/makefont.php - About 4 hrs to fix

        Function MBWrite has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        function MBWrite($h,$txt,$link)
        {
          //Multi-byte version of Write()
          $cw=&$this->CurrentFont['cw'];
          $w=$this->w-$this->rMargin-$this->x;
        Severity: Minor
        Found in fpdf/chinese.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

        Function MBWrite has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        function MBWrite($h,$txt,$link)
        {
          //Multi-byte version of Write()
          $cw=&$this->CurrentFont['cw'];
          $w=$this->w-$this->rMargin-$this->x;
        Severity: Minor
        Found in fpdf/korean.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

        Function AddFont has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        function AddFont($family,$style='',$file='')
        {
          //Add a TrueType or Type1 font
          $family=strtolower($family);
          if($file=='')
        Severity: Minor
        Found in fpdf/fpdf.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

        Function render has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

            public function render($diff)
            {
                $xi      = $yi = 1;
                $block   = false;
                $context = array();
        Severity: Minor
        Found in class/Text_Diff_Renderer.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

        Method MultiCell has 104 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function MultiCell($w,$h,$txt,$border=0,$align='J',$fill=0)
        {
          //Output text with automatic or explicit line breaks
          $cw=&$this->CurrentFont['cw'];
          if($w==0)
        Severity: Major
        Found in fpdf/fpdf.php - About 4 hrs to fix

          Method _putfonts has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function _putfonts()
          {
            $nf=$this->n;
            foreach($this->diffs as $diff)
            {
          Severity: Major
          Found in fpdf/fpdf.php - About 4 hrs to fix
            Severity
            Category
            Status
            Source
            Language