Showing 306 of 306 total issues
Function setValueOptions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function setValueOptions($options): MultiCheckboxType
{
if (is_array($options) || $options instanceof \Traversable) {
foreach ($options as $key => $value) {
if (!$value instanceof Option) {
- 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 setValueOptions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function setValueOptions($options): SelectType
{
if (is_array($options) || $options instanceof \Traversable) {
foreach ($options as $key => $value) {
if (!$value instanceof Option) {
- 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 registerEventListeners
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function registerEventListeners(DispatcherContract $events)
{
foreach ($this->listen as $event => $listeners) {
$defaultPriority = 0;
if (!is_array($listeners)) {
- 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 customfieldsByFieldset
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function customfieldsByFieldset($grid, $name)
{
if (!extension_active('customfields')) {
return;
}
- 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 resolveUIComponentNamespace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function resolveUIComponentNamespace($src, $i = 0)
{
$tokens = token_get_all($src);
$count = count($tokens);
$namespace = '';
- 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 resolveNamespace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function resolveNamespace(string $path, bool $asPackage = false): string
{
$file = new File($path);
$pathInfo = array_filter(explode(DIRECTORY_SEPARATOR, trim(str_replace([$this->configRepository->getRootPath(), 'src'], '', $file->getRealPath()), DIRECTORY_SEPARATOR)));
$prefix = 'antares';
- 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 columnSearch
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function columnSearch()
{
$columns = $this->request->get('columns', []);
foreach ($columns as $index => $column) {
Method min
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function min()
{
if ($this->output !== '') { // min already run
return $this->output;
}
Method setDefaultOptions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setDefaultOptions()
{
$areas = array_keys(config('areas.areas'));
$default = config('areas.default');
$configuration = require_once(__DIR__ . '/../../../../../modules/brands/resources/config/install.php');
Method getActionsColumn
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getActionsColumn(Authorization $acl): Closure
{
return function(ExtensionContract $extension) use($acl) {
$buttons = [];
$name = $extension->getPackage()->getName();
Identical blocks of code found in 2 locations. Consider refactoring. Open
protected function getLowerRoles(array $elements, $parentId = 0, &$return = [])
{
foreach ($elements as $element) {
if ($element['parent_id'] != $parentId) {
continue;
- 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 111.
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
protected function getLowerRoles(array $elements, $parentId = 0, &$return = [])
{
foreach ($elements as $element) {
if ($element['parent_id'] != $parentId) {
continue;
- 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 111.
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 render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function render()
{
$dropzoneAttributes = array_diff_key($this->field->attributes, array_flip(['class']));
if (!isset($dropzoneAttributes['container'])) {
Method registerEngine
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function registerEngine()
{
$this->app->bindIf('twig', function () {
$extensions = $this->app->make('twig.extensions');
$lexer = $this->app->make('twig.lexer');
Method argumentsToString
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function argumentsToString($args)
{
$count = 0;
$isAssoc = $args !== array_values($args);
Method decorate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function decorate($value, $safe = false)
{
if (is_string($value)) {
if (strpos($value, 'js:') === 0 && $safe === false)
return substr($value, 3);
Function requireJs
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function requireJs()
{
$scripts = $this->dispatcher->scripts('script', $this->assets, $this->path);
$required = [];
- 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 getPatterned
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getPatterned($value)
{
if (!is_array($value)) {
return str_replace('%value', ucfirst($value), $this->pattern);
} else {
- 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 beforeTable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function beforeTable()
{
$hasMassActions = $this->hasMassActions();
$filters = $this->filterAdapter->getFilters();
$hasColumnFilter = $this->hasColumnFilter();
- 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 findExtensions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function findExtensions(): Extensions
{
$extensions = new Extensions();
- 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"