CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Function run has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    public function run($args=array())
    {
        $ret = array();
        if (!property_exists($args, 'field') || !property_exists($args, 'search')) {
            // missing required arguments
Severity: Minor
Found in fannie/classlib2.0/webservices/FannieAutoComplete.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 postAccount has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    private static function postAccount($dbc, $id, $json)
    {
        $ret = array('errors' => 0, 'error-msg' => '');
        $config = FannieConfig::factory();
        $account = self::getModel($dbc, 'CustomerAccountsModel');
Severity: Minor
Found in fannie/classlib2.0/member/MemberREST.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_orderID_customer_handler has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_orderID_customer_handler()
    {
        $dbc = $this->connection;
        $dbc->selectDB($this->config->get('OP_DB'));
        $TRANS = $this->config->get('TRANS_DB') . $dbc->sep();
Severity: Minor
Found in fannie/ordering/OrderViewPage.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 getCustomerForm has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

function getCustomerForm($orderID,$memNum="0")
{
    global $FANNIE_OP_DB, $TRANS, $FANNIE_TRANS_DB, $canEdit;
    $dbc = FannieDB::get($FANNIE_OP_DB);

Severity: Minor
Found in fannie/ordering/ajax-calls.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_id_view has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

    protected function get_id_view()
    {
        $items = array(
            293 => $this->getItems(293),
            292 => $this->getItems(292),
Severity: Minor
Found in fannie/item/likecodes/LikeCodeBatchPage.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 CreateObject has a Cognitive Complexity of 70 (exceeds 20 allowed). Consider refactoring.
Open

        private object CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue)
        {
            string id;
            Type resolvedObjectType = objectType;

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

    public function get_state_view()
    {
        global $FANNIE_OP_DB, $FANNIE_URL;
        $dbc = FannieDB::get($FANNIE_OP_DB);
        $states = new OriginStateProvModel($dbc);
Severity: Major
Found in fannie/item/origins/OriginEditor.php and 1 other location - About 1 day to fix
fannie/item/origins/OriginEditor.php on lines 200..241

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

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 get_country_view()
    {
        global $FANNIE_OP_DB, $FANNIE_URL;
        $dbc = FannieDB::get($FANNIE_OP_DB);
        $countries = new OriginCountryModel($dbc);
Severity: Major
Found in fannie/item/origins/OriginEditor.php and 1 other location - About 1 day to fix
fannie/item/origins/OriginEditor.php on lines 243..284

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

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

    function fetch_report_data(){

        //global $FANNIE_TRANS_DB,
        global $FANNIE_OP_DB, $FANNIE_URL;
        global $FANNIE_PLUGIN_SETTINGS;

    File rpDirect.js has 520 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

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

          private function findOwner($dbc, $orderID, $storeID)
          {
              $prep = $dbc->prepare("SELECT phone FROM MercatoOrders WHERE storeID=? AND orderID=?"); 
              $phone = $dbc->getValue($prep, array($storeID, $orderID)); 
              if (!$phone) {
      Severity: Major
      Found in fannie/modules/plugins2.0/Mercato/MercatoIntake.php and 2 other locations - About 1 day to fix
      fannie/modules/plugins2.0/Mercato/MercatoConvert.php on lines 170..196
      fannie/modules/plugins2.0/Mercato/MercatoIntakeV2.php on lines 146..172

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

      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

          private function findOwner($dbc, $orderID, $storeID)
          {
              $prep = $dbc->prepare("SELECT phone FROM MercatoOrders WHERE storeID=? AND orderID=?"); 
              $phone = $dbc->getValue($prep, array($storeID, $orderID)); 
              if (!$phone) {
      Severity: Major
      Found in fannie/modules/plugins2.0/Mercato/MercatoIntakeV2.php and 2 other locations - About 1 day to fix
      fannie/modules/plugins2.0/Mercato/MercatoConvert.php on lines 170..196
      fannie/modules/plugins2.0/Mercato/MercatoIntake.php on lines 334..360

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

      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

          private function findOwner($dbc, $orderID, $storeID)
          {
              $prep = $dbc->prepare("SELECT phone FROM MercatoOrders WHERE storeID=? AND orderID=?"); 
              $phone = $dbc->getValue($prep, array($storeID, $orderID)); 
              if (!$phone) {
      Severity: Major
      Found in fannie/modules/plugins2.0/Mercato/MercatoConvert.php and 2 other locations - About 1 day to fix
      fannie/modules/plugins2.0/Mercato/MercatoIntake.php on lines 334..360
      fannie/modules/plugins2.0/Mercato/MercatoIntakeV2.php on lines 146..172

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

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

      <?php
      
      use COREPOS\Fannie\API\lib\Stats;
      use COREPOS\Fannie\API\item\ItemText;
      
      
      Severity: Major
      Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfDepartmentReport.php - About 1 day to fix

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

                if ($type === '') { // not set
                    $q = "
                        SELECT h.upc,
                            p.description,
                            price,
        Severity: Major
        Found in fannie/reports/PriceHistory/PriceHistoryReport.php and 1 other location - About 1 day to fix
        fannie/reports/CostHistory/CostHistoryReport.php on lines 106..180

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

        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 ($type === '') { // not set
                    $q = "
                        SELECT h.upc,
                            p.description,
                            h.cost,
        Severity: Major
        Found in fannie/reports/CostHistory/CostHistoryReport.php and 1 other location - About 1 day to fix
        fannie/reports/PriceHistory/PriceHistoryReport.php on lines 104..177

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

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

            static public function import($zipfile, $vendorID, $repeat=false)
            {
                global $FANNIE_OP_DB;
                $za = new ZipArchive();
                $try = $za->open($zipfile);
        Severity: Minor
        Found in fannie/modules/plugins2.0/UnfiInvoiceGrabber/UIGLib.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 run has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

            public function run()
            {
                $settings = $this->config->get('PLUGIN_SETTINGS');
                $store = $this->config->get('STORE_ID');
                $this->connection = FannieDB::get($this->config->get('OP_DB'));
        Severity: Minor
        Found in fannie/modules/plugins2.0/USFoodsInvoiceGrabber/USFTask.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 preprocess has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

            public function preprocess()
            {
                $this->display_function = 'listHouseCoupons';
        
                $msgs = array();
        Severity: Minor
        Found in fannie/modules/plugins2.0/HouseCoupon/HouseCouponEditor.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 listModules has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
        Open

            static public function listModules($base_class, $include_base=false, $debug=false)
            {
                // leading backslash is ignored
                if ($base_class[0] == '\\') {
                    $base_class = substr($base_class, 1);
        Severity: Minor
        Found in fannie/classlib2.0/FannieAPI.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

        Severity
        Category
        Status
        Source
        Language