CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

Method unitTest has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function unitTest($phpunit)
    {
        $get = $this->get_view();
        $phpunit->assertNotEquals(0, strlen($get));

Severity: Major
Found in fannie/batches/newbatch/BatchListPage.php - About 2 hrs to fix

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

        function process_file($linedata, $indexes)
        {
            $dbc = $this->connection;
            $dbc->selectDB($this->config->get('OP_DB'));
            $VENDOR_ID = $this->getVendorID();
    Severity: Major
    Found in fannie/batches/UNFI/load-classes/AlaffiaUploadPage.php - About 2 hrs to fix

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

          function form_content()
          {
              $startH = '';
              $endH = '';
              foreach (range(1, 12) as $h) {
      Severity: Major
      Found in fannie/reports/CashierTransactions/CashierTransactionsReport.php - About 2 hrs to fix

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

            function fetch_report_data()
            {
                $dbc = $this->connection;
                $group = FormLib::get('group', 'Super Department');
                switch ($group) {
        Severity: Major
        Found in fannie/reports/Organic/FairTradeSalesReport.php - About 2 hrs to fix

          Method calculate_footers has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function calculate_footers($data)
              {
                  switch($this->multi_counter){
                  case 1:
                      $this->report_headers[0] = 'Tenders';
          Severity: Major
          Found in fannie/reports/GeneralDay/GeneralDayReport.php - About 2 hrs to fix

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

                public function fetch_report_data()
                {
                    global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
                    $dbc = $this->connection;
                    $dbc->selectDB($this->config->get('OP_DB'));
            Severity: Major
            Found in fannie/reports/OwnerJoinLeave/TermPendingReport.php - About 2 hrs to fix

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

                  function fetch_report_data()
                  {
                      $dbc = $this->connection;
                      $group = FormLib::get('group', 'Super Department');
                      switch ($group) {
              Severity: Major
              Found in fannie/reports/Organic/OrganicSalesReport.php - About 2 hrs to fix

                Method dataFromTags has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function dataFromTags($dbc, $tagID)
                    {
                        if (!is_array($tagID)) {
                            $tagID = array($tagID);
                        }
                Severity: Major
                Found in fannie/admin/labels/genLabels.php - About 2 hrs to fix

                  Method get_view has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function get_view()
                      {
                          $dbc = FannieDB::getReadOnly($this->config->get('OP_DB'));
                          $deptsQ = $dbc->prepare("select dept_no,dept_name from departments order by dept_no");
                          $deptsR = $dbc->execute($deptsQ);
                  Severity: Major
                  Found in fannie/admin/labels/CreateTagsByDept.php - About 2 hrs to fix

                    Method getPlanSales has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getPlanSales($weekID)
                        {
                            if ($weekID >= 374) {
                                $prep = $this->connection->prepare("select c.obfCategoryID, m.superID, b.storeID, b.planGoal  
                                    from " . FannieDB::fqn('ObfBudget', 'plugin:ObfDatabaseV2') . " AS b 
                    Severity: Major
                    Found in fannie/modules/plugins2.0/OpenBookFinancingV2/ObfWeeklyReportV2.php - About 2 hrs to fix

                      Method get_batchID_view has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function get_batchID_view()
                          {
                              if (!is_array($this->batchID)) {
                                  $this->batchID = array($this->batchID);
                              }
                      Severity: Major
                      Found in fannie/modules/plugins2.0/FreshDeals/FreshDealsData.php - About 2 hrs to fix

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

                            function body_content(){
                        
                                global $FANNIE_PLUGIN_SETTINGS;
                                global $FANNIE_URL;
                        
                        
                        Severity: Major
                        Found in fannie/modules/plugins2.0/CoopCred/programs/CoopCredProgramEditor.php - About 2 hrs to fix

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

                              protected function get_id_view()
                              {
                                  $model = new MenuScreensModel($this->connection);
                                  $model->menuScreenID($this->id);
                                  $model->load();
                          Severity: Major
                          Found in fannie/modules/plugins2.0/MenuScreens/MSItems.php - About 2 hrs to fix

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

                                protected function post_handler()
                                {
                                    $dbc = $this->connection;
                                    $dbc->selectDB($this->config->get(('OP_DB')));
                                    $upcs = FormLib::get('upc', array()); 
                            Severity: Major
                            Found in fannie/purchasing/TransferPurchaseOrder.php - About 2 hrs to fix

                              Method drawPDF has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function drawPDF()
                                  {
                                      $pdf = new \FPDF('P', 'mm', 'Letter');
                                      $pdf = $this->loadPluginFonts($pdf);
                              
                              
                              Severity: Major
                              Found in fannie/classlib2.0/item/signage/RailSigns8x8P.php - About 2 hrs to fix

                                Method editorLinksArea has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private function editorLinksArea($upc, $isNew, $authorized)
                                    {
                                        $url = $this->config->get('URL');
                                        $self = filter_input(INPUT_SERVER, 'PHP_SELF');
                                        $ret = '<p>';
                                Severity: Major
                                Found in fannie/item/ItemEditorPage.php - About 2 hrs to fix

                                  Method getBasics has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function getBasics($store, $super)
                                      {
                                          $query = "SELECT m.super_name AS name, MAX(m.superID) AS superID,
                                              SUM(percentageStoreSales) AS percentage,
                                              SUM(CASE WHEN p.cost <> 0 AND normal_price <> 0 THEN 1 ELSE 0 END) as hasCost,
                                  Severity: Major
                                  Found in fannie/item/ContributionTool.php - About 2 hrs to fix

                                    Method filterSales has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private function filterSales($items, $form)
                                        {
                                            if ($form->onsale !== '') {
                                    
                                                $where = '1=1';
                                    Severity: Major
                                    Found in fannie/item/AdvancedItemSearch.php - About 2 hrs to fix

                                      Method get_id_print_handler has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function get_id_print_handler()
                                          {
                                              //$store = COREPOS\Fannie\API\lib\Store::getIdByIp();
                                              //$mtLength = $store == 1 ? 3 : 7;
                                      
                                      
                                      Severity: Major
                                      Found in fannie/item/vendors/BulkBinTags.php - About 2 hrs to fix

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

                                            mod.updatePartial = function(batchID) {
                                                var dstr = $('.partialBatch').serialize() + '&partialID=' + batchID;
                                                $.ajax({
                                                    type: 'post',
                                                    data: dstr
                                        Severity: Major
                                        Found in fannie/batches/newbatch/edit.js and 1 other location - About 2 hrs to fix
                                        fannie/batches/newbatch/edit.js on lines 342..349

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

                                        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