Showing 104 of 104 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
$this->onValidFunction = function (FormInterface $form) use ($onValidFunctions) {
$args = array_merge([$this], func_get_args());
foreach ($form->getWritableBearer()->getWritables() as $writable) {
if ($writable instanceof FormInterface) {
- 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 127.
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
$this->onInvalidFunction = function (FormInterface $form) use ($onInvalidFunctions) {
$args = array_merge([$this], func_get_args());
foreach ($form->getWritableBearer()->getWritables() as $writable) {
if ($writable instanceof FormInterface) {
- 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 127.
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 visitPage
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function visitPage(PageInterface $page)
{
/** @var WritableInterface[] $writables */
$writables = [$page];
Identical blocks of code found in 2 locations. Consider refactoring. Open
} else {
athens.ajax_section.unsetGetVar(getVar(ajaxSectionName, handle, 'fieldname' + i));
athens.ajax_section.unsetGetVar(getVar(ajaxSectionName, handle, 'operation' + i));
athens.ajax_section.unsetGetVar(getVar(ajaxSectionName, handle, 'value' + i));
}
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
for (var i = 0; i <= 5; i++) {
athens.ajax_section.unsetGetVar(getVar(ajaxSectionName, handle, 'fieldname' + i));
athens.ajax_section.unsetGetVar(getVar(ajaxSectionName, handle, 'operation' + i));
athens.ajax_section.unsetGetVar(getVar(ajaxSectionName, handle, 'value' + i));
}
- 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
File Admin.php
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Athens\Core\Admin;
use Athens\Core\Etc\StringUtils;
Method applyToRows
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function applyToRows(array $rows)
{
$fieldName = $this->getFieldName();
$condition = $this->getCondition();
$criterion = $this->getCriterion();
Function pagination
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
athens.pagination = (function () {
var getPaginationContainer = function (handle) {
return $("div.pagination-container[data-handle-for=" + handle +"]");
};
- 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 build
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build()
{
$this->validateInitializer();
$this->validateRenderer();
Function setupSoftPaginationFilter
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setupSoftPaginationFilter = function (handle) {
$(
function () {
var inactiveControls = getInactiveControls(handle);
var activeControls = getActiveControls(handle);
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (sectionRegistry.hasOwnProperty(id) && !targetDiv.data("request-uri")) {
targetUrl = sectionRegistry[id];
} else {
targetUrl = targetDiv.data("request-uri");
sectionRegistry[id] = targetUrl;
- 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 70.
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
if (sectionRegistry.hasOwnProperty(id) && !targetDiv.data("request-uri")) {
targetUrl = sectionRegistry[id];
} else {
targetUrl = targetDiv.data("request-uri");
sectionRegistry[id] = targetUrl;
- 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 70.
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
Function alert
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
athens.alert = (function () {
/**
* Creates an alert div, appends it to the notification area, and schedules it for removal.
*
Method queryFilter
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queryFilter(QueryWrapperInterface $query)
{
$this->canQueryFilter = true;
if ($this->getNextFilter()->canQueryFilter === false) {
$this->canQueryFilter = false;
Method buildTopMatter
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function buildTopMatter()
{
$topMatterBuilder = SectionBuilder::begin()
->setType(SectionBuilder::TYPE_SPAN);
Method __construct
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
$id,
$type,
array $classes,
array $data,
Method queryFilter
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queryFilter(QueryWrapperInterface $query)
{
$this->canQueryFilter = true;
if ($this->getNextFilter()->canQueryFilter === false) {
$this->canQueryFilter = false;
Function suffixFormFieldsFixed
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function suffixFormFieldsFixed(FormInterface $form, $suffix)
{
foreach ($form->getWritableBearer()->getWritables() as $writable) {
if ($writable instanceof FieldInterface) {
$writable->addSuffix($suffix);
- 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 submitForm
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function submitForm(form, success)
{
athens.alert.makeAlert("Submitting form.", "info");
if (typeof(success) === 'undefined') {
Method build
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build()
{
if ($this->type === null) {
throw new \Exception("You must set a page type using ::setType before calling this function.");
}