luyadev/luya-module-cms

View on GitHub

Showing 326 of 326 total issues

Function createPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function createPage($parentNavId, $navContainerId, $langId, $title, $alias, $layoutId, $description, $isDraft = false): array|int
    {
        $_errors = [];

        $nav = $this;
Severity: Minor
Found in src/models/Nav.php - About 25 mins to fix

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 getLevelContainer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLevelContainer($level, Item $baseItem = null): array|\luya\cms\menu\QueryIteratorFilter
    {
        // define if the requested level is the root line (level 1) or not
        $rootLine = ($level === 1) ? true : false;
        // countdown the level (as we need the parent of the element to get the children
Severity: Minor
Found in src/Menu.php - About 25 mins to fix

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 getWebsites has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getWebsites()
    {
        if (self::$websites === null) {
            $websites = (new Query())
                ->select([
Severity: Minor
Found in src/admin/helpers/MenuHelper.php - About 25 mins to fix

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 getContent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getContent()
    {
        if (!$this->layout) {
            throw new InvalidConfigException("Unable to find the requested cms layout '{$this->layout_id}' for nav item page id '{$this->id}'. Make sure your page does not have an old inactive/deleted cms layout selected.");
        }
Severity: Minor
Found in src/models/NavItemPage.php - About 25 mins to fix

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 fileUpload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fileUpload($fileId, $returnObject = false): bool|array|\luya\admin\file\Item
    {
        if (!empty($fileId)) {
            $file = Yii::$app->storage->getFile($fileId);
            /* @var \luya\admin\file\Item $file */
Severity: Minor
Found in src/helpers/BlockHelper.php - About 25 mins to fix

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 testBasicBlockImporterWithFailingDefintion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function testBasicBlockImporterWithFailingDefintion()
    {
        // config fixture
        $configFixture = new ActiveRecordFixture([
            'modelClass' => Config::class
Severity: Minor
Found in tests/src/admin/importers/BlockImporterTest.php - About 25 mins to fix

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

Severity
Category
Status
Source
Language