CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method saveFormData has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function saveFormData($upc)
    {
        $FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
        $upc = BarcodeLib::padUPC($upc);
        $dbc = $this->db();
Severity: Major
Found in fannie/item/modules/BaseItemModule.php - About 5 hrs to fix

    Method Operation has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private static bool Operation(ExpressionType operation, object objA, object objB, out object result)
            {
                if (objA is string || objB is string)
                {
                    if (operation == ExpressionType.Add || operation == ExpressionType.AddAssign)

      Function orderView has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      var orderView = (function($) {
          var mod = {};
          var forceUPC = true;
      
          mod.forceUPC = function(f) {
      Severity: Minor
      Found in fannie/ordering/orderview.js - About 5 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 preprocess has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          function preprocess()
          {
              // check for posts before drawing anything, so we can redirect
              if (FormLib::get('reginput', false) !== false) {
                  $input = strtoupper(trim(FormLib::get('reginput')));
      Severity: Minor
      Found in pos/is4c-nf/plugins/Paycards/gui/PaycardEmvPage.php - About 5 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 fetch_report_data has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fetch_report_data()
          {
              $dbc = $this->connection;
              $dbc->selectDB($this->config->get('OP_DB'));
      
      
      Severity: Minor
      Found in fannie/reports/HourlySales/HourlySalesReport.php - About 5 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 updateSalesCache has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function updateSalesCache($week, $num_cached, $dateInfo)
          {
              $class_lib = $this->class_lib;
              $dbc = $class_lib::getDB();
              $sales = $class_lib::getCache($dbc);
      Severity: Minor
      Found in fannie/modules/plugins2.0/OpenBookFinancing/ObfWeeklyReport.php - About 5 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 body_content has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public function body_content()
          {
              $db = WfcHtLib::hours_dbconnect();
      
              $ppID = -1;
      Severity: Minor
      Found in fannie/modules/plugins2.0/WfcHoursTracking/WfcHtPayPeriodsPage.php - About 5 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 process_file has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public function process_file($linedata, $indexes)
          {
              $getStoreP = $this->connection->prepare("SELECT posID FROM LbmxStores WHERE lbmxID=?");
              $getVendorP = $this->connection->prepare("SELECT posID FROM LbmxVendors WHERE lbmxID=?");
              $getPoP = $this->connection->prepare("SELECT orderID FROM PurchaseOrder WHERE storeID=? AND vendorID=? AND vendorInvoiceID=?");
      Severity: Minor
      Found in fannie/modules/plugins2.0/LBMX/LbmxImport.php - About 5 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 preprocess has a Cognitive Complexity of 35 (exceeds 5 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: Minor
      Found in fannie/mem/correction_pages/MemEquityTransferTool.php - About 5 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 drawPDF has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public function drawPDF()
          {
              $pdf = new \FPDF('P', 'mm', 'Letter');
              $pdf->SetMargins(6.35, 6.35, 6.35);
              $pdf->SetAutoPageBreak(false);
      Severity: Minor
      Found in fannie/classlib2.0/item/signage/Giganto2UpP.php - About 5 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 filterSales has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          private function filterSales($items, $form)
          {
              if ($form->onsale !== '') {
      
                  $where = '1=1';
      Severity: Minor
      Found in fannie/item/AdvancedItemSearch.php - About 5 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

      Method GetSerializableMembers has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
      Open

              protected virtual List<MemberInfo> GetSerializableMembers(Type objectType)
              {
                  bool ignoreSerializableAttribute;
      #if !(NETFX_CORE || PORTABLE || PORTABLE40)
                  ignoreSerializableAttribute = IgnoreSerializableAttribute;

      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 CreateObjectUsingCreatorWithParameters has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
      Open

              private object CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor<object> creator, string id)
              {
                  ValidationUtils.ArgumentNotNull(creator, "creator");
      
                  // only need to keep a track of properies presence if they are required or a value should be defaulted if missing

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

          protected function get_id_view()
          {
              $deptP = $this->connection->prepare("SELECT dept_ID FROM superdepts WHERE superID=?");
              $depts = $this->connection->getAllValues($deptP, array($this->id));
              list($inStr, $args) = $this->connection->safeInClause($depts);
      Severity: Major
      Found in fannie/modules/plugins2.0/CoreWarehouse/reports/EstMarginReport.php - About 5 hrs to fix

        File PriceRuleEditor.php has 385 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /*******************************************************************************
        
            Copyright 2015 Whole Foods Co-op
        
        
        Severity: Minor
        Found in fannie/item/PriceRuleEditor.php - About 5 hrs to fix

          Method post_handler has 131 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function post_handler()
              {
                  $this->saveForm();
                  $pdf = new FPDF('P', 'in', array(3.5, 1.25));
                  $pdf->SetMargins(0, 0, 0);
          Severity: Major
          Found in fannie/item/images/NutriFacts.php - About 5 hrs to fix

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

                public function post_section_handler()
                {
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
                    $section = FormLib::get('section');
            Severity: Major
            Found in fannie/item/FloorSections/SubLocationViewer.php and 1 other location - About 5 hrs to fix
            fannie/item/FloorSections/NewPageO.php on lines 148..182

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 188.

            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 post_section_handler()
                {
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
                    $section = FormLib::get('section');
            Severity: Major
            Found in fannie/item/FloorSections/NewPageO.php and 1 other location - About 5 hrs to fix
            fannie/item/FloorSections/SubLocationViewer.php on lines 132..166

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

            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 StatementsPluginBusiness.php has 384 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            include_once(dirname(__FILE__) . '/../../../config.php');
            if (!class_exists('FannieAPI')) {
                include(dirname(__FILE__) . '/../../../classlib2.0/FannieAPI.php');
            }

              Method get_id_confirm_view has 130 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function get_id_confirm_view()
                  {
                      
                      $ret = '';
                      
                Severity
                Category
                Status
                Source
                Language