Showing 8,683 of 8,684 total issues
Method getEmailSync
has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring. Open
public string getEmailSync()
{
string ret = "";
try {
initPort();
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
private function getPO($ref, $store, $date)
{
$prep = $this->connection->prepare("SELECT orderID FROM PurchaseOrder
WHERE vendorInvoiceID=? AND vendorID=136 AND storeID=?");
$exists = $this->connection->getValue($prep, array($ref, $store));
- 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 140.
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 getPO($ref, $store, $date)
{
$prep = $this->connection->prepare("SELECT orderID FROM PurchaseOrder
WHERE vendorInvoiceID=? AND vendorID=136 AND storeID=?");
$exists = $this->connection->getValue($prep, array($ref, $store));
- 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 140.
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 PaymentPlanEditor.php
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2015 Whole Foods Co-op
File ReprintReceiptPage.php
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2009 Whole Foods Co-op
File MercatoCorrections2.php
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
include(__DIR__ . '/../../../config.php');
if (!class_exists('FannieAPI')) {
include(__DIR__ . '/../../../classlib2.0/FannieAPI.php');
File SuperDeptEditor.php
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2009,2013 Whole Foods Co-op
Method handleResponseAuth
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleResponseAuth($authResult)
{
$xml = new XmlData($authResult["response"]);
$request = $this->last_request;
$this->last_paycard_transaction_id = $request->last_paycard_transaction_id;
Method message
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function message($str){
global $CORE_LOCAL;
$lineStart = "";
$lineEnd = "\n";
Method handleResponseVoid
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleResponseVoid($vdResult)
{
$resp = $this->desoapify("GiftTransactionResult",
$vdResult["response"]);
$xml = new BetterXmlData($resp);
Method body_content
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function body_content(){
global $CORE_LOCAL;
$db = Database::pDataConnect();
/* Only tenders the member may actually use. */
$q = "SELECT t.TenderCode, p.tenderKeyCap, p.tenderName
Method receiptDetail
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function receiptDetail($reprint=false, $transNum='')
{
// put into its own function to make it easier to follow, and slightly
// modified for wider-spread use of joe's "new" receipt format --- apbw 7/3/2007
if (CoreLocal::get("newReceipt") == 2) {
Method form_content
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function form_content()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
Method form_content
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function form_content()
{
global $FANNIE_URL;
ob_start();
?>
Method fetch_report_data
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('TRANS_DB'));
try {
Method fetch_report_data
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch_report_data()
{
$dbc = $this->connection;
$dbc->selectDB($this->config->get('OP_DB'));
$FANNIE_TRANS_DB = $this->config->get('TRANS_DB');
Method fetch_report_data
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_report_data()
{
global $FANNIE_OP_DB, $FANNIE_ARCHIVE_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
$date1 = $this->form->date1;
Method generateSoupTag
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateSoupTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
{
$store = COREPOS\Fannie\API\lib\Store::getIdByIp();
$upc = $row['upc'];
$brand = $row['description'];
Method processMail
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function processMail($msg)
{
$fp = fopen('/tmp/resp.log', 'a');
$info = $this->parseEmail($msg);
$commentID = false;
Method process_file
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process_file($linedata, $indexes)
{
$getStoreP = $this->connection->prepare("SELECT posID FROM LbmxStores WHERE lbmxID=?");
$getVendorP = $this->connection->prepare("SELECT vendorName FROM LbmxVendors AS l
LEFT JOIN vendors AS v on l.posID=v.vendorID WHERE lbmxID=?");