Showing 8,683 of 8,684 total issues
Function get_id_view
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
protected function get_id_view()
{
$settings = $this->config->get('PLUGIN_SETTINGS');
$prefix = $settings['ObfDatabaseV2'] . $this->connection->sep();
$week = FormLib::get('week');
- 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 post_id_handler
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
function post_id_handler()
{
global $FANNIE_OP_DB;
if (!FannieAuth::validateUserQuiet('editmembers') && !FannieAuth::validateUserQuiet('editmembers_csc'))
return $this->unknown_request_handler();
- 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 saveFormData
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function saveFormData($memNum, $json=array())
{
//$dbc = $this->db();
global $FANNIE_URL;
global $FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
- 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 process_file
has a Cognitive Complexity of 41 (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 SaveFormData
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
function SaveFormData($upc){
$upc = BarcodeLib::padUPC($upc);
$ids = FormLib::get_form_value('v_id',array());
$skus = FormLib::get_form_value('v_sku',array());
$costs = FormLib::get_form_value('v_cost',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
Function get_schedule_view
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
public function get_schedule_view()
{
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
Method ResolvePropertyAndCreatorValues
has a Cognitive Complexity of 56 (exceeds 20 allowed). Consider refactoring. Open
private IDictionary<JsonProperty, object> ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType, out IDictionary<string, object> extensionData)
{
extensionData = (contract.ExtensionDataSetter != null) ? new Dictionary<string, object>() : null;
IDictionary<JsonProperty, object> propertyValues = new Dictionary<JsonProperty, object>();
- 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 lookupTransaction
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function lookupTransaction($ref, $local, $mode)
{
$merchantID = $this->conf->get('GoEMerchID');
$password = $this->conf->get('GoEMerchPassword');
$gatewayID = $this->conf->get('GoEmerchGatewayID');
Method body_content
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function body_content()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$transDB = $this->config->get('TRANS_DB') . $dbc->sep();
Method get_id_view
has 156 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_id_view()
{
$settings = $this->config->get('PLUGIN_SETTINGS');
$prefix = $settings['CommentDB'] . $this->connection->sep();
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function getResponse($trans, $transID)
{
$today = date('Ymd');
$sql = "SELECT commErr,
httpCode,
- 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 208.
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 getRequest($trans, $transID)
{
$today = date('Ymd');
// look up the request using transID (within this transaction)
$sql = "SELECT live,
- 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 208.
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 addItem
has 155 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addItem(array $row, $quantity, $priceObj)
{
if ($quantity == 0) {
return false;
}
Method post_handler
has 155 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function post_handler()
{
try {
$pDate = $this->form->date;
$invoice = $this->form->invoice;
File CoopCredMember.php
has 425 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2010 Whole Foods Co-op, Duluth, MN
Copyright 2014 West End Food Co-op, Toronto, Canada
Class JsonSerializerInternalReader
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
internal class JsonSerializerInternalReader : JsonSerializerInternalBase
{
internal enum PropertyPresence
{
None = 0,
Method filter
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function filter($dbc, $data)
{
$reverseMap = array();
$tenderTTL = 0.00;
$tax = False;
Method variable_slip
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function variable_slip($ref, $reprint=False, $sigSlip=False)
{
$date = ReceiptLib::build_time(time());
list($emp, $reg, $trans) = ReceiptLib::parseRef($ref);
Method filter
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function filter($dbc, $data)
{
$reverseMap = array();
$tenderTTL = 0.00;
$tax = False;
Method process_file
has 154 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);
$user = FannieAuth::getUID($this->current_user);