Showing 1,375 of 1,375 total issues
Function aroundGetData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function aroundGetData(CategoryDataProvider $dataProvider, \Closure $proceed)
{
$data = $proceed();
$currentCategory = $dataProvider->getCurrentCategory();
- 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 updateAttributeData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function updateAttributeData($attribute, $rowData)
{
$dataChanged = false;
foreach ($rowData 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 getAllDefaultLanguageStemmers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getAllDefaultLanguageStemmers(\DOMXPath $xpath)
{
$defaultStemmers = [];
$filterPath = "@type='stemmer' and @name='stemmer'";
- 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 prepareFieldCondition
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function prepareFieldCondition(FieldInterface $field, $condition, $currentPath)
{
$queryType = QueryInterface::TYPE_TERMS;
$condition = $this->prepareCondition($condition);
- 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 buildSordOrders
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function buildSordOrders(ContainerConfigurationInterface $containerConfig, array $orders)
{
$sortOrders = [];
$mapping = $containerConfig->getMapping();
- 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 create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function create(ContainerConfigurationInterface $containerConfig, $queryText, $spellingType, $boost = 1, $depth = 0)
{
$query = null;
$fuzzySpellingTypes = [SpellcheckerInterface::SPELLING_TYPE_FUZZY, SpellcheckerInterface::SPELLING_TYPE_MOST_FUZZY];
- 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 processNestedGroups
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function processNestedGroups($group)
{
$data = [];
if (isset($group['fields']) && is_array($group['fields'])) {
- 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 saveTermsRelation
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function saveTermsRelation(\Magento\Framework\Model\AbstractModel $object)
{
$termRelations = $object->getTermsRelations() ?? [];
$termRelations = array_filter($termRelations);
- 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 getFilterArray
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getFilterArray(array $request, \Magento\Catalog\Model\Product $product)
{
$filterArray = [];
$attributes = $this->eavConfig->getEntityAttributes(\Magento\Catalog\Model\Product::ENTITY, $product);
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function __construct(
RequestFactory $requestFactory,
DimensionFactory $dimensionFactory,
QueryBuilder $queryBuilder,
SortOrderBuilder $sortOrderBuilder,
- 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 82.
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(
$queryText,
array $fields,
$minimumShouldMatch = self::DEFAULT_MINIMUM_SHOULD_MATCH,
$tieBreaker = self::DEFAULT_TIE_BREAKER,
- 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 82.
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 _calculateBarValuePixels
has 54 lines of code (exceeds 40 allowed). Consider refactoring. Open
_calculateBarValuePixels(index) {
const me = this;
const {vScale, _stacked} = me._cachedMeta;
const {base: baseValue, minBarLength} = me.options;
const parsed = me.getParsed(index);
Function constructor
has 54 lines of code (exceeds 40 allowed). Consider refactoring. Open
constructor(item, config) {
const me = this;
this.config = config = new Config(config);
const initialCanvas = getCanvas(item);
const existingChart = getChart(initialCanvas);
Function beforeElementsUpdate
has 54 lines of code (exceeds 40 allowed). Consider refactoring. Open
beforeElementsUpdate: (chart, args, options) => {
if (!options.enabled) {
cleanDecimatedData(chart);
return;
}
Method afterCreateCollection
has 53 lines of code (exceeds 40 allowed). Consider refactoring. Open
public function afterCreateCollection(ProductsList $subject, $collection)
{
$storeId = $this->getCurrentStoreId($subject);
$sortOption = $subject->getData('sort_order');
$conditionOption = $subject->getData('condition_option');
Method __construct
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
$name,
$indexName,
QueryInterface $query,
QueryInterface $filter = null,
array $sortOrders = null,
Function getDataSets
has 52 lines of code (exceeds 40 allowed). Consider refactoring. Open
getDataSets: function (optionValue) {
optionValue = this.currentOptionValue;
var datasets = [];
var DataSetsConfig = {
'ln1p': {
Function success
has 52 lines of code (exceeds 40 allowed). Consider refactoring. Open
success: $.proxy(function (data) {
var self = this;
var lastElement = false;
var content = this._getResultWrapper();
var sectionDropdown = this._getSectionHeader();
Method addFacetFields
has 52 lines of code (exceeds 40 allowed). Consider refactoring. Open
private function addFacetFields(Fieldset $fieldset)
{
$fieldset->addField(
'facet_min_coverage_rate',
'text',
Method execute
has 52 lines of code (exceeds 40 allowed). Consider refactoring. Open
public function execute()
{
// Prepare product attributes grid collection.
$attributeCollectionFactory = $this->attributeCollectionFactory->create();
$attributeCollection = $attributeCollectionFactory->addVisibleFilter()