Showing 8,683 of 8,684 total issues
File UpdateUploadPage.php
has 350 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
} else {
fprintf($csv, '%.2f%s', $row['special_price'], $sep);
fwrite($csv, date('m/d/Y', strtotime($row['start_date'])) . $sep);
$ts = strtotime($row['end_date']);
$next = mktime(0,0,0, date('n',$ts), date('j',$ts)+1, date('Y', $ts));
- 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 170.
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 ($row['special_price'] != 0 && $row['special_price'] < $row['normal_price'] && $row['datedSigns'] && $row['specialpricemethod'] == 0 && $row['discounttype'] == 1 && $this->dbc->getValue($saleP, array($row['upc']))) {
fprintf($csv, '%.2f%s', $row['special_price'], $sep);
fwrite($csv, date('m/d/Y', strtotime($row['start_date'])) . $sep);
$ts = strtotime($row['end_date']);
$next = mktime(0,0,0, date('n',$ts), date('j',$ts)+1, date('Y', $ts));
- 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 170.
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 potentialItems
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function potentialItems($wicData)
{
$ret = "";
$categories = array();
foreach ($wicData as $balanceRecord) {
Method process_file
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_file($linedata, $indexes)
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$idP = $dbc->prepare("
Method fetch_report_data
has 109 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_data_view
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_data_view()
{
$dbc = Fanniedb::get($this->config->get('op_db'));
$storeID = FormLib::get('store', false);
Method post_printFY_handler
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
function post_printFY_handler()
{
global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['GiveUsMoneyDB']);
if (!class_exists('FPDF')) {
Method body_content
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content(){
ob_start();
$elem = '#upc_in';
$this->add_onload_command('$(\'#upc_in\').focus();');
?>
File ShrinkTool.php
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Community Co-op
Method prepareDataCapAuth
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prepareDataCapAuth($type, $amount, $prompt=false)
{
$request = new PaycardRequest($this->refnum($this->conf->get('paycard_id')), PaycardLib::paycard_db());
$request->setProcessor($this->proc_name);
$tranCode = $amount > 0 ? 'Sale' : 'Return';
Method cleanup
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function cleanup($json)
{
switch ($this->conf->get("paycard_mode")) {
case PaycardLib::PAYCARD_MODE_ADDVALUE:
case PaycardLib::PAYCARD_MODE_ACTIVATE:
Method sendVoid
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sendVoid($domain="w1.mercurypay.com")
{
// initialize
$dbTrans = Database::tDataConnect();
if (!$dbTrans) {
Method programOK
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function programOK($pKey='', $conn='')
{
global $CORE_LOCAL;
if (!$CORE_LOCAL->get("memberID")) {
Method body_content
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content()
{
global $FANNIE_ROOT, $FANNIE_URL;
$ret = '';
Method css_content
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function css_content()
{
return <<<HTML
span.grey {
color: grey;
Method css_content
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function css_content()
{
return <<<HTML
span.grey {
color: grey;
Method WFC_Windows
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WFC_Windows($data,$offset=0){
$pdf=new WFC_Windows_PDF('P','mm','Letter'); //start new instance of PDF
$pdf->Open(); //open new PDF Document
$pdf->SetTopMargin(40); //Set top margin of the page
Method ValidateCurrentToken
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void ValidateCurrentToken()
{
// first time validate has been called. build model
if (_model == null)
{
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (count($lines) > 1) {
$pdf->SetXY($x,$y+13);
$pdf->Cell($width, 5, $lines[0], 0, 1, 'C', true);
$pdf->SetXY($x, $y+19);
$pdf->Cell($width, 5, $lines[1], 0, 1, 'C', true);
- 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 169.
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