Showing 607 of 1,357 total issues
Function addOptionsData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function addOptionsData(array $items, $options)
{
$optionPosition = 0;
if (!empty($options)) {
foreach ($options as $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 getQueryFilter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function getQueryFilter(): ?QueryInterface
{
$query = null;
$this->category->setIsActive(true);
- 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 keepLatest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function keepLatest(int $number)
{
if ($number === 0) {
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
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
IndexerRegistry $indexerRegistry,
ThesaurusFactory $thesaurusFactory,
ResourceConnection $resourceConnection,
Function sortFilters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function sortFilters($layerType, $filters)
{
if ($layerType === Resolver::CATALOG_LAYER_CATEGORY) {
if ($this->searchContext->getCurrentCategory() && $this->searchContext->getCurrentCategory()->getId()) {
try {
- 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 getSwatchData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getSwatchData(): array
{
// Fallback to core if sorting is set to manual.
if ($this->eavAttribute->getFacetSortOrder() === BucketInterface::SORT_ORDER_MANUAL) {
return parent::getSwatchData();
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function execute($entity, $arguments = [])
{
$attributeData = $entity->getData(self::ATTRIBUTE_CODE);
if ($attributeData !== null) {
- 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 prepareCategoryNameSelect
has 46 lines of code (exceeds 40 allowed). Consider refactoring. Open
private function prepareCategoryNameSelect($loadCategoryIds, $storeId)
{
$rootCategoryId = (int) $this->storeManager->getStore($storeId)->getRootCategoryId();
$this->categoryNameCache[$storeId][$rootCategoryId] = '';
Method buildAggregations
has 46 lines of code (exceeds 40 allowed). Consider refactoring. Open
public function buildAggregations(array $buckets = [])
{
$aggregations = [];
foreach ($buckets as $bucket) {
Function drawLegendBox
has 44 lines of code (exceeds 40 allowed). Consider refactoring. Open
const drawLegendBox = function(x, y, legendItem) {
if (isNaN(boxWidth) || boxWidth <= 0 || isNaN(boxHeight) || boxHeight < 0) {
return;
}
ctx.save();
Function lttbDecimation
has 44 lines of code (exceeds 40 allowed). Consider refactoring. Open
function lttbDecimation(data, start, count, availableWidth, options) {
const samples = options.samples || availableWidth;
if (samples >= count) {
return data.slice(start, start + count);
}
Function drawGrid
has 44 lines of code (exceeds 40 allowed). Consider refactoring. Open
drawGrid(chartArea) {
const me = this;
const grid = me.options.grid;
const ctx = me.ctx;
const items = me._gridLineItems || (me._gridLineItems = me._computeGridLineItems(chartArea));
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
QueryInterface $searchQuery,
FulltextCollectionFactory $productCollectionFactory,
ItemDataFactory $previewItemFactory,
QueryFactory $queryFactory,
QueryBuilder $queryBuilder,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Smile\ElasticsuiteCatalogRule\Model\RuleFactory $ruleFactory,
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
\Magento\Framework\Serialize\SerializerInterface $serializer,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
$queryText,
array $fields,
$minimumShouldMatch = self::DEFAULT_MINIMUM_SHOULD_MATCH,
$tieBreaker = self::DEFAULT_TIE_BREAKER,
$name = null,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
RequestFactory $requestFactory,
DimensionFactory $dimensionFactory,
QueryBuilder $queryBuilder,
SortOrderBuilder $sortOrderBuilder,
AggregationBuilder $aggregationBuilder,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
Registry $registry,
FormFactory $formFactory,
Factory $configFactory,
Structure $configStructure,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$primaryFieldName,
$requestFieldName,
\Magento\Search\Model\ResourceModel\Query\CollectionFactory $collectionFactory,
\Magento\Framework\Locale\FormatInterface $localeFormat,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
CategoryInterface $category,
FulltextCollectionFactory $productCollectionFactory,
ItemDataFactory $previewItemFactory,
QueryFactory $queryFactory,
ContextInterface $searchContext,
Function update
has 43 lines of code (exceeds 40 allowed). Consider refactoring. Open
update(changed, replay) {
const me = this;
const options = me.options.setContext(me.getContext());
const active = me._active;
let properties;