CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function get_id_view has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_id_view()
    {
        $settings = $this->config->get('PLUGIN_SETTINGS');
        $prefix = $settings['ObfDatabaseV2'] . $this->connection->sep();
        $week = FormLib::get('week');
Severity: Minor
Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfDepartmentReport.php - About 6 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 post_id_handler has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    function post_id_handler()
    {
        global $FANNIE_OP_DB;
        if (!FannieAuth::validateUserQuiet('editmembers') && !FannieAuth::validateUserQuiet('editmembers_csc'))
            return $this->unknown_request_handler();
Severity: Minor
Found in fannie/modules/plugins2.0/PIKiller/PISuspensionPage.php - About 6 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 saveFormData has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveFormData($memNum, $json=array())
    {
        //$dbc = $this->db();
        global $FANNIE_URL;
        global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
Severity: Minor
Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 6 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 41 (exceeds 5 allowed). Consider refactoring.
Open

    public function process_file($linedata, $indexes)
    {
        global $FANNIE_OP_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);

Severity: Minor
Found in fannie/item/import/AdTextImportPage.php - About 6 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 SaveFormData has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    function SaveFormData($upc){
        $upc = BarcodeLib::padUPC($upc);
        $ids = FormLib::get_form_value('v_id',array());
        $skus = FormLib::get_form_value('v_sku',array());
        $costs = FormLib::get_form_value('v_cost',array());
Severity: Minor
Found in fannie/item/modules/VendorItemModule.php - About 6 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 get_schedule_view has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_schedule_view()
    {
        global $FANNIE_OP_DB;
        $dbc = FannieDB::get($FANNIE_OP_DB);

Severity: Minor
Found in fannie/item/ProdReviewPage.php - About 6 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 ResolvePropertyAndCreatorValues has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring.
Open

        private IDictionary<JsonProperty, object> ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType, out IDictionary<string, object> extensionData)
        {
            extensionData = (contract.ExtensionDataSetter != null) ? new Dictionary<string, object>() : null;

            IDictionary<JsonProperty, object> propertyValues = new Dictionary<JsonProperty, object>();

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

    public function lookupTransaction($ref, $local, $mode)
    {
        $merchantID = $this->conf->get('GoEMerchID');
        $password = $this->conf->get('GoEMerchPassword');
        $gatewayID = $this->conf->get('GoEmerchGatewayID');
Severity: Major
Found in pos/is4c-nf/plugins/Paycards/GoEMerchant.php - About 6 hrs to fix

    Method body_content has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function body_content()
        {
            $dbc = $this->connection;
            $dbc->selectDB($this->config->get('OP_DB'));
            $transDB = $this->config->get('TRANS_DB') . $dbc->sep();
    Severity: Major
    Found in fannie/reports/SalesToday/SalesTodayReport2.php - About 6 hrs to fix

      Method get_id_view has 156 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function get_id_view()
          {
              $settings = $this->config->get('PLUGIN_SETTINGS');
              $prefix = $settings['CommentDB'] . $this->connection->sep();
      
      
      Severity: Major
      Found in fannie/modules/plugins2.0/CommentTracker/ManageComments.php - About 6 hrs to fix

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

            public function getResponse($trans, $transID)
            {
                $today = date('Ymd');
                $sql = "SELECT commErr,
                            httpCode,
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/lib/PaycardDialogs.php and 1 other location - About 6 hrs to fix
        pos/is4c-nf/plugins/Paycards/lib/PaycardDialogs.php on lines 111..144

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

            public function getRequest($trans, $transID)
            {
                $today = date('Ymd');
                // look up the request using transID (within this transaction)
                $sql = "SELECT live,
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/lib/PaycardDialogs.php and 1 other location - About 6 hrs to fix
        pos/is4c-nf/plugins/Paycards/lib/PaycardDialogs.php on lines 146..178

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

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

            public function addItem(array $row, $quantity, $priceObj)
            {
                if ($quantity == 0) {
                    return false;
                }
        Severity: Major
        Found in pos/is4c-nf/lib/Scanning/PriceMethods/ABGroupPM.php - About 6 hrs to fix

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

              protected function post_handler()
              {
                  try {
                      $pDate = $this->form->date;
                      $invoice = $this->form->invoice;
          Severity: Major
          Found in fannie/modules/plugins2.0/PaycardFix/PaycardFixVoid.php - About 6 hrs to fix

            File CoopCredMember.php has 425 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /*******************************************************************************
            
                Copyright 2010 Whole Foods Co-op, Duluth, MN
                Copyright 2014 West End Food Co-op, Toronto, Canada
            Severity: Minor
            Found in fannie/modules/plugins2.0/CoopCred/membership/CoopCredMember.php - About 6 hrs to fix

              Class JsonSerializerInternalReader has 45 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  internal class JsonSerializerInternalReader : JsonSerializerInternalBase
                  {
                      internal enum PropertyPresence
                      {
                          None = 0,

                Method filter has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function filter($dbc, $data)
                    {
                        $reverseMap = array();
                        $tenderTTL = 0.00;
                        $tax = False;
                Severity: Major
                Found in pos/is4c-nf/lib/ReceiptBuilding/Filter/DefaultReceiptFilter.php - About 6 hrs to fix

                  Method variable_slip has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function variable_slip($ref, $reprint=False, $sigSlip=False)
                      {
                          $date = ReceiptLib::build_time(time());
                          list($emp, $reg, $trans) = ReceiptLib::parseRef($ref);
                  
                  
                  Severity: Major
                  Found in pos/is4c-nf/lib/ReceiptBuilding/Messages/CCReceiptMessage.php - About 6 hrs to fix

                    Method filter has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function filter($dbc, $data)
                        {
                            $reverseMap = array();
                            $tenderTTL = 0.00;
                            $tax = False;
                    Severity: Major
                    Found in fannie/modules/plugins2.0/EReceipt/EReceiptFilter.php - About 6 hrs to fix

                      Method process_file has 154 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function process_file($linedata, $indexes)
                          {
                              global $FANNIE_OP_DB;
                              $dbc = FannieDB::get($FANNIE_OP_DB);
                              $user = FannieAuth::getUID($this->current_user);
                      Severity: Major
                      Found in fannie/item/vendors/UpdateUploadPage.php - About 6 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language