BookStackApp/BookStack

View on GitHub

Showing 205 of 290 total issues

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

    protected function renderUsingCommand(string $html): string
    {
        $command = config('exports.pdf_command');
        $inputHtml = tempnam(sys_get_temp_dir(), 'bs-pdfgen-html-');
        $outputPdf = tempnam(sys_get_temp_dir(), 'bs-pdfgen-output-');
Severity: Minor
Found in app/Entities/Tools/PdfGenerator.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 showRestore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function showRestore(string $id)
    {
        /** @var Deletion $deletion */
        $deletion = Deletion::query()->findOrFail($id);

Severity: Minor
Found in app/Entities/Controllers/RecycleBinController.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 locateAndIsolateIncludeTags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function locateAndIsolateIncludeTags(): array
    {
        $includeHosts = $this->doc->queryXPath("//*[text()[contains(., '{{@')]]");
        $includeTags = [];

Severity: Minor
Found in app/Entities/Tools/PageIncludeParser.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 loadIntoRelations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadIntoRelations(array $relations, string $relationName, bool $loadParents): void
    {
        $idsByType = [];
        foreach ($relations as $relation) {
            $type = $relation->getAttribute($relationName . '_type');
Severity: Minor
Found in app/Entities/Tools/MixedEntityListLoader.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 base64ImageUriToUploadedImageUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function base64ImageUriToUploadedImageUrl(string $uri, User $updater): string
    {
        $imageRepo = app()->make(ImageRepo::class);
        $imageInfo = $this->parseBase64ImageUri($uri);

Severity: Minor
Found in app/Entities/Tools/PageContent.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