Showing 326 of 326 total issues
Method createModule
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createModule($parentNavId, $navContainerId, $langId, $title, $alias, $moduleName, $description, $controllerName, $actionName, array $actionParams): array|int
Function createPageFromDraft
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function createPageFromDraft($parentNavId, $navContainerId, $langId, $title, $alias, $description, $fromDraftNavId, $isDraft = false): bool|array
{
if (!$isDraft && empty($isDraft) && !is_numeric($isDraft)) {
$isDraft = 0;
}
- 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 getKeywords
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getKeywords()
{
if ($this->_keywords === null) {
if (empty($this->itemArray['keywords'])) {
$this->_keywords = [];
- 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 getRowDescriber
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRowDescriber()
{
if (!empty($this->row_id)) {
switch (StorageFile::cleanBaseTableName($this->table_name)) {
case "cms_nav":
Method ensureInputValues
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function ensureInputValues($event)
{
// sort index fixture
if (!$this->isNewRecord) {
Method testImportLayoutAndChangeAfterwardsIssue337
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testImportLayoutAndChangeAfterwardsIssue337()
{
$this->createCmsLayoutFixture();
$controller = new ImportController('import-controller', $this->app);
$importer = new CmslayoutImporter($controller, $this->app->getModule('cmsadmin'));
Method getConfigArray
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigArray()
{
return [
'id' => 'basetestcase',
'basePath' => dirname(__DIR__),
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function testColumn()
{
PageScope::run($this->app, function (PageScope $scope) {
$scope->createAdminGroupFixture(1);
$scope->createAdminUserFixture();
- 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 105.
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
public function testColumn()
{
PageScope::run($this->app, function (PageScope $scope) {
$scope->createAdminGroupFixture(1);
$scope->createAdminUserFixture();
- 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 105.
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 actionIndex
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionIndex($itemId, $version = false, $date = false): \yii\web\Response|string
{
if (Yii::$app->adminuser->isGuest) {
throw new ForbiddenHttpException('Unable to see the preview page, session expired or not logged in.');
}
Method testMatchRequestPath
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testMatchRequestPath()
{
$fixture = new NgRestModelFixture([
'modelClass' => Redirect::class
]);
Similar blocks of code found in 2 locations. Consider refactoring. Open
$scope.removeFromFav = function(item) {
$http.post('admin/api-cms-block/remove-fav', {block: item }).then(function(response) {
$scope.blocksDataReload();
});
};
- 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 59.
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
$scope.addToFav = function(item) {
$http.post('admin/api-cms-block/to-fav', {block: item }).then(function(response) {
$scope.blocksDataReload();
});
};
- 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 59.
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 buildList
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildList(QueryIteratorFilter $iterator, $i = 1)
{
// Abort if maxDepth is set & reached
if ($this->maxDepth !== null && $i >= ($this->maxDepth + 1)) {
return "";
Method actionDelete
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionDelete($navId)
{
if (!Yii::$app->adminuser->canRoute(Module::ROUTE_PAGE_DELETE)) {
throw new ForbiddenHttpException("Unable to remove this page due to permission restrictions.");
}
Function dropItemPlaceholder
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.dropItemPlaceholder = function(dragged,dropped,position) {
if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
// its a new block
$http.post('admin/api-cms-navitempageblockitem/create', {
prev_id : dropped.prev_id,
Function dropItemPlaceholder
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.dropItemPlaceholder = function(dragged,dropped,position) {
if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
// its a new block
$http.post('admin/api-cms-navitempageblockitem/create', {
prev_id: dropped.prev_id,
Method testFindByTags
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testFindByTags()
{
PageScope::run($this->app, function (PageScope $scope) {
$scope->createAdminGroupFixture(1);
$scope->createAdminUserFixture();
Similar blocks of code found in 2 locations. Consider refactoring. Open
case NavItem::TYPE_REDIRECT:
$typeModel = new NavItemRedirect();
$this->setPostAttribute($typeModel, 'type');
$this->setPostAttribute($typeModel, 'value');
$this->setPostAttribute($typeModel, 'target');
- 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 103.
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
if ($this->is_update) {
return match ($tableName) {
"cms_nav_item" => Module::t('log_action_update_cms_nav_item', ['info' => $this->rowDescriber]),
"cms_nav" => Module::t('log_action_update_cms_nav', ['info' => $this->rowDescriber]),
"cms_nav_item_page_block_item" => Module::t('log_action_update_cms_nav_item_page_block_item', ['info' => $this->rowDescriber]),
- 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 103.
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