Showing 8,683 of 8,684 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
else if (contract.DefaultCreator != null && (!contract.DefaultCreatorNonPublic || Serializer._constructorHandling == ConstructorHandling.AllowNonPublicDefaultConstructor))
{
object list = contract.DefaultCreator();
if (contract.ShouldCreateWrapper)
- 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 192.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
else if (contract.DefaultCreator != null && (!contract.DefaultCreatorNonPublic || Serializer._constructorHandling == ConstructorHandling.AllowNonPublicDefaultConstructor))
{
object dictionary = contract.DefaultCreator();
if (contract.ShouldCreateWrapper)
- 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 192.
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 BasicCorePage.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2007,2010 Whole Foods Co-op
File New_WFC_Deli_Regular.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use COREPOS\Fannie\API\FanniePlugin;
if (!class_exists('FpdfWithBarcode')) {
include(dirname(__FILE__) . '/../FpdfWithBarcode.php');
}
File PayrollSummaryPage.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php # payroll.php - Generates a bi-monthly statement from timesheet table.
include(dirname(__FILE__).'/../../../config.php');
if (!class_exists('FannieAPI')) {
include_once(__DIR__ . '/../../../classlib2.0/FannieAPI.php');
}
Method varied_message
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function varied_message($ref, $reprint=false, $sigSlip=false)
{
if (CoreLocal::get('autoReprint') == 1) {
$sigSlip = true;
}
Method run
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
$dbc = FannieDB::get($this->config->get('TRANS_DB'));
$currentMax = $this->findMax($dbc);
Method helpContent
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function helpContent()
{
return '<p>Recalculate suggested retail prices for items from
a given vendor. This takes place in three steps.
<ul>
Method basicForm
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function basicForm()
{
$batchtypes = $this->get_batch_types();
$dbc = FannieDB::get($this->config->get('OP_DB'));
$owners = new MasterSuperDeptsModel($dbc);
Method form_content
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function form_content()
{
ob_start();
?>
<form method="get" class="form-horizontal">
Method fetch_report_data
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$query = '';
Method fetch_report_data
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch_report_data()
{
$dbc = $this->connection;
$tx_dbc = $dbc;
$op_dbc = $dbc;
Method WFC_Deli_Narrow_24UP
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WFC_Deli_Narrow_24UP($data,$offset=0,$showPrice=0)
{
$dbc = FannieDB::get(FannieConfig::config('OP_DB'));
$pdf = new WFC_Deli_Narrow_24UP_PDF('L','mm','Letter');
$pdf->AddPage();
Method WFC_Dark_Extended_24UP
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WFC_Dark_Extended_24UP($data,$offset=0,$showPrice=0)
{
$dbc = FannieDB::get(FannieConfig::config('OP_DB'));
$pdf = new WFC_Dark_Extended_24UP_PDF('L','mm','Letter');
$pdf->AddPage();
Method WFC_Deli_Short_24UP
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WFC_Deli_Short_24UP($data,$offset=0,$showPrice=0)
{
$dbc = FannieDB::get(FannieConfig::config('OP_DB'));
$pdf = new WFC_Deli_Short_24UP_PDF('L','mm','Letter');
$pdf->AddPage();
Method run
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
$settings = $this->config->get('PLUGIN_SETTINGS');
$dbc = FannieDB::get($settings['ScheduledEmailDB']);
Method get_view
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$hrEdit = FannieAuth::validateUserQuiet('hr_editor');
$illnessEdit = FannieAuth::validateUserQuiet('illness_editor');
$ret = '<table class="table table-bordered table-striped">';
Method run
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
$settings = $this->config->get('PLUGIN_SETTINGS');
$dbc = FannieDB::get($settings['CommentDB']);
$cmP = $dbc->prepare("SELECT * FROM Comments WHERE categoryID=? AND ccNotified=0");
Method fetch_report_data
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch_report_data()
{
$dbc = FannieDB::get('HoursTracking');
// get level info
Method body_content
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content(){
global $FANNIE_OP_DB, $FANNIE_PLUGIN_SETTINGS;
$ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
if ($this->display_func == 'ts_error')
return $this->error_content();