Showing 8,683 of 8,684 total issues
Method PopulateDictionary
has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring. Open
private object PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, string id)
{
IWrappedDictionary wrappedDictionary = dictionary as IWrappedDictionary;
object underlyingDictionary = wrappedDictionary != null ? wrappedDictionary.UnderlyingDictionary : dictionary;
- 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 GetInfo
has a Cognitive Complexity of 52 (exceeds 20 allowed). Consider refactoring. Open
internal unsafe bool GetInfo()
{
IntPtr udev = NativeMethods.udev_new();
if (IntPtr.Zero != udev)
{
- 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 ProdUserModule.php
has 399 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2014 Whole Foods Co-op, Duluth, MN
Method body_content
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function body_content()
{
global $FANNIE_URL;
$sql = WfcHtLib::hours_dbconnect();
Method csv_content
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
function csv_content(){
$ret = "UPC,Description,Vendor,Account#,Dept#,\"Dept Name\",Qty,Cost,Unit Cost Total,Normal Retail,Status,Normal Retail Total,Location\r\n";
$totals = array();
$vendors = array();
$manuals = array();
Method get_orderID_view
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_orderID_view()
{
$orderID = (int)$this->orderID;
if ($orderID === 0) {
return '<div class="alert alert-danger">Invalid order. <a href="OrderViewPage.php">Create new order</a>?</div>';
File ESCPOSPrintHandler.php
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace COREPOS\pos\lib\PrintHandlers;
use COREPOS\pos\lib\Bitmap;
use COREPOS\pos\lib\ReceiptLib;
File GumEmailPage.php
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function refnum($transID)
{
$transNo = (int)$this->conf->get("transno");
$cashierNo = (int)$this->conf->get("CashierNo");
$laneNo = (int)$this->conf->get("laneno");
- 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 194.
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
public function refnum($transID)
{
$transNo = (int)$this->conf->get("transno");
$cashierNo = (int)$this->conf->get("CashierNo");
$laneNo = (int)$this->conf->get("laneno");
- 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 194.
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
Method HandleDeviceMessage
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected virtual void HandleDeviceMessage(byte[] msg){
if (this.verbose_mode > 0)
System.Console.Write("DMSG: {0}: ",current_state);
if (msg == null) msg = new byte[0];
File SPH_Datacap_PDCX.cs
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System;
using System.IO;
using System.Threading;
using System.Net;
using System.Net.Sockets;
Class JValue
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
public class JValue : JToken, IEquatable<JValue>, IFormattable, IComparable, IComparable<JValue>
#if !(NETFX_CORE || PORTABLE)
, IConvertible
#endif
{
Method handleResponseDataCap
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleResponseDataCap($xml)
{
$rawXml = $xml;
$ref = $this->refnum($this->conf->get('paycard_id'));
$transID = $this->conf->get('paycard_id');
Method lookupTransaction
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function lookupTransaction($ref, $local, $mode)
{
$wsParams = array(
'merchant' => $this->conf->get('MercuryE2ETerminalID'),
'pw' => $this->conf->get('MercuryE2EPassword'),
Method get_view
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$editCSS = 'collapse';
$includeList = false;
if (FannieAuth::validateUserQuiet('hr_editor') || FannieAuth::validateUserQuiet('illness_editor')) {
Method get_createBatchAdv_view
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_createBatchAdv_view()
{
$i = FormLib::get('i');
$rounder = new \COREPOS\Fannie\API\item\PriceRounder();
$date1 = new DateTime();
Method get
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function get($session){
$DESIRED_TENDERS = array("CK"=>"CHECK TENDERS",
"CC"=>"CREDIT CARD TENDERS",
"CA"=>"CASH TENDERS",
Method process_file
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_file($linedata, $indexes)
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
$VENDOR_ID = $this->getVendorID();
Method get_view
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$stores = FormLib::storePicker();
$months = '<option value="">Select month...</option>';
for ($i=1; $i<=12; $i++) {