Showing 8,683 of 8,684 total issues
Method unitTest
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function unitTest($phpunit)
{
$get = $this->get_view();
$phpunit->assertNotEquals(0, strlen($get));
Method process_file
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_file($linedata, $indexes)
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$VENDOR_ID = $this->getVendorID();
Method form_content
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function form_content()
{
$startH = '';
$endH = '';
foreach (range(1, 12) as $h) {
Method fetch_report_data
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_report_data()
{
$dbc = $this->connection;
$group = FormLib::get('group', 'Super Department');
switch ($group) {
Method calculate_footers
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calculate_footers($data)
{
switch($this->multi_counter){
case 1:
$this->report_headers[0] = 'Tenders';
Method fetch_report_data
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch_report_data()
{
global $FANNIE_OP_DB, $FANNIE_TRANS_DB;
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
Method fetch_report_data
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_report_data()
{
$dbc = $this->connection;
$group = FormLib::get('group', 'Super Department');
switch ($group) {
Method dataFromTags
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function dataFromTags($dbc, $tagID)
{
if (!is_array($tagID)) {
$tagID = array($tagID);
}
Method get_view
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_view()
{
$dbc = FannieDB::getReadOnly($this->config->get('OP_DB'));
$deptsQ = $dbc->prepare("select dept_no,dept_name from departments order by dept_no");
$deptsR = $dbc->execute($deptsQ);
Method getPlanSales
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getPlanSales($weekID)
{
if ($weekID >= 374) {
$prep = $this->connection->prepare("select c.obfCategoryID, m.superID, b.storeID, b.planGoal
from " . FannieDB::fqn('ObfBudget', 'plugin:ObfDatabaseV2') . " AS b
Method get_batchID_view
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_batchID_view()
{
if (!is_array($this->batchID)) {
$this->batchID = array($this->batchID);
}
Method body_content
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content(){
global $FANNIE_PLUGIN_SETTINGS;
global $FANNIE_URL;
Method get_id_view
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_view()
{
$model = new MenuScreensModel($this->connection);
$model->menuScreenID($this->id);
$model->load();
Method post_handler
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_handler()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get(('OP_DB')));
$upcs = FormLib::get('upc', array());
Method drawPDF
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function drawPDF()
{
$pdf = new \FPDF('P', 'mm', 'Letter');
$pdf = $this->loadPluginFonts($pdf);
Method editorLinksArea
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function editorLinksArea($upc, $isNew, $authorized)
{
$url = $this->config->get('URL');
$self = filter_input(INPUT_SERVER, 'PHP_SELF');
$ret = '<p>';
Method getBasics
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getBasics($store, $super)
{
$query = "SELECT m.super_name AS name, MAX(m.superID) AS superID,
SUM(percentageStoreSales) AS percentage,
SUM(CASE WHEN p.cost <> 0 AND normal_price <> 0 THEN 1 ELSE 0 END) as hasCost,
Method filterSales
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function filterSales($items, $form)
{
if ($form->onsale !== '') {
$where = '1=1';
Method get_id_print_handler
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_id_print_handler()
{
//$store = COREPOS\Fannie\API\lib\Store::getIdByIp();
//$mtLength = $store == 1 ? 3 : 7;
Similar blocks of code found in 2 locations. Consider refactoring. Open
mod.updatePartial = function(batchID) {
var dstr = $('.partialBatch').serialize() + '&partialID=' + batchID;
$.ajax({
type: 'post',
data: dstr
- 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 78.
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