Showing 8,683 of 8,684 total issues
Method saveFormData
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
function saveFormData($upc)
{
$FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
$upc = BarcodeLib::padUPC($upc);
$dbc = $this->db();
Method Operation
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static bool Operation(ExpressionType operation, object objA, object objB, out object result)
{
if (objA is string || objB is string)
{
if (operation == ExpressionType.Add || operation == ExpressionType.AddAssign)
Function orderView
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
var orderView = (function($) {
var mod = {};
var forceUPC = true;
mod.forceUPC = function(f) {
- 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 preprocess
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
function preprocess()
{
// check for posts before drawing anything, so we can redirect
if (FormLib::get('reginput', false) !== false) {
$input = strtoupper(trim(FormLib::get('reginput')));
- 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 fetch_report_data
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
- 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 updateSalesCache
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
protected function updateSalesCache($week, $num_cached, $dateInfo)
{
$class_lib = $this->class_lib;
$dbc = $class_lib::getDB();
$sales = $class_lib::getCache($dbc);
- 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 35 (exceeds 5 allowed). Consider refactoring. Open
public function body_content()
{
$db = WfcHtLib::hours_dbconnect();
$ppID = -1;
- 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 35 (exceeds 5 allowed). Consider refactoring. Open
public function process_file($linedata, $indexes)
{
$getStoreP = $this->connection->prepare("SELECT posID FROM LbmxStores WHERE lbmxID=?");
$getVendorP = $this->connection->prepare("SELECT posID FROM LbmxVendors WHERE lbmxID=?");
$getPoP = $this->connection->prepare("SELECT orderID FROM PurchaseOrder WHERE storeID=? AND vendorID=? AND vendorInvoiceID=?");
- 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 preprocess
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
function preprocess(){
global $FANNIE_EQUITY_DEPARTMENTS;
global $FANNIE_OP_DB;
global $FANNIE_EMP_NO, $FANNIE_REGISTER_NO;
global $FANNIE_CORRECTION_DEPT;
- 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 drawPDF
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
public function drawPDF()
{
$pdf = new \FPDF('P', 'mm', 'Letter');
$pdf->SetMargins(6.35, 6.35, 6.35);
$pdf->SetAutoPageBreak(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 filterSales
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
private function filterSales($items, $form)
{
if ($form->onsale !== '') {
$where = '1=1';
- 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 GetSerializableMembers
has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring. Open
protected virtual List<MemberInfo> GetSerializableMembers(Type objectType)
{
bool ignoreSerializableAttribute;
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
ignoreSerializableAttribute = IgnoreSerializableAttribute;
- 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 CreateObjectUsingCreatorWithParameters
has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring. Open
private object CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor<object> creator, string id)
{
ValidationUtils.ArgumentNotNull(creator, "creator");
// 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 get_id_view
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_view()
{
$deptP = $this->connection->prepare("SELECT dept_ID FROM superdepts WHERE superID=?");
$depts = $this->connection->getAllValues($deptP, array($this->id));
list($inStr, $args) = $this->connection->safeInClause($depts);
File PriceRuleEditor.php
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2015 Whole Foods Co-op
Method post_handler
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_handler()
{
$this->saveForm();
$pdf = new FPDF('P', 'in', array(3.5, 1.25));
$pdf->SetMargins(0, 0, 0);
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function post_section_handler()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$section = FormLib::get('section');
- 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 188.
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 post_section_handler()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$section = FormLib::get('section');
- 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 188.
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 StatementsPluginBusiness.php
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
include_once(dirname(__FILE__) . '/../../../config.php');
if (!class_exists('FannieAPI')) {
include(dirname(__FILE__) . '/../../../classlib2.0/FannieAPI.php');
}
Method get_id_confirm_view
has 130 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_id_confirm_view()
{
$ret = '';