Showing 8,683 of 8,684 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
private function rtfToHtml($rtf)
{
$temp = tempnam(sys_get_temp_dir(), 'rtf');
file_put_contents($temp, $rtf);
exec("unrtf {$temp}", $output);
- 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 155.
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
Function mk
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
var mk = (function ($) {
var mod = {};
var lineGraph = function(elem, name, labels, data1, data2) {
var ctx = document.getElementById(elem);
Method head_content
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function head_content()
{
?>
<script type="text/javascript" >
var prevKey = -1;
Method get
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function get($session)
{
$shiftCutoff = date('Y-m-d 00:00:00');
$excl = " AND emp_no <> 9999 ";
Method fetch_report_data
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$info = FormLib::standardItemFromWhere();
Method generateNewMeat_24UPTag
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateNewMeat_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
{
$upc = $row['upc'];
//$brand = strToUpper($row['brand']);
$brand = $row['brand'];
Method generateMeat_24UPTag
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateMeat_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
{
$upc = $row['upc'];
$brand = strToUpper($row['brand']);
$price = $row['normal_price'];
Method No_Barcode
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function No_Barcode($data,$offset=0)
{
$pdf=new No_Barcode_PDF('P','mm','Letter'); //start new instance of PDF
$pdf->Open(); //open new PDF Document
Method generateMeat_SN_24UPTag
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateMeat_SN_24UPTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc, $showPrice, $offset, $tagNo)
{
$upc = $row['upc'];
$brand = strToUpper($row['brand']);
$price = $row['normal_price'];
Method post_date_trans_store_handler
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function post_date_trans_store_handler()
{
global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_PLUGIN_SETTINGS;
$dbc = FannieDB::get($FANNIE_OP_DB);
$dlog = DTransactionsModel::selectDtrans($this->date);
Method updateVendors
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateVendors($data)
{
$vendLC = new VendorLikeCodeMapModel($this->connection);
$activeP = $this->connection->prepare("SELECT storeID FROM LikeCodeActiveMap WHERE inUse=1 AND likeCode=?");
$catP = $this->connection->prepare("
Method ReadContentFrom
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
internal void ReadContentFrom(JsonReader r)
{
ValidationUtils.ArgumentNotNull(r, "r");
IJsonLineInfo lineInfo = r as IJsonLineInfo;
File login.php
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2009 Whole Foods Co-op
File PrintHandler.php
has 317 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 OrderGuidePage.php
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
include(dirname(__FILE__) . '/../config.php');
if (!class_exists('FannieAPI')) {
include_once(__DIR__ . '/../classlib2.0/FannieAPI.php');
Method Fannie_Standard
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Fannie_Standard($data,$offset=0){
$hspace = 0.79375;
$h = 29.36875;
$top = 12.7 + 2.5;
$left = 4.85 + 1.25;
Method getView
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getView()
{
$dbc = FannieDB::get(FannieConfig::config('OP_DB'));
return <<<HTML
Method form_content
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function form_content(){
global $FANNIE_PLUGIN_SETTINGS;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
Method form_content
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function form_content(){
global $FANNIE_PLUGIN_SETTINGS;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
Method get_view
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$today = date('Y-m-d');
$orders = $this->getOrders();
$jsonData = json_encode($orders['json']);