Showing 607 of 1,357 total issues
Function getSubAggregations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getSubAggregations($rawValue)
{
$subAggregations = [];
foreach ($rawValue as $key => $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 getFieldType
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getFieldType($attributeId)
{
// Backward compatibility.
if (!is_numeric($attributeId)) {
$attributeId = $this->getAttributeId($attributeId);
- 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 getWeightedSearchProperties
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getWeightedSearchProperties(
$analyzer = null,
$defaultField = null,
$boost = 1,
FieldFilterInterface $fieldFilter = 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
Function getCategorySearchQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getCategorySearchQuery($category, $excludedCategories = []): ?QueryInterface
{
\Magento\Framework\Profiler::start('ES:Virtual Rule ' . __FUNCTION__);
$categoryId = (int) (!is_object($category) ? $category : $category->getId());
$storeId = !is_object($category) ? $this->getStoreId() : $category->getStoreId();
- 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 getData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function getData($key = '', $index = null)
{
if ('' === $key) {
return $this->_data;
}
- 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 deleteThesaurus
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function deleteThesaurus(): bool
{
$rows = [];
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
foreach ($bunch as $rowNum => $rowData) {
- 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 checkAndFixData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function checkAndFixData(int $storeId): array
{
$data = [];
foreach ($this->checkers as &$checker) {
- 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 build
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function build(AggregationInterface $aggregation, ?int $storeId): array
{
$bucket = $aggregation->getBucket(self::CATEGORY_BUCKET);
if ($this->isBucketEmpty($bucket)) {
- 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 drawBody
has 42 lines of code (exceeds 40 allowed). Consider refactoring. Open
drawBody(pt, ctx, options) {
const me = this;
const {body} = me;
const {bodySpacing, bodyAlign, displayColors, boxHeight, boxWidth} = options;
const bodyFont = toFont(options.bodyFont);
Function _computeLabelSizes
has 42 lines of code (exceeds 40 allowed). Consider refactoring. Open
_computeLabelSizes(ticks, length) {
const {ctx, _longestTextCache: caches} = this;
const widths = [];
const heights = [];
let widestLabelSize = 0;
Function fit
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Open
fit() {
const me = this;
const minSize = {
width: 0,
height: 0
Function updateElements
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Open
updateElements(arcs, start, count, mode) {
const me = this;
const reset = mode === 'reset';
const chart = me.chart;
const dataset = me.getDataset();
Function pathArc
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Open
function pathArc(ctx, element, offset, end) {
const {x, y, startAngle: start, pixelMargin, innerRadius: innerR} = element;
const outerRadius = Math.max(element.outerRadius + offset - pixelMargin, 0);
const innerRadius = innerR > 0 ? innerR + offset + pixelMargin : 0;
const alpha = end - start;
Function createChart
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Open
createChart: function (optionValue = null) {
if (!this.chartRangesInit) {
this.initRanges();
}
optionValue = typeof optionValue === 'object' ? null : optionValue;
Function getCaretPosition
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Open
getCaretPosition(tooltipPoint, size, options) {
const {xAlign, yAlign} = this;
const {cornerRadius, caretSize} = options;
const {x: ptX, y: ptY} = tooltipPoint;
const {width, height} = size;
Method getQueries
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Open
private function getQueries()
{
$queries = [
'all' => $this->queryFactory->create(
QueryInterface::TYPE_BOOL,
Method getChartData
has 41 lines of code (exceeds 40 allowed). Consider refactoring. Open
public function getChartData()
{
$data = [
'cols' => [
['type' => 'string', 'label' => __('Session type')],
Method __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Context $context,
PreviewFactory $previewModelFactory,
CategoryRepositoryInterface $categoryRepository,
OptimizerInterfaceFactory $optimizerFactory,
ContainerConfigurationFactory $containerConfigFactory,
Method __construct
has 8 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\Filter\StripTags $tagFilter,
Consider simplifying this complex logical expression. Open
if (($this->getAttribute()->getSourceModel() == 'Magento\Eav\Model\Entity\Attribute\Source\Boolean')
|| ($this->getAttribute()->getBackendType() == 'int')
|| ($this->getAttribute()->getFrontendClass() == 'validate-digits')
|| ($this->getAttribute()->getBackendType() == 'decimal' || $this->getAttribute()->getFrontendClass() == 'validate-number')
|| (in_array($this->getAttribute()->getFrontendInput(), ['select', 'multiselect'])