Showing 1,375 of 1,375 total issues
Function minMaxDecimation
has 51 lines of code (exceeds 40 allowed). Consider refactoring. Open
function minMaxDecimation(data, start, count, availableWidth) {
let avgX = 0;
let countX = 0;
let i, point, x, y, prevX, minIndex, maxIndex, startIndex, minY, maxY;
const decimated = [];
Function bindAttributeInputType
has 51 lines of code (exceeds 40 allowed). Consider refactoring. Open
bindAttributeInputType: function () {
this.checkOptionsPanelVisibility();
this.switchDefaultValueField();
var filterableFrontendInputs = $.merge(this.selectFields, ['text', 'boolean']);
Function getTooltipSize
has 51 lines of code (exceeds 40 allowed). Consider refactoring. Open
function getTooltipSize(tooltip, options) {
const ctx = tooltip._chart.ctx;
const {body, footer, title} = tooltip;
const {boxWidth, boxHeight} = options;
const bodyFont = toFont(options.bodyFont);
Method getLanguageConfiguration
has 51 lines of code (exceeds 40 allowed). Consider refactoring. Open
private function getLanguageConfiguration(\DOMXPath $xpath, $language, array $defaultConfig)
{
$languageCharFilters = $this->parseFilters(
$xpath,
self::CHAR_FILTER_TYPE_ROOT_NODE,
Method build
has 51 lines of code (exceeds 40 allowed). Consider refactoring. Open
public function build(AggregationInterface $aggregation, ?int $storeId): array
{
$bucket = $aggregation->getBucket(self::CATEGORY_BUCKET);
if ($this->isBucketEmpty($bucket)) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Json\Helper\Data $jsonHelper,
\Smile\ElasticsuiteTracker\Helper\Data $trackerHelper,
\Magento\Framework\Registry $registry,
- 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 79.
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 __construct(
\Magento\Backend\Block\Template\Context $context,
\Smile\ElasticsuiteAnalytics\Model\Report\Context $reportContext,
\Smile\ElasticsuiteTracker\Model\IndexManager $indexManager,
\Magento\Framework\Serialize\Serializer\Json $jsonSerializer,
- 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 79.
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 getInputType
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getInputType()
{
$inputType = 'string';
$selectAttributes = ['attribute_set_id'];
- 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 aroundExecute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function aroundExecute(
\Magento\CatalogSearch\Controller\Result\Index $subject,
\Closure $proceed
) {
$result = $proceed();
- 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 modifyAttributes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function modifyAttributes($storeId, $requestName, $attributes, $query, $filters, $queryFilters)
{
$relevantAttributes = [];
$coverageRates = $this->getCoverageRates($storeId, $requestName, $query, $filters, $queryFilters);
- 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 modifyData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function modifyData(array $data)
{
$optimizer = $this->locator->getOptimizer();
if ($optimizer && $optimizer->getId() && isset($data[$optimizer->getId()])) {
- 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 getMetrics
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function getMetrics($rawValue)
{
$metrics = [];
foreach ($rawValue as $metricName => $value) {
- 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 getGroupsForSave
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function getGroupsForSave()
{
$groups = $this->getRequest()->getPost('groups');
$files = $this->getRequest()->getFiles('groups');
- 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 execute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function execute()
{
/** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
- 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 indexEvents
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function indexEvents($events)
{
$bulk = $this->indexOperation->createBulk();
$indices = [];
- 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 getSynonymRewrites
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function getSynonymRewrites($storeId, $queryText, $type, $maxRewrites)
{
$indexName = $this->getIndexAlias($storeId);
$analyzedQueries = $this->getQueryCombinations($storeId, str_replace('-', ' ', $queryText));
$synonyms = [];
- 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 __construct
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
OptimizerInterface $optimizer,
Preview\ItemFactory $previewItemFactory,
ApplierListFactory $applierListFactory,
Functions\ProviderFactory $providerFactory,
ContainerConfigurationInterface $containerConfig,
Method __construct
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
\Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Model\Layer $layer,
\Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder,
\Magento\Framework\Escaper $escaper,
Method __construct
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$field,
array $metrics = [],
array $childBuckets = [],
array $pipelines = [],
Method __construct
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$field,
array $metrics = [],
array $childBuckets = [],
array $pipelines = [],