CORE-POS/IS4C

View on GitHub

Showing 8,683 of 8,684 total issues

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

        [CLSCompliant(false)]
        public static explicit operator ushort?(JToken value)
        {
            if (value == null)
                return null;
pos/is4c-nf/scale-drivers/drivers/NewMagellan/Newtonsoft.Json/Linq/JToken.cs on lines 868..884
pos/is4c-nf/scale-drivers/drivers/NewMagellan/Newtonsoft.Json/Linq/JToken.cs on lines 973..989
pos/is4c-nf/scale-drivers/drivers/NewMagellan/Newtonsoft.Json/Linq/JToken.cs on lines 996..1012

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

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

    mod.initState = function(s) {
        if (typeof s == 'object') {
            state = s;
            if (state['onHand1'].__proto__ == Array.prototype) {
                state['onHand1'] = {};
Severity: Major
Found in fannie/modules/plugins2.0/RP/rpDual.js - About 2 hrs to fix

    Function wordCount has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var wordCount = (function($) {
        var mod = {};
    
        var outputMsg = function(number, limit, noun) {
            var msg = "";
    Severity: Major
    Found in fannie/item/wordCount.js - About 2 hrs to fix

      Function addVendorDialog has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          mod.addVendorDialog = function() {
              var v_dialog = $('#newVendorDialog').dialog({
                  autoOpen: false,
                  height: 300,
                  width: 300,
      Severity: Major
      Found in fannie/item/modules/baseItem.js - About 2 hrs to fix

        Method preprocess has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function preprocess()
            {
                // I haven't tracked down the cause but some mechanisms for getting here
                // do NOT unset msgrepeat which leads to an approval immediately triggering
                // into another ewic transaction
        Severity: Major
        Found in pos/is4c-nf/plugins/Paycards/gui/PaycardEmvWic.php - About 2 hrs to fix

          Method preprocess has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function preprocess()
              {
                  if (FormLib::get('token', false)) {
                      $token = json_decode(FormLib::get('token'), true);
                      $amt = FormLib::get('amount');
          Severity: Major
          Found in pos/is4c-nf/plugins/StripeDotCom/gui/StripeCreditPage.php - About 2 hrs to fix

            Method readCrontab has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function readCrontab()
                {
                    global $FANNIE_ROOT;
                    $pct = popen('crontab -l 2>&1','r');
                    $lines = array();
            Severity: Major
            Found in fannie/cron/management/CronManagementPage.php - About 2 hrs to fix

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

                  public function get_id_view()
                  {
                      $dbc = $this->connection;
                      $date = FormLib::get('date', false);
                      $id = FormLib::get('id', 6);
              Severity: Major
              Found in fannie/batches/CAP/EdlpBatchPage.php - About 2 hrs to fix

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

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

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

                      function process_file($linedata, $indexes)
                      {
                          $prefix = FormLib::get('prefix');
                          $start = FormLib::get('start');
                          $end = FormLib::get('end');
                  Severity: Major
                  Found in fannie/batches/EndCapper/EndCapUpload.php - About 2 hrs to fix

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

                        protected function get_view()
                        {
                            $parameters = new ParametersModel($this->connection);
                            $all = $parameters->find(array('param_key', 'store_id', 'lane_id'));
                    
                    
                    Severity: Major
                    Found in fannie/admin/LaneParameters/LaneParametersEditor.php - About 2 hrs to fix

                      Method javascriptContent has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function javascriptContent()
                          {
                              return <<<JAVASCRIPT
                      $('input[type="checkbox"][name="expired"]').click(function(){
                          //window.location.reload();
                      Severity: Major
                      Found in fannie/modules/plugins2.0/WfcClassRegistry/WfcClassRegistryPage.php - About 2 hrs to fix

                        Method javascript_content has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function javascript_content()
                            {
                                $lastEdited = FormLib::get('editable', "false");
                        
                                return <<<JAVASCRIPT
                        Severity: Major
                        Found in fannie/admin/PosKeyboards/KeyboardView.php - About 2 hrs to fix

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

                              function body_content(){
                                  global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS, $FANNIE_URL;
                                  $ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
                          
                                  if ($this->display_func == 'ts_error')
                          Severity: Major
                          Found in fannie/modules/plugins2.0/TimesheetPlugin/ViewsheetPage.php - About 2 hrs to fix

                            Method AutoFill has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function AutoFill($meminfo)
                                {
                                    $this->SetFont('Arial','',10);
                                    
                                    if ($meminfo['stock']['paid-in-full']) {
                            Severity: Major
                            Found in fannie/modules/plugins2.0/PIKiller/sub/SubAgreement.php - About 2 hrs to fix

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

                                  public function run()
                                  {
                                      $settings = $this->config->get('PLUGIN_SETTINGS');
                                      $dbc = FannieDB::get($settings['InstaCartDB']);
                              
                              
                              Severity: Major
                              Found in fannie/modules/plugins2.0/InstaCart/InstaImportTask.php - About 2 hrs to fix

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

                                    public function fetch_report_data()
                                    {
                                        $settings = $this->config->get('PLUGIN_SETTINGS');
                                        $warehouse = $settings['WarehouseDatabase'] . $this->connection->sep();
                                        $myweb = $settings['MyWebDB'] . $this->connection->sep();
                                Severity: Major
                                Found in fannie/modules/plugins2.0/CoreWarehouse/reports/CwTopReport.php - About 2 hrs to fix

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

                                      public function get_view()
                                      {
                                          $dbc = $this->connection;
                                          $settings = $this->config->get('PLUGIN_SETTINGS');
                                          $dbc->selectDB($settings['VolunteerHoursDB']);
                                  Severity: Major
                                  Found in fannie/modules/plugins2.0/VolunteerHours/VhEnterHoursPage.php - About 2 hrs to fix

                                    Method body_content has 57 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/CoopCredConfigEditor.php - About 2 hrs to fix

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

                                          public function get_view()
                                          {
                                              $dbc = FannieDB::get($this->config->get('OP_DB'));
                                              $save = FormLib::get('save');
                                              $uid = FormLib::get('uid');
                                      Severity: Major
                                      Found in fannie/modules/plugins2.0/GiftCardTracker/GiftCardTracker.php - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language