CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function post_upc_discounttype_handler has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function post_upc_discounttype_handler()
    {
        $discountType = FormLib::get('discounttype');
        $isMember = FormLib::get('isMember');
        $id = FormLib::get('orderid');
Severity: Minor
Found in fannie/ordering/OrderAjax.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 readItemsFromFile has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    static public function readItemsFromFile($filename)
    {
        $dbc = \FannieDB::get(\FannieConfig::factory()->get('OP_DB'));

        $product = new \ProductsModel($dbc);
Severity: Minor
Found in fannie/classlib2.0/item/HobartDgwLib.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 cli has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function cli($argc, $argv)
    {
        if ($argc > 2 && $argv[1] == '--doc') {
            array_shift($argv);
            array_shift($argv);
Severity: Minor
Found in common/BasicModel.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 find has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function find($sort='', $reverse=false)
    {
        if (!is_array($sort)) {
            $sort = array($sort);
        }
Severity: Minor
Found in common/BasicModel.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 sigCapture has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var sigCapture = (function($) {

    var mod = {};
    var formSubmitted = false;

Severity: Major
Found in pos/is4c-nf/js/sigCapture.js - About 4 hrs to fix

    Function vDept has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var vDept = (function($) {
        var mod = {};
    
        var showError = function(msg) {
            showBootstrapAlert('#alert-area', 'danger', msg);
    Severity: Major
    Found in fannie/item/vendors/vdepts.js - About 4 hrs to fix

      Method gettable has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function gettable($limit=false,$limitCat="ALL")
          {
              global $FANNIE_OP_DB, $FANNIE_URL;
              $sql = FannieDB::get($FANNIE_OP_DB);
              $ret = "";
      Severity: Major
      Found in fannie/modules/plugins2.0/DeliInventory/DeliInventoryPage.php - About 4 hrs to fix

        Method form_content has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function form_content(){
        
                global $FANNIE_PLUGIN_SETTINGS;
        
                $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);

          Method fetch_report_data has 102 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function fetch_report_data()
              {
                  $date1 = FormLib::get('date1',date('Y-m-d'));
                  $date2 = FormLib::get('date2',date('Y-m-d'));
          
          
          Severity: Major
          Found in fannie/purchasing/reports/UnfiExportForMas.php - About 4 hrs to fix

            Method post_view has 102 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function post_view()
                {
                    $parser = new Parser();
                    $pdf = $parser->parseFile($_FILES['pdf']['tmp_name']);
                    $text = $pdf->getText();
            Severity: Major
            Found in fannie/purchasing/importers/RdwInvoiceImport.php - About 4 hrs to fix

              Method preprocess has 102 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function preprocess(){
                      global $FANNIE_EQUITY_DEPARTMENTS;
                      global $FANNIE_OP_DB;
                      global $FANNIE_EMP_NO, $FANNIE_REGISTER_NO;
                      global $FANNIE_CORRECTION_DEPT;
              Severity: Major
              Found in fannie/mem/correction_pages/MemEquityTransferTool.php - About 4 hrs to fix

                Method preprocess has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function preprocess(){
                        global $FANNIE_AR_DEPARTMENTS;
                        global $FANNIE_EQUITY_DEPARTMENTS;
                        global $FANNIE_OP_DB;
                        global $FANNIE_EMP_NO, $FANNIE_REGISTER_NO;
                Severity: Major
                Found in fannie/mem/correction_pages/MemArEquitySwapTool.php - About 4 hrs to fix

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

                              if ($row['charflag']=='SO') {
                                  // intentional. special orders can have weird
                                  // quantity fields
                                  $comment = "";
                              } elseif (isset($row['scale']) && $row['scale'] != 0 && $row['quantity'] != 0) {
                  Severity: Major
                  Found in pos/is4c-nf/lib/ReceiptBuilding/Format/ItemReceiptFormat.php and 1 other location - About 4 hrs to fix
                  fannie/modules/plugins2.0/EReceipt/Format/ItemEReceiptFormat.php on lines 61..71

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

                  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

                          } elseif ($weekID >= 218) {
                              $prep = $this->connection->prepare("
                                  SELECT l.obfCategoryID, s.superID, (1+l.growthTarget)*s.lastYearSales AS plan
                                  FROM " . FannieDB::fqn('ObfLabor', 'plugin:ObfDatabaseV2') . " AS l
                                      INNER JOIN " . FannieDB::fqn('ObfCategories', 'plugin:ObfDatabaseV2') . " AS c ON l.obfCategoryID=c.obfCategoryID
                  fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php on lines 311..326

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

                  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

                          } elseif ($weekID >= 218) {
                              $prep = $this->connection->prepare("
                                  SELECT l.obfCategoryID, s.superID, (1+l.growthTarget)*s.lastYearSales AS plan
                                  FROM " . FannieDB::fqn('ObfLabor', 'plugin:ObfDatabaseV2') . " AS l
                                      INNER JOIN " . FannieDB::fqn('ObfCategories', 'plugin:ObfDatabaseV2') . " AS c ON l.obfCategoryID=c.obfCategoryID
                  fannie/modules/plugins2.0/OpenBookFinancingV2/ObfSummaryReport.php on lines 238..253

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

                  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 ($row['charflag']=='SO') {
                                  // intentional. special orders can have weird
                                  // quantity fields
                                  $comment = "";
                              } elseif (isset($row['scale']) && $row['scale'] != 0 && $row['quantity'] != 0) {
                  pos/is4c-nf/lib/ReceiptBuilding/Format/ItemReceiptFormat.php on lines 58..68

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

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

                              $ret .= "  ".substr($timeStamp.$blank, 0, 10)
                                  .substr($row["register_no"].$blank, 0, 9)
                                  .substr($row["trans_no"].$blank, 0, 8)
                                  .substr($blank.$row['emp_no'], -5)
                                  .substr($blank.$row["card_no"],-6)
                  pos/is4c-nf/lib/ReceiptBuilding/TenderReports/WefcTorontoTenderReport.php on lines 360..365
                  pos/is4c-nf/lib/ReceiptBuilding/TenderReports/WefcTorontoTenderReport.php on lines 456..461

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

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

                                  $receipt .= "  ".substr($timeStamp.$blank, 0, 10)
                                  .substr($row["register_no"].$blank, 0, 9)
                                  .substr($row["trans_no"].$blank, 0, 8)
                                  .substr($blank.$row['emp_no'], -6)
                                  .substr($blank.$row["card_no"],-6)
                  pos/is4c-nf/lib/ReceiptBuilding/TenderReports/WefcTorontoTenderReport.php on lines 456..461
                  pos/is4c-nf/lib/ReceiptBuilding/TenderReports/YPSITenderReport.php on lines 214..219

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

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

                              $ret .= "  ".substr($timeStamp.$blank, 0, 10)
                                  .substr($row["register_no"].$blank, 0, 9)
                                  .substr($row["trans_no"].$blank, 0, 8)
                                  .substr($blank.$row['emp_no'], -8)
                                  .substr($blank.$row["card_no"],-6)
                  pos/is4c-nf/lib/ReceiptBuilding/TenderReports/WefcTorontoTenderReport.php on lines 360..365
                  pos/is4c-nf/lib/ReceiptBuilding/TenderReports/YPSITenderReport.php on lines 214..219

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

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

                                  <p>
                                      <div className="input-group">
                                          <span className="input-group input-group-addon">End Date</span>
                                          <input type="text" className="form-control date-field" value={this.props.endDate}
                                              onChange={(ev) => this.props.manageData.end(ev.target.value)} />
                  Severity: Major
                  Found in fannie/batches/EndCapper/src/ToolBar.js and 2 other locations - About 4 hrs to fix
                  fannie/batches/EndCapper/src/ToolBar.js on lines 138..144
                  fannie/batches/EndCapper/src/ToolBar.js on lines 145..151

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

                  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