Showing 8,683 of 8,684 total issues
Function normalize
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
public function normalize($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
{
if ($mode != BasicModel::NORMALIZE_MODE_CHECK && $mode != BasicModel::NORMALIZE_MODE_APPLY) {
echo "Error: Unknown mode ($mode)\n";
return false;
- Read upRead up
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 ReadThread
has a Cognitive Complexity of 69 (exceeds 20 allowed). Consider refactoring. Open
unsafe void ReadThread()
{
if (!HandleAcquire()) { return; }
try
- Read upRead up
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
File extra_config.php
has 517 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use COREPOS\pos\lib\FormLib;
use COREPOS\pos\lib\MiscLib;
use COREPOS\pos\install\conf\Conf;
use COREPOS\pos\install\conf\FormFactory;
File OverShortSafecountPage.php
has 517 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Method post_id_view
has 210 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_id_view()
{
list($date, $tnum) = explode(':', $this->id);
list($emp, $reg, $trans) = explode('-', $tnum);
$storeID = FormLib::get('storeID');
Method handleItem
has 209 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleItem($upc, $row, $scaleStickerItem, $scalepriceUPC, $scalepriceEAN)
{
$ret = $this->default_json();
$myUrl = MiscLib::baseURL();
$dbc = Database::pDataConnect();
Method preprocess
has 209 lines of code (exceeds 25 allowed). Consider refactoring. Open
function preprocess() {
global $FANNIE_CORRECTION_CASHIER, $FANNIE_CORRECTION_LANE, $FANNIE_CORRECTION_DEPT;
global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS,$FANNIE_OP_DB;
Method get_list_view
has 208 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_list_view()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
Function load
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
public function load($filename, $filedata=null)
{
$data = "";
if ($filename === true) {
$data = $filedata;
- Read upRead up
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 ParseNumber
has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring. Open
private void ParseNumber()
{
ShiftBufferIfNeeded();
char firstChar = _chars[_charPos];
- Read upRead up
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 run
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
$start = time();
$dbc = FannieDB::get($this->config->get('OP_DB'));
Method outputPDF
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
function outputPDF(){
global $FANNIE_PLUGIN_SETTINGS;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
$start = FormLib::get_form_value('startDate');
$end = FormLib::get_form_value('endDate');
Method body_content
has 206 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content()
{
global $FANNIE_URL;
/* $hb (helpbit) is an array keyed on the id= of the input being described.
File Database.php
has 509 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2012 Whole Foods Co-op
Method get_view
has 205 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$this->addScript('rpFloral.js?date=20200708');
$store = FormLib::get('store');
if (!$store) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
for ($i=0; $i<count($returnset); $i++) {
if (!isset($returnset[$i]['trans_type']) || !isset($returnset[$i]['trans_status'])) {
continue;
}
if ($returnset[$i]['trans_type'] == 'I' && $returnset[$i]['trans_status'] == 'M') {
- Read upRead up
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 249.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
for ($i=0; $i<count($returnset); $i++) {
if (!isset($returnset[$i]['trans_type']) || !isset($returnset[$i]['trans_status'])) {
continue;
}
if ($returnset[$i]['trans_type'] == 'I' && $returnset[$i]['trans_status'] == 'M') {
- Read upRead up
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 249.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File TransRecord.php
has 507 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2001, 2004 Wedge Community Co-op
Class SPH_SignAndPay_USB
has 57 methods (exceeds 20 allowed). Consider refactoring. Open
public class SPH_SignAndPay_USB : SerialPortHandler {
protected static String MAGELLAN_OUTPUT_DIR = "ss-output/";
protected USBWrapper usb_port;
Method get_id_view
has 204 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_id_view()
{
$id = FormLib::get('id');
$listed = array();