CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

        foreach ($batchNames as $k => $bName) {
            $bidQ = $dbc->prepare("
                SELECT batchID
                FROM batches
                WHERE batchName=?
Severity: Major
Found in fannie/batches/UNFI/VPBPIV.php and 2 other locations - About 1 day to fix
fannie/batches/UNFI/VPBPIII.php on lines 594..625
fannie/batches/UNFI/VPBPV.php on lines 688..719

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

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

        foreach ($batchNames as $k => $bName) {
            $bidQ = $dbc->prepare("
                SELECT batchID
                FROM batches
                WHERE batchName=?
Severity: Major
Found in fannie/batches/UNFI/VPBPIII.php and 2 other locations - About 1 day to fix
fannie/batches/UNFI/VPBPIV.php on lines 681..712
fannie/batches/UNFI/VPBPV.php on lines 688..719

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

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

    function finish_content(){

        if (!empty($this->errors)) return $this->errors;

        $ret = '';
Severity: Major
Found in fannie/mem/correction_pages/MemArEquitySwapTool.php and 1 other location - About 1 day to fix
fannie/mem/correction_pages/MemArEquityDumpTool.php on lines 204..237

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

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

    function finish_content()
    {
        if (!empty($this->errors)) {
            return $this->errors;
        }
Severity: Major
Found in fannie/mem/correction_pages/MemArEquityDumpTool.php and 1 other location - About 1 day to fix
fannie/mem/correction_pages/MemArEquitySwapTool.php on lines 214..245

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

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

    public function run()
    {
        $dbc = CalendarPluginDB::get();

        /**

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

    protected function post_view()
    {
        $file = $_FILES['invoice']['tmp_name'];
        $type = $_FILES['invoice']['type'];
        $store = FormLib::get('store');
Severity: Minor
Found in fannie/purchasing/importers/UsFoodsInvoiceImport.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

File CustomerServiceLog.php has 545 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
include(__DIR__ . '/../../../config.php');
if (!class_exists('FannieAPI')) {
    include(__DIR__ . '/../../../classlib2.0/FannieAPI.php');
}
Severity: Major
Found in fannie/modules/plugins2.0/CustomerServiceLog/CustomerServiceLog.php - About 1 day to fix

    Method generateWFC_New_Produce_Mockup_label has 225 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function generateWFC_New_Produce_Mockup_label($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo, $lc)
    {
        $pdf->SetFont('Gill','', 16);
        if (!defined('FPDF_FONTPATH')) {
            define('FPDF_FONTPATH', __DIR__. '/../../../modules/plugins2.0/CoopDealsSigns/noauto/fonts/');
    Severity: Major
    Found in fannie/admin/labels/pdf_layouts/WFC_New_Produce_Mockup.php - About 1 day to fix

      Method handle has 224 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handle($upc,$json)
          {
              $pos = 0;
              $coupon = new stdClass();
              $coupon->firstReq = new stdClass();
      Severity: Major
      Found in pos/is4c-nf/lib/Scanning/SpecialUPCs/DatabarCoupon.php - About 1 day to fix

        Method refresh_data has 223 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function refresh_data($trans_db, $month, $year, $day=False)
            {
                $config = FannieConfig::factory();
                $settings = $config->get('PLUGIN_SETTINGS');
                $dbc = FannieDB::get($settings['WarehouseDatabase']);
        Severity: Major
        Found in fannie/modules/plugins2.0/CoreWarehouse/models/MemberSummaryModel.php - About 1 day to fix

          Function handleItem has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
          Open

              private function handleItem($upc, $row, $scaleStickerItem, $scalepriceUPC, $scalepriceEAN)
              {
                  $ret = $this->default_json();
                  $myUrl = MiscLib::baseURL();
                  $dbc = Database::pDataConnect();
          Severity: Minor
          Found in pos/is4c-nf/parser/parse/UPC.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 57 (exceeds 5 allowed). Consider refactoring.
          Open

              function body_content()
              {
                  include('../config.php'); 
                  ob_start();
          
          
          Severity: Minor
          Found in fannie/install/InstallIndexPage.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 get_view has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function get_view()
              {
                  $this->addScript('rpOrder.js?date=20210224');
                  $this->addOnloadCommand('rpOrder.initAutoCompletes();');
                  $store = FormLib::get('store');
          Severity: Minor
          Found in fannie/modules/plugins2.0/RP/RpOrderPage.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 csv_content has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
          Open

              function csv_content(){
                  $ret = "UPC,Description,Vendor,Account#,Dept#,\"Dept Name\",Qty,Cost,Unit Cost Total,Normal Retail,Status,Normal Retail Total,Location\r\n";
                  $totals = array();
                  $vendors = array();
                  $manuals = array();
          Severity: Minor
          Found in fannie/modules/plugins2.0/ShelfAudit/SaReportPage.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 writeItemsToScales has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
          Open

              static public function writeItemsToScales($items, $scales=array())
              {
                  $config = \FannieConfig::factory(); 
                  if (!isset($items[0])) {
                      $items = array($items);
          Severity: Minor
          Found in fannie/classlib2.0/item/HobartDgwLib.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

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

          def init_driver():
              chrome_opts = webdriver.ChromeOptions()
              chrome_opts.add_argument("--headless")
              chrome_opts.add_argument("window-size=1400,600")
              chrome_opts.add_experimental_option("prefs", { "download.default_directory": TMP_DIR })
          fannie/modules/plugins2.0/UnfiInvoiceGrabber/noauto/myunfi2.py on lines 48..62

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

          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

          def init_driver():
              chrome_opts = webdriver.ChromeOptions()
              chrome_opts.add_argument("--headless")
              chrome_opts.add_argument("window-size=1400,1000")
              chrome_opts.add_experimental_option("prefs", { "download.default_directory": TMP_DIR })
          fannie/modules/plugins2.0/UnfiInvoiceGrabber/noauto/myunfi.py on lines 65..79

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

          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

                  foreach ($sells as $cn => $sales) {
                      foreach ($sales as $sale) {
                          $num_sold = abs($sale->shares());
                          $amt_sold = abs($sale->value());
                          while ($num_sold > 0) {
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/GumIssueDividendPage.php on lines 293..318

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

          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

                  foreach ($sells as $cn => $sales) {
                      foreach ($sales as $sale) {
                          $num_sold = abs($sale->shares());
                          $amt_sold = abs($sale->value());
                          while ($num_sold > 0) {
          fannie/modules/plugins2.0/GiveUsMoneyPlugin/reports/GumDividendReport.php on lines 91..116

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

          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

          File JPath.cs has 537 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          using System;
          using System.Collections.Generic;
          using System.Globalization;
          using System.Text;
          using Newtonsoft.Json.Utilities;
            Severity
            Category
            Status
            Source
            Language