Showing 8,683 of 8,684 total issues
Function process_file
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function process_file($linedata, $indexes)
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function normalizeColumnAttributes
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
private function normalizeColumnAttributes($db_name, $mode=BasicModel::NORMALIZE_MODE_CHECK)
{
$current = $this->connection->detailedDefinition($this->name);
$dbms = $this->connection->dbmsName();
$recase_columns = array();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method voidid
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function voidid($itemNum, $json)
{
$row = $this->getLine($itemNum);
$upc = $row["upc"];
Method get
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function get($session)
{
$DESIRED_TENDERS = is_array($session->get("TRDesiredTenders")) ? $session->get('TRDesiredTenders') : array();
$DESIRED_TENDERS = array_merge($DESIRED_TENDERS, array(
Method get_view
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_view()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->OP_DB);
Method form_content
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function form_content()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
Method printItems
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function printItems($items, $curPlu=false, $withCancel=true)
{
$ret = '';
$i = 0;
$dbc = FannieDB::get($this->config->get('OP_DB'));
Method getFile
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFile($filename)
{
$csv = fopen($filename, 'w');
$query = '
SELECT p.upc,
Method drawItem
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function drawItem($pdf, $item, $row, $column)
{
$item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
$item['description'] = str_replace(" ", " ", $item['description']);
$effective_width = $this->width - (2*$this->left);
Method drawItem
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function drawItem($pdf, $item, $row, $column)
{
$item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
$item['description'] = str_replace(" ", " ", $item['description']);
$effective_width = $this->width - (2*$this->left);
Method drawItem
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function drawItem($pdf, $item, $row, $column)
{
$item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
$item['description'] = str_replace(" ", " ", $item['description']);
$effective_width = $this->width - (2*$this->left);
Method drawItem
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function drawItem($pdf, $item, $row, $column)
{
$item['description'] = preg_replace("/[^\x01-\x7F]/"," ", $item['description']);
$item['description'] = str_replace(" ", " ", $item['description']);
$effective_width = $this->width - (2*$this->left);
Method process_file
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process_file($linedata, $indexes)
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
Method get_view
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_view()
{
$dbc = FannieDB::get($this->config->get('OP_DB'));
$model = new ShrinkReasonsModel($dbc);
$reasons = array(0 => 'n/a');
Method calculateMargin
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function calculateMargin($price, $cost, $deptID, $upc)
{
$dbc = $this->db();
$desired_margin = 'Unknown';
Method CalculateSize
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
private int CalculateSize(BsonToken t)
{
switch (t.Type)
{
case BsonType.Object:
Method ResolveReferences
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
private JsonSchema ResolveReferences(JsonSchema schema)
{
if (schema.DeferredReference != null)
{
string reference = schema.DeferredReference;
Identical blocks of code found in 2 locations. Consider refactoring. Open
function sanitizeFieldQuoting($current_value)
{
// quoted must not contain single quotes
$current_value = str_replace("'", '', $current_value);
// must not start with backslash
- 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 143.
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
private function sanitizeString($current_value)
{
// quoted must not contain single quotes
$current_value = str_replace("'", '', $current_value);
// must not start with backslash
- 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 143.
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 EpScaleLib.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2014 Whole Foods Co-op, Duluth, MN