Showing 8,683 of 8,684 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function definition()
{
$ar_depts = FannieConfig::config('AR_DEPARTMENTS', '');
$ret = preg_match_all('/[0-9]+/', $ar_depts, $depts);
if ($ret == 0) {
- 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 184.
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
public function definition()
{
$eq_depts = FannieConfig::config('EQUITY_DEPARTMENTS', '');
$ret = preg_match_all('/[0-9]+/', $eq_depts, $depts);
if ($ret == 0) {
- 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 184.
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 post_u_view
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_u_view()
{
$ret = '';
$ret .= '<form action="' . filter_input(INPUT_SERVER, 'PHP_SELF') . '" method="post" id="signform">';
$mods = FannieAPI::listModules('\COREPOS\Fannie\API\item\FannieSignage');
Method show_sheet
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
function show_sheet($emp_no, $periodID){
global $FANNIE_PLUGIN_SETTINGS, $FANNIE_OP_DB;
$ts_db = FannieDB::get($FANNIE_PLUGIN_SETTINGS['TimesheetDatabase']);
include ('./includes/header.html');
Method fetch_report_data
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$d1 = FormLib::get('date1', date('Y-m-d'));
Method SerializeNode
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void SerializeNode(JsonWriter writer, IXmlNode node, XmlNamespaceManager manager, bool writePropertyName)
{
switch (node.NodeType)
{
case XmlNodeType.Document:
File index.php
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use COREPOS\Fannie\API\item\StandardAccounting;
include('../../../../config.php');
include(__DIR__ . '/../../../../classlib2.0/FannieAPI.php');
$dbc = FannieDB::get($FANNIE_OP_DB);
Method preprocess
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
function preprocess()
{
$this->conf = new PaycardConf();
$choice = FormLib::get('selectlist', false);
if ($choice !== false) {
Method body_content
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content(){
//Should this really be done with global?
//global $FANNIE_URL, $FANNIE_EQUITY_DEPARTMENTS;
include(dirname(__FILE__) . '/../../config.php');
ob_start();
Method get_id_view
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_view()
{
$doAvg = FormLib::get('doAvg', 1);
$doTop = FormLib::get('doTop', 1);
$ids = is_array($this->id) ? $this->id : explode("\n", $this->id);
ViewPurchaseOrders
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class ViewPurchaseOrders extends FannieRESTfulPage
{
protected $header = 'Purchase Orders';
protected $title = 'Purchase Orders';
Method get_schedule_view
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_schedule_view()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
Function superDept
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
var superDept = (function($) {
var mod = {};
var showAlert = function(type, msg) {
var alertbox = '<div class="alert alert-' + type + '" role="alert">';
Method addItem
has 124 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);
Method get_id_handler
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_id_handler()
{
$emp_no = $this->id;
$dbc = $this->connection;
$dbc->selectDB($this->config->get('TRANS_DB'));
Method run
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
$dbc = FannieDB::get($this->config->get('OP_DB'));
$settings = $this->config->get('PLUGIN_SETTINGS');
Method get_view
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$memtype = new MemtypeModel($this->connection);
$memtype = $memtype->toOptions(-999);
$couponR = $this->connection->query('SELECT coupID, description FROM houseCoupons ORDER BY startDate DESC');
Method standardDepartmentFields
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function standardDepartmentFields($super='super',$multi='departments',$start='deptStart',$end='deptEnd', $subs='subdepts')
{
/**
Precalculate options for superdept and dept selects
*/
Method get_vendor_view
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_vendor_view()
{
try {
$store = $this->form->store;
} catch (Exception $ex) {
File DatabarCoupon.php
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2010 Whole Foods Co-op