Showing 8,683 of 8,684 total issues
Method get_view
has 195 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_view()
{
global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
$TRANS = $FANNIE_TRANS_DB . $dbc->sep();
Method get_id_view
has 195 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_view()
{
$items = array(
293 => $this->getItems(293),
292 => $this->getItems(292),
Method displayCashier
has 194 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayCashier($date,$empno,$mode)
{
global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
$store = FormLib::get('store', 1);
Function printReceipt
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
static public function printReceipt($arg1, $ref, $second=False, $email=False)
{
if($second) $email = False; // store copy always prints
if($arg1 != "full") $email = False;
$reprint = $arg1 == 'reprint' ? true : 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
Function process_file
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
function process_file($linedata, $indexes)
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
$VENDOR_ID = $this->getVendorID();
- 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
Function body_content
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
function body_content()
{
include(dirname(__FILE__) . '/../config.php');
ob_start();
?>
- 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 SerializeNode
has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring. Open
private void SerializeNode(JsonWriter writer, IXmlNode node, XmlNamespaceManager manager, bool writePropertyName)
{
switch (node.NodeType)
{
case XmlNodeType.Document:
- 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 PopulateObject
has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring. Open
private object PopulateObject(object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, string id)
{
OnDeserializing(reader, contract, newObject);
// only need to keep a track of properies presence if they are required or a value should be defaulted if missing
- 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 ParseArrayIndexer
has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring. Open
private PathFilter ParseArrayIndexer(char indexerCloseChar)
{
int start = _currentIndex;
int? end = null;
List<int> indexes = null;
- 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 DateTimeUtils.cs
has 489 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System;
using System.IO;
using System.Xml;
using System.Globalization;
Method get_dealSet_cycle_view
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_dealSet_cycle_view()
{
include(__DIR__.'/../../config.php');
$cycle = FormLib::get('cycle');
$month = FormLib::get('dealSet');
Method generateHerbNspiceLabel
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateHerbNspiceLabel($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
{
$x += 5;
$pdf->SetFont('Gill','', 16);
if (!defined('FPDF_FONTPATH')) {
Method get_id_pdf_handler
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_id_pdf_handler()
{
if (!class_exists('FPDF')) {
include(__DIR__ . '/../../../src/fpdf/fpdf.php');
define('FPDF_FONTPATH','font/');
Method showEditForm
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showEditForm($upc, $display_mode=1, $expand_mode=1)
{
$FANNIE_URL = FannieConfig::config('URL');
$upc = BarcodeLib::padUPC($upc);
File OverShortDayPage.php
has 488 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Method ajax_display_program
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function ajax_display_program($id){
global $FANNIE_PLUGIN_SETTINGS, $FANNIE_URL, $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
Method body_content
has 192 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content()
{
global $FANNIE_URL;
ob_start();
?>
BasicModel
has 54 functions (exceeds 20 allowed). Consider refactoring. Open
class BasicModel
{
/**
Name of the table
*/
File DictionaryWrapper.cs
has 486 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System;
using System.Collections.Generic;
using System.Collections;
using System.Threading;
#if NET20
Similar blocks of code found in 2 locations. Consider refactoring. Open
foreach($data as $k => $row){
$upc = $row['upc'];
if ($i % 14 == 0 && $i != 0) {
$pdf->AddPage('L');
$x = $left;
- 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 237.
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