XoopsModules25x/mylinks

View on GitHub

Showing 370 of 370 total issues

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

    if($o<128)
    {
      //ASCII
      $l+=$cw[$c];
      $n=1;
Severity: Major
Found in fpdf/japanese.php and 1 other location - About 1 hr to fix
fpdf/japanese.php on lines 161..182

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 104.

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

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

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

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

Refactorings

Further Reading

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

    if($o<128)
    {
      //ASCII
      $l+=$cw[$c];
      $n=1;
Severity: Major
Found in fpdf/japanese.php and 1 other location - About 1 hr to fix
fpdf/japanese.php on lines 262..283

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 104.

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 b_waiting_mylinks has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function b_waiting_mylinks()
{
    $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
    $ret     = array();

Severity: Minor
Found in extras/waiting/plugins/mylinks.php - About 1 hr to fix

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

    function getTotalItems($sel_id = null, $status = '', $oper = '>')
    {
        $sel_id = filter_var($sel_id, FILTER_VALIDATE_INT, array('options' => array('default' => 0, 'min_range' => 0)));
        $count  = 0;
        $arr    = array();
    Severity: Minor
    Found in include/functions.php - About 1 hr to fix

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

      function mylinks_feednew($limit = 0, $offset = 0)
      {
          global $xoopsDB;
      
          $myts      = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in include/feeddata.inc.php - About 1 hr to fix

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

        function convertorderbytrans($orderby)
        {
            $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
            switch ($orderby) {
                case 'title ASC':
        Severity: Minor
        Found in include/functions.php - About 1 hr to fix

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

          function convertorderbyout($orderby)
          {
              $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
              switch ($orderby) {
                  case 'title ASC':
          Severity: Minor
          Found in include/functions.php - About 1 hr to fix

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

            function ml_wfd_letters()
            {
                global $xoopsDB, $xoopsModule;
            
                xoops_loadLanguage('main', $xoopsModule->getVar('dirname'));
            Severity: Minor
            Found in include/functions.php - About 1 hr to fix

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

                  public function _compareseq($xoff, $xlim, $yoff, $ylim)
                  {
                      /* Slide down the bottom initial diagonal. */
                      while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff]) {
                          ++$xoff;
              Severity: Minor
              Found in class/Text_Diff.php - About 1 hr to fix

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

                function convertorderbyin($orderby)
                {
                    $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
                    switch ($orderby) {
                        case 'titleA':
                Severity: Minor
                Found in include/functions.php - About 1 hr to fix

                  Method mix has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function mix($a, $b, $c)
                  {
                      $a -= $b;
                      $a -= $c;
                      $a ^= zeroFill($c, 13);
                  Severity: Minor
                  Found in bookmark.php - About 1 hr to fix

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

                    function MakeWidthArray($fm)
                    {
                      //Make character width array
                      $s="array(\n\t";
                      $cw=$fm['Widths'];
                    Severity: Minor
                    Found in fpdf/font/makefont/makefont.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 _putinfo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function _putinfo()
                    {
                      $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
                      if(!empty($this->title))
                        $this->_out('/Title '.$this->_textstring($this->title));
                    Severity: Minor
                    Found in fpdf/fpdf.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 copy_templates_db2db has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function copy_templates_db2db($tplset_from, $tplset_to, $whr_append = '1')
                    {
                        global $db;
                    
                        // get tplfile and tplsource
                    Severity: Minor
                    Found in admin/mytplsadmin.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 convertorderbyin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function convertorderbyin($orderby)
                    {
                        $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
                        switch ($orderby) {
                            case 'titleA':
                    Severity: Minor
                    Found in include/functions.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 convertorderbytrans has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function convertorderbytrans($orderby)
                    {
                        $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
                        switch ($orderby) {
                            case 'title ASC':
                    Severity: Minor
                    Found in include/functions.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 convertorderbyout has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function convertorderbyout($orderby)
                    {
                        $orderby = (isset($orderby) && ('' != trim($orderby))) ? trim($orderby) : '';
                        switch ($orderby) {
                            case 'title ASC':
                    Severity: Minor
                    Found in include/functions.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 _loadAllChildItemIds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _loadAllChildItemIds($itemId, &$childIds)
                        {
                            if (!empty($this->_itemTree[$itemId]['children'])) {
                                $first_child = $this->_itemTree[$itemId]['children'];
                                foreach ($first_child as $fcid) {
                    Severity: Minor
                    Found in admin/mygrouppermform.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 check_browser_can_use_spaw has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function check_browser_can_use_spaw()
                    {
                        $browser = $_SERVER['HTTP_USER_AGENT'];
                        // check if msie
                        if (preg_match('/MSIE[^;]*/i', $browser, $msie)) {
                    Severity: Minor
                    Found in admin/myblockform.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 renderSelect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function renderSelect($showbutton = false)
                        {
                            if ($this->total < $this->perpage) {
                                return;
                            }
                    Severity: Minor
                    Found in class/mylinkspagenav.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

                    Severity
                    Category
                    Status
                    Source
                    Language