mambax7/cardealer

View on GitHub

Showing 664 of 664 total issues

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

                $partArray['edit_delete']
                                      = "<a href='part.php?op=edit&partnum=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a>
               <a href='part.php?op=delete&partnum=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a>
               <a href='part.php?op=clone&partnum=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>";
Severity: Major
Found in admin/part.php and 6 other locations - About 2 hrs to fix
admin/customer.php on lines 161..164
admin/service.php on lines 167..170
admin/servpart.php on lines 169..171
admin/vehicle.php on lines 200..202
admin/workorder.php on lines 178..180
admin/workserv.php on lines 163..165

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

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

    public function __construct($target)
    {
        global $helper;
        $this->targetObject = $target;

Severity: Minor
Found in class/Form/PartForm.php - About 1 hr to fix

    Function xcopy has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function xcopy($source, $dest)
        {
            // Check for symlinks
            if (is_link($source)) {
                return symlink(readlink($source), $dest);
    Severity: Minor
    Found in class/Common/FilesManagement.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 __construct has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct($target)
        {
            global $helper;
            $this->targetObject = $target;
    
    
    Severity: Minor
    Found in class/Form/VehicleForm.php - About 1 hr to fix

      Method xoops_module_install_cardealer has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_install_cardealer(\XoopsModule $module)
      {
          $moduleDirName = basename(dirname(__DIR__));
      
          /** @var Cardealer\Helper $helper */
      Severity: Minor
      Found in include/oninstall.php - About 1 hr to fix

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

            public static function metaKeywords($content)
            {
                global $xoopsTpl, $xoTheme;
                $myts    = \MyTextSanitizer::getInstance();
                $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
        Severity: Major
        Found in class/Utility.php and 1 other location - About 1 hr to fix
        class/Utility.php on lines 107..117

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

        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

            public static function metaDescription($content)
            {
                global $xoopsTpl, $xoTheme;
                $myts    = \MyTextSanitizer::getInstance();
                $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
        Severity: Major
        Found in class/Utility.php and 1 other location - About 1 hr to fix
        class/Utility.php on lines 92..102

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

        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 rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function rrmdir($src)
            {
                // Only continue if user is a 'global' Admin
                if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                    return false;
        Severity: Minor
        Found in class/Common/FilesManagement.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 getServerStats has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getServerStats()
            {
                $moduleDirName      = basename(dirname(dirname(__DIR__)));
                $moduleDirNameUpper = strtoupper($moduleDirName);
                xoops_loadLanguage('common', $moduleDirName);
        Severity: Minor
        Found in class/Common/ServerStats.php - About 1 hr to fix

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

              public function __construct($target)
              {
                  global $helper;
                  $this->targetObject = $target;
          
          
          Severity: Minor
          Found in class/Form/ServiceForm.php - About 1 hr to fix

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

                public function __construct($target)
                {
                    global $helper;
                    $this->targetObject = $target;
            
            
            Severity: Minor
            Found in class/Form/CustomerForm.php - About 1 hr to fix

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

                  public static function deleteDirectory($src)
                  {
                      // Only continue if user is a 'global' Admin
                      if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                          return false;
              Severity: Minor
              Found in class/Common/FilesManagement.php - About 1 hr to fix

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

                    public function __construct($target)
                    {
                        global $helper;
                        $this->targetObject = $target;
                
                
                Severity: Minor
                Found in class/Form/WorkorderForm.php - About 1 hr to fix

                  Each class must be in a namespace of at least one level (a top-level vendor name)
                  Open

                  class CardealerCorePreload extends XoopsPreloadItem
                  Severity: Minor
                  Found in preloads/core.php by phpcodesniffer

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

                  function xoops_module_install_cardealer(\XoopsModule $module)
                  {
                      $moduleDirName = basename(dirname(__DIR__));
                  
                      /** @var Cardealer\Helper $helper */
                  Severity: Minor
                  Found in include/oninstall.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 rmove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function rmove($src, $dest)
                      {
                          // Only continue if user is a 'global' Admin
                          if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                              return false;
                  Severity: Minor
                  Found in class/Common/FilesManagement.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 rcopy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function rcopy($src, $dest)
                      {
                          // Only continue if user is a 'global' Admin
                          if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                              return false;
                  Severity: Minor
                  Found in class/Common/FilesManagement.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

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

                          if ($serviceTempRows > $servicePaginationLimit) {
                              xoops_load('XoopsPageNav');
                  
                              $pagenav = new \XoopsPageNav($serviceTempRows, $servicePaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
                              $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
                  Severity: Major
                  Found in admin/service.php and 6 other locations - About 50 mins to fix
                  admin/customer.php on lines 127..132
                  admin/part.php on lines 147..152
                  admin/servpart.php on lines 129..134
                  admin/vehicle.php on lines 149..154
                  admin/workorder.php on lines 131..136
                  admin/workserv.php on lines 128..133

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

                  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 7 locations. Consider refactoring.
                  Open

                          if ($workorderTempRows > $workorderPaginationLimit) {
                              xoops_load('XoopsPageNav');
                  
                              $pagenav = new \XoopsPageNav($workorderTempRows, $workorderPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
                              $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
                  Severity: Major
                  Found in admin/workorder.php and 6 other locations - About 50 mins to fix
                  admin/customer.php on lines 127..132
                  admin/part.php on lines 147..152
                  admin/service.php on lines 128..133
                  admin/servpart.php on lines 129..134
                  admin/vehicle.php on lines 149..154
                  admin/workserv.php on lines 128..133

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

                  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 7 locations. Consider refactoring.
                  Open

                          if ($workservTempRows > $workservPaginationLimit) {
                              xoops_load('XoopsPageNav');
                  
                              $pagenav = new \XoopsPageNav($workservTempRows, $workservPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . '');
                              $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : '');
                  Severity: Major
                  Found in admin/workserv.php and 6 other locations - About 50 mins to fix
                  admin/customer.php on lines 127..132
                  admin/part.php on lines 147..152
                  admin/service.php on lines 128..133
                  admin/servpart.php on lines 129..134
                  admin/vehicle.php on lines 149..154
                  admin/workorder.php on lines 131..136

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language