CORE-POS/IS4C

View on GitHub

Showing 8,297 of 8,298 total issues

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

    public function report_description_content()
    {
        if ($this->report_format != 'html') {
            return array();
        }
Severity: Major
Found in fannie/reports/DDD/SmartDDDReport.php and 3 other locations - About 1 day to fix
fannie/reports/DepartmentMovement/ReducedMovementReport.php on lines 41..95
fannie/reports/DepartmentMovement/SmartMovementReport.php on lines 50..104
fannie/reports/Trends/TrendsReport.php on lines 40..90

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

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

    public function report_description_content()
    {
        if ($this->report_format != 'html') {
            return array();
        }
Severity: Major
Found in fannie/reports/Trends/TrendsReport.php and 3 other locations - About 1 day to fix
fannie/reports/DDD/SmartDDDReport.php on lines 47..101
fannie/reports/DepartmentMovement/ReducedMovementReport.php on lines 41..95
fannie/reports/DepartmentMovement/SmartMovementReport.php on lines 50..104

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

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

    public function report_description_content()
    {
        if ($this->report_format != 'html') {
            return array();
        }
Severity: Major
Found in fannie/reports/DepartmentMovement/SmartMovementReport.php and 3 other locations - About 1 day to fix
fannie/reports/DDD/SmartDDDReport.php on lines 47..101
fannie/reports/DepartmentMovement/ReducedMovementReport.php on lines 41..95
fannie/reports/Trends/TrendsReport.php on lines 40..90

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

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

    public function fetch_report_data()
    {
        $class_lib = $this->class_lib;
        $dbc = $class_lib::getDB();
        
Severity: Major
Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php - About 1 day to fix

    File HouseCouponEditor.php has 721 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2012 Whole Foods Co-op
    
    
    Severity: Major
    Found in fannie/modules/plugins2.0/HouseCoupon/HouseCouponEditor.php - About 1 day to fix

      Function monthView has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function monthView($id,$month,$year,$uid)
          {
              global $FANNIE_OP_DB;
              $DAY_NAMES = self::$DAY_NAME_MAPPING;
      
      
      Severity: Minor
      Found in fannie/modules/plugins2.0/CalendarPlugin/CalendarPluginDisplayLib.php - About 1 day 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 body_content has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
      Open

          function body_content(){
              global $FANNIE_OP_DB,$FANNIE_PLUGIN_SETTINGS;
              $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
      
              $emp_no = (int) $this->emp_no;
      Severity: Minor
      Found in fannie/modules/plugins2.0/TimesheetPlugin/admin/TsAdminView.php - About 1 day 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 post_id_handler has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
      Open

          public function post_id_handler()
          {
              global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_ARCHIVE_DB;
              $dbc = FannieDB::get($FANNIE_OP_DB);
      
      
      Severity: Minor
      Found in fannie/modules/plugins2.0/StatementsPlugin/StatementsPluginEmail.php - About 1 day 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 4 locations. Consider refactoring.
      Open

          function prevRow(elem) {
              var myRow = $(elem).closest('tr');
              var limit = 0;
              while (true) {
                  var prev = $(myRow).prev('tr');
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpDual.js and 3 other locations - About 1 day to fix
      fannie/modules/plugins2.0/RP/rpDirect.js on lines 377..406
      fannie/modules/plugins2.0/RP/rpFloral.js on lines 204..233
      fannie/modules/plugins2.0/RP/rpOrder.js on lines 337..366

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

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

          function prevRow(elem) {
              var myRow = $(elem).closest('tr');
              var limit = 0;
              while (true) {
                  var prev = $(myRow).prev('tr');
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpDirect.js and 3 other locations - About 1 day to fix
      fannie/modules/plugins2.0/RP/rpDual.js on lines 369..398
      fannie/modules/plugins2.0/RP/rpFloral.js on lines 204..233
      fannie/modules/plugins2.0/RP/rpOrder.js on lines 337..366

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

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

          function prevRow(elem) {
              var myRow = $(elem).closest('tr');
              var limit = 0;
              while (true) {
                  var prev = $(myRow).prev('tr');
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpOrder.js and 3 other locations - About 1 day to fix
      fannie/modules/plugins2.0/RP/rpDirect.js on lines 377..406
      fannie/modules/plugins2.0/RP/rpDual.js on lines 369..398
      fannie/modules/plugins2.0/RP/rpFloral.js on lines 204..233

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

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

          function prevRow(elem) {
              var myRow = $(elem).closest('tr');
              var limit = 0;
              while (true) {
                  var prev = $(myRow).prev('tr');
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpFloral.js and 3 other locations - About 1 day to fix
      fannie/modules/plugins2.0/RP/rpDirect.js on lines 377..406
      fannie/modules/plugins2.0/RP/rpDual.js on lines 369..398
      fannie/modules/plugins2.0/RP/rpOrder.js on lines 337..366

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

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

      var rpOrder = (function ($) {
      
          var mod = {};
          var state = {
              'retention': 60,
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/rpFloral.js - About 1 day to fix

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

                                if (strlen($_GET['in' . $i]) == 2 && is_numeric($_GET['in' . $i])) {
                                    $_GET['in' . $i] = $_GET['in' . $i] . ':00';
                                } elseif (strlen($_GET['in' . $i]) == 4 && is_numeric($_GET['in' . $i])) {
                                    $_GET['in' . $i] = substr($_GET['in' . $i], 0, 2) . ':' . substr($_GET['in' . $i], 2, 2);
                                } elseif (strlen($_GET['in' . $i]) == 3 && is_numeric($_GET['in' . $i])) {
        fannie/modules/plugins2.0/TimesheetPlugin/admin/TsAdminAdd.php on lines 69..77

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

        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

                                if (strlen($_GET['out' . $i]) == 2 && is_numeric($_GET['out' . $i])) {
                                    $_GET['out' . $i] = $_GET['out' . $i] . ':00';
                                } elseif (strlen($_GET['out' . $i]) == 4 && is_numeric($_GET['out' . $i])) {
                                    $_GET['out' . $i] = substr($_GET['out' . $i], 0, 2) . ':' . substr($_GET['out' . $i], 2, 2);
                                } elseif (strlen($_GET['out' . $i]) == 3 && is_numeric($_GET['out' . $i])) {
        fannie/modules/plugins2.0/TimesheetPlugin/admin/TsAdminAdd.php on lines 59..67

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

        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

            public function updateActive($data)
            {
                $this->connection->query("UPDATE LikeCodeActiveMap SET inUse=0 WHERE likeCode <= 999"); 
                $upP = $this->connection->prepare("UPDATE LikeCodeActiveMap SET inUse=1 WHERE likeCode=? AND storeID=?");
                $this->connection->startTransaction();
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/RpImportCsv.php and 1 other location - About 1 day to fix
        fannie/modules/plugins2.0/RP/RpImport.php on lines 42..87

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

        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

            public function updateActive($data)
            {
                $this->connection->query("UPDATE LikeCodeActiveMap SET inUse=0 WHERE likeCode <= 999"); 
                $upP = $this->connection->prepare("UPDATE LikeCodeActiveMap SET inUse=1 WHERE likeCode=? AND storeID=?");
                $this->connection->startTransaction();
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/RpImport.php and 1 other location - About 1 day to fix
        fannie/modules/plugins2.0/RP/RpImportCsv.php on lines 42..87

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

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

            function preprocess(){
                global $FANNIE_OP_DB,$FANNIE_PLUGIN_SETTINGS;
                $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
                if (isset($_GET['submitted'])) { // If the form has been submitted.
                    // Validate the data.
        Severity: Minor
        Found in fannie/modules/plugins2.0/TimesheetPlugin/admin/TsAdminAdd.php - About 1 day 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 getFile has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getFile($filename)
            {
                $depositP = $this->dbc->prepare('SELECT normal_price FROM products WHERE upc=?');
                $settings = $this->config->get('PLUGIN_SETTINGS');
                $storeID = $this->config->get('STORE_ID');
        Severity: Minor
        Found in fannie/modules/plugins2.0/InstaCart/InstaFileV3.php - About 1 day 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 WFC_Hybrid_Single has 326 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function WFC_Hybrid_Single($data,$offset=0){
        
        $pdf=new WFC_Hybrid_Single_PDF('L','mm',array(25.4, 53.975)); //start new instance of PDF
        $pdf->Open(); //open new PDF Document
        $pdf->setTagDate(date("m/d/Y"));
        Severity: Major
        Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php - About 1 day to fix
          Severity
          Category
          Status
          Source
          Language