Showing 8,683 of 8,684 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2014 Whole Foods Co-op
- 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 221.
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 StoreSummaryReport.php
has 450 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Method fetch_report_data
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_report_data()
{
$dbc = $this->connection;
$dbc->setDefaultDB($this->config->get('OP_DB'));
$d1 = $this->form->date1;
Method get_view
has 170 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$authorized = false;
if (FannieAuth::validateUserQuiet('ordering_edit')) {
$authorized = true;
Method checkQualifications
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function checkQualifications($coupID, $quiet=false)
{
$infoW = $this->lookupCoupon($coupID);
if ($infoW === false) {
return $this->errorOrQuiet(_("coupon not found"), $quiet);
Method body_content
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content()
{
global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_COOP_ID;
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
Method get_id_view
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_id_view()
{
$settings = $this->config->get('PLUGIN_SETTINGS');
$dbc = FannieDB::get($settings['WarehouseDatabase']);
Function body_content
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
function body_content(){
global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
$ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
include('./includes/header.html');
- 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 getTopImage
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
private function getTopImage($item)
{
// Manual Signs Page && smartType override checked takes precedence
if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
return __DIR__ . '/noauto/images/codeals_top_12.png';
- 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 drawPage
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
function drawPage()
{
if (!($this->config instanceof FannieConfig)) {
$this->config = FannieConfig::factory();
}
- 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 load
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function load($filename, $filedata=null)
{
$data = "";
if ($filename === true) {
$data = $filedata;
Method run
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run($args=array())
{
global $FANNIE_URL;
$data = array();
$action = FormLib::get_form_value('action');
Method preprocess
has 168 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 settingChange
has 167 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function settingChange() {
global $FANNIE_PLUGIN_SETTINGS;
$db_name = $FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB'];
if (empty($db_name)) return;
Method addItem
has 166 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addItem(array $row, $quantity, $priceObj)
{
if ($quantity == 0) return false;
$pricing = $priceObj->priceInfo($row,$quantity);
File rpOrder.js
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
var rpOrder = (function ($) {
var mod = {};
var state = {
'retention': 60,
File WFC_Hybrid.php
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
if (!class_exists('FpdfWithBarcode')) {
include(dirname(__FILE__) . '/../FpdfWithBarcode.php');
}
if (!class_exists('FpdfLib')) {
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (isset($lines[$i+1]) && (strlen($lines[$i]) + strlen($lines[$i+1])) < 56) {
// don't columnize the amount lines
if (strstr($lines[$i], 'AMOUNT') || strstr($lines[$i+1], 'AMOUNT')) {
$slip .= ReceiptLib::centerString($lines[$i]) . "\n";
} elseif (strstr($lines[$i], 'TOTAL') || strstr($lines[$i+1], 'TOTAL')) {
- 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 216.
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
if (isset($lines[$i+1]) && (strlen($lines[$i]) + strlen($lines[$i+1])) < 56) {
// don't columnize the amount lines
if (strstr($lines[$i], 'AMOUNT') || strstr($lines[$i+1], 'AMOUNT')) {
$slip .= ReceiptLib::centerString($lines[$i]) . "\n";
} elseif (strstr($lines[$i], 'TOTAL') || strstr($lines[$i+1], 'TOTAL')) {
- 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 216.
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 3 locations. Consider refactoring. Open
public function reload($trans_db,$start_month,$start_year,$end_month=False,$end_year=False)
{
if (!$end_month) {
$end_month = $start_month;
}
- 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 216.
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