CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

        while (SPH_Running) {
            try {
                int b = sp.ReadByte();
                if (b == 13) {
                    if (this.verbose_mode > 0)
pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Magellan_Locking.cs on lines 115..135

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

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

        while (SPH_Running) {
            try {
                int b = sp.ReadByte();
                if (b == 13) {
                    if (this.verbose_mode > 0)
pos/is4c-nf/scale-drivers/drivers/NewMagellan/SPH_Magellan_Classic.cs on lines 106..126

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

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

    function getItemRow(type, col) {

        var metatype = type.toLowerCase().replace(/ /g, '');

        var ret = '<tr><td><input type="hidden" name="col[]" value="' + col + '" />';
Severity: Major
Found in fannie/modules/plugins2.0/MenuScreens/js/msi.js - About 2 hrs to fix

    Method doc has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function doc()
        {
            return "<table cellspacing=0 cellpadding=3 border=1>
                <tr>
                    <td colspan=2>This module gets used
    Severity: Major
    Found in pos/is4c-nf/parser/parse/Steering.php - About 2 hrs to fix

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

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

        Method report_description_content has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function report_description_content()
            {
                if ($this->report_format != 'html') {
                    return array();
                }
        Severity: Major
        Found in fannie/reports/DepartmentMovement/HourlyMovementReport.php - About 2 hrs to fix

          Method Zebra_Single_Label has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function Zebra_Single_Label($data, $offset=0, $filename=NULL){
              $hspace = 0.89375;
              $h = 31;
              $w = 53;
              $top = 0;
          Severity: Major
          Found in fannie/admin/labels/pdf_layouts/Zebra_Single_Label.php - About 2 hrs to fix

            Method loadData has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function loadData($rowlimit=0)
                {
                    if (!class_exists('ZipArchive')) {
                        echo "No ZIP support\n";
                        return false;
            Severity: Major
            Found in fannie/install/sample_data/LoadSampleTrans.php - About 2 hrs to fix

              Method get has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function get($storeID, $outputDir)
                  {
                      $filename = date('YmdHis') . '_' . $this->name;
                      $fptr = fopen($outputDir . DIRECTORY_SEPARATOR . $filename, 'w');
                      $term = "\r\n";
              Severity: Major
              Found in fannie/modules/plugins2.0/RAFeeds/RaItemFeed.php - About 2 hrs to fix

                Method getTime has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function getTime($string)
                    {
                        $regex = '/(\d{1,2}\s{0,2}(?:am|pm|(?::\d\d)){0,1}\s{0,2}(?:am|pm){0,1})(?:\s{0,2}(?:-|to|till|until)\s{0,2}(\d{1,2}\s{0,2}(?:am|pm|(?::\d\d)){0,1}\s{0,2}(?:am|pm){0,1}))?/i';
                        $ret = false;
                        if (preg_match($regex, $string, $matches)) {
                Severity: Major
                Found in fannie/modules/plugins2.0/CalendarPlugin/CalendarFeed.php - About 2 hrs to fix

                  Method b2bHandler has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function b2bHandler($dbc, $ids)
                      {
                          $ids = array_map(function($i) { return str_replace('b2b', '', $i); }, $ids);
                          $pdf = new FPDF('P', 'mm', 'Letter');
                          $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');

                    Method run has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function run()
                        {
                            global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_ARCHIVE_DB, $FANNIE_PLUGIN_SETTINGS,
                                $FANNIE_SERVER, $FANNIE_SERVER_USER, $FANNIE_SERVER_PW;
                    
                    
                    Severity: Major
                    Found in fannie/modules/plugins2.0/SimpleBackup/SimpleBackupTask.php - About 2 hrs to fix

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

                          function body_content(){
                              global $FANNIE_URL, $FANNIE_PLUGIN_SETTINGS;
                              $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
                              $this->addScript('js/countV2.js?date=20210712');
                              $this->addScript($FANNIE_URL.'src/javascript/jquery.js');
                      Severity: Major
                      Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountV2.php - About 2 hrs to fix

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

                            function body_content(){
                                global $FANNIE_URL, $FANNIE_PLUGIN_SETTINGS;
                                $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
                                $this->addScript('js/count.js?date=20200622');
                                $this->addScript($FANNIE_URL.'src/javascript/jquery.js');
                        Severity: Major
                        Found in fannie/modules/plugins2.0/OverShortTools/OverShortSafecountPage.php - About 2 hrs to fix

                          Method prepsTable has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function prepsTable($store)
                              {
                                  $res = $this->connection->query("
                                      SELECT *
                                      FROM RpPreps AS g
                          Severity: Major
                          Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 2 hrs to fix

                            Method greensTable has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function greensTable($store)
                                {
                                    $res = $this->connection->query("
                                        SELECT *
                                        FROM RpGreens AS g
                            Severity: Major
                            Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 2 hrs to fix

                              Method updateViews has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function updateViews ($dbc) {
                                      global $FANNIE_PLUGIN_SETTINGS;
                              
                                      $models = array(
                                          array('name' => 'CCredHistoryTodayModel', 'drop' => True)
                              Severity: Major
                              Found in fannie/modules/plugins2.0/CoopCred/programs/CoopCredProgramEditor.php - About 2 hrs to fix

                                Method showEditForm has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function showEditForm($memNum, $country="US")
                                    {
                                        $dbc = $this->db();
                                        $account = self::getAccount();
                                        
                                Severity: Major
                                Found in fannie/mem/modules/MemType.php - About 2 hrs to fix

                                  Method searchDirectories has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      static private function searchDirectories($base_class)
                                      {
                                          $directories = array();
                                          // prefer directories from Poser if present
                                          $poser = FannieConfig::config('POSER');
                                  Severity: Major
                                  Found in fannie/classlib2.0/FannieAPI.php - About 2 hrs to fix

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

                                        public function drawPDF()
                                        {
                                            $pdf = new \FPDF('P', 'mm', 'Letter');
                                    
                                            $pdf->SetTopMargin($this->top);  //Set top margin of the page
                                    Severity: Major
                                    Found in fannie/classlib2.0/item/signage/PageOfTags.php - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language