File SerialLetterFilter.php
has 607 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace SPHERE\Application\Reporting\SerialLetter;
use SPHERE\Application\Contact\Address\Address;
Function getCompanyTableByResult
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
public function getCompanyTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
- 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 getProspectTableByResult
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
public function getProspectTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
- 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 getStudentTableByResult
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public function getStudentTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
/** @var AbstractView[]|ViewDivisionStudent[] $Row */
- 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 getStudentFilterResultListBySerialLetter
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function getStudentFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterStudentList = array(),
$FilterYearList = 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 getProspectFilterResultListBySerialLetter
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function getProspectFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterProspectList = array(),
&$IsTimeout = false
- 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 getCompanyFilterResultListBySerialLetter
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function getCompanyFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterCompanyList = array(),
$FilterRelationshipList = 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 getPersonListByResult
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function getPersonListByResult(TblSerialLetter $tblSerialLetter = null, $Result = array())
{
$tblCategory = false;
if ($tblSerialLetter !== null) {
$tblCategory = $tblSerialLetter->getFilterCategory();
- 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 getStudentFilterResultListBySerialLetter
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStudentFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterStudentList = array(),
$FilterYearList = array(),
Method getCompanyFilterResultListBySerialLetter
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCompanyFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterCompanyList = array(),
$FilterRelationshipList = array(),
Method getProspectFilterResultListBySerialLetter
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProspectFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterProspectList = array(),
&$IsTimeout = false
Function getGroupTableByResult
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getGroupTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
/** @var AbstractView[]|ViewPerson[] $Row */
- 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 getProspectTableByResult
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProspectTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
Method getCompanyTableByResult
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCompanyTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
Method getGroupFilterResultListBySerialLetter
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGroupFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
&$IsTimeout = false
) {
Function getGroupFilterResultListBySerialLetter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getGroupFilterResultListBySerialLetter(
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
&$IsTimeout = false
) {
- 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 getStudentTableByResult
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStudentTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
/** @var AbstractView[]|ViewDivisionStudent[] $Row */
Function getCompanyListByResult
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function getCompanyListByResult($Result)
{
$DataList = array();
$PersonList = 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 getPersonListByResult
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPersonListByResult(TblSerialLetter $tblSerialLetter = null, $Result = array())
{
$tblCategory = false;
if ($tblSerialLetter !== null) {
$tblCategory = $tblSerialLetter->getFilterCategory();
Method getGroupTableByResult
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getGroupTableByResult($Result)
{
$TableSearch = array();
if (!empty($Result)) {
/** @var AbstractView[]|ViewPerson[] $Row */
Avoid deeply nested control flow statements. Open
if ($tblProspectReservation->getServiceTblTypeOptionB()) {
$DataPerson['ReservationOptionB'] = $tblProspectReservation->getServiceTblTypeOptionB()->getName();
}
Avoid deeply nested control flow statements. Open
if ($tblRelationship->getTblType()) {
$Data['Type'] = $tblRelationship->getTblType()->getName();
}
Avoid deeply nested control flow statements. Open
if ($tblProspectReservation->getServiceTblTypeOptionA()) {
$DataPerson['ReservationOptionA'] = $tblProspectReservation->getServiceTblTypeOptionA()->getName();
}
Method getCompanyFilterResultListBySerialLetter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterCompanyList = array(),
$FilterRelationshipList = array(),
&$IsTimeout = false
Method getStudentFilterResultListBySerialLetter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
TblSerialLetter $tblSerialLetter = null,
$FilterGroupList = array(),
$FilterStudentList = array(),
$FilterYearList = array(),
&$IsTimeout = false
Similar blocks of code found in 5 locations. Consider refactoring. Open
if (isset($FilterYearList[$FilterNumber])) {
array_walk($FilterYearList[$FilterNumber], function (&$Input) {
if (!is_array($Input)) {
if (!empty($Input)) {
$Input = explode(' ', $Input);
- 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
Similar blocks of code found in 5 locations. Consider refactoring. Open
if (isset($FilterStudentList[$FilterNumber])) {
array_walk($FilterStudentList[$FilterNumber], function (&$Input) {
if (!is_array($Input)) {
if (!empty($Input)) {
$Input = explode(' ', $Input);
- 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
Similar blocks of code found in 5 locations. Consider refactoring. Open
if (isset($FilterRelationshipList[$FilterNumber])) {
array_walk($FilterRelationshipList[$FilterNumber], function (&$Input) {
if (!is_array($Input)) {
if (!empty($Input)) {
$Input = explode(' ', $Input);
- 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
Similar blocks of code found in 5 locations. Consider refactoring. Open
if (isset($FilterProspectList[$FilterNumber])) {
array_walk($FilterProspectList[$FilterNumber], function (&$Input) {
if (!is_array($Input)) {
if (!empty($Input)) {
$Input = explode(' ', $Input);
- 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
Similar blocks of code found in 5 locations. Consider refactoring. Open
if (isset($FilterCompanyList[$FilterNumber])) {
array_walk($FilterCompanyList[$FilterNumber], function (&$Input) {
if (!is_array($Input)) {
if (!empty($Input)) {
$Input = explode(' ', $Input);
- 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
Similar blocks of code found in 7 locations. Consider refactoring. Open
if ($FilterGroup) {
// Preparation FilterGroup
array_walk($FilterGroup, function (&$Input) {
if (!is_array($Input)) {
- 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 118.
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 7 locations. Consider refactoring. Open
if ($FilterGroup) {
// Preparation FilterGroup
array_walk($FilterGroup, function (&$Input) {
if (!is_array($Input)) {
- 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 118.
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 7 locations. Consider refactoring. Open
if ($FilterGroup) {
// Preparation FilterGroup
array_walk($FilterGroup, function (&$Input) {
if (!is_array($Input)) {
- 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 118.
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 7 locations. Consider refactoring. Open
if ($FilterGroup) {
// Preparation FilterGroup
array_walk($FilterGroup, function (&$Input) {
if (!is_array($Input)) {
- 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 118.
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