ernestwisniewski/kbin

View on GitHub

Showing 226 of 573 total issues

Function parseSignatureHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function parseSignatureHeader(string $signature): array
    {
        $parts = explode(',', $signature);
        $signatureData = [];

Severity: Minor
Found in src/Service/ActivityPub/HttpSignature.php - About 35 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 showModPanel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    async showModPanel(event) {
        event.preventDefault();

        let container = this.element.nextElementSibling && this.element.nextElementSibling.classList.contains('js-container') ? this.element.nextElementSibling : null;
        if (null === container) {
Severity: Minor
Found in assets/controllers/subject_controller.js - About 35 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 blurhash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function blurhash(string $filePath): ?string
    {
        try {
            $image = imagecreatefromstring(file_get_contents($filePath));
            $width = imagesx($image);
Severity: Minor
Found in src/Repository/ImageRepository.php - About 35 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 connect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    connect() {
        if (!this.element.firstElementChild.classList.contains('comment')) {
            return;
        }

Severity: Minor
Found in assets/controllers/comments_wrap_controller.js - About 35 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 getProfileId has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getProfileId()
    {
        foreach ($this->links as $link) {
            if (isset($link['rel'], $link['type'], $link['href'])) {
                if ('self' === $link['rel']
Severity: Minor
Found in src/Service/ActivityPub/Webfinger/WebFinger.php - About 35 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 views has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[OA\Response(
        response: 200,
        description: 'Views by interval retrieved. These are not guaranteed to be continuous.',
        content: new OA\JsonContent(
            properties: [
Severity: Minor
Found in src/Controller/Api/Magazine/Admin/MagazineRetrieveStatsApi.php - About 35 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 handleInput has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    handleInput (event) {
        // ctrl + enter to submit form
        if (event.ctrlKey && event.key === "Enter") {
            this.element.form.submit();
        }
Severity: Minor
Found in assets/controllers/rich_textarea_controller.js - About 35 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 unwrapChildren has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    unwrapChildren(currentElement, div) {
        div.classList.remove('comment-wrap-closed');
        div.innerHTML = '<i class="fa-solid fa-minus" aria-label="Wrap comments" title="Wrap comments"></i>';
        let nextElement = currentElement.nextElementSibling;
        while (nextElement) {
Severity: Minor
Found in assets/controllers/comments_wrap_controller.js - About 35 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 getProfileIds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getProfileIds(): array
    {
        $urls = [];
        foreach ($this->links as $link) {
            if (isset($link['rel'], $link['type'], $link['href'])) {
Severity: Minor
Found in src/Service/ActivityPub/Webfinger/WebFinger.php - About 35 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 createCcFromBody has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function createCcFromBody(string $body): array
    {
        $mentions = $this->mentionManager->extract($body) ?? [];

        $urls = [];
Severity: Minor
Found in src/Service/ActivityPubManager.php - About 35 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 votes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[OA\Response(
        response: 200,
        description: 'Votes by interval retrieved. These are not guaranteed to be continuous.',
        content: new OA\JsonContent(
            properties: [
Severity: Minor
Found in src/Controller/Api/Instance/InstanceRetrieveStatsApi.php - About 35 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 views has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[OA\Response(
        response: 200,
        description: 'Views by interval retrieved. These are not guaranteed to be continuous.',
        content: new OA\JsonContent(
            properties: [
Severity: Minor
Found in src/Controller/Api/Instance/InstanceRetrieveStatsApi.php - About 35 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 content has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[OA\Response(
        response: 200,
        description: 'Submissions by interval retrieved. These are not guaranteed to be continuous.',
        content: new OA\JsonContent(
            properties: [
Severity: Minor
Found in src/Controller/Api/Instance/InstanceRetrieveStatsApi.php - About 35 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 __invoke has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[OA\Response(
        response: 200,
        description: 'Accesses by interval retrieved. These are not guaranteed to be continuous.',
        content: new OA\JsonContent(
            properties: [
Severity: Minor
Found in src/Controller/Api/OAuth2/Admin/RetrieveClientStatsApi.php - About 35 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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    #[Assert\Callback]
    public function validate(
        ExecutionContextInterface $context,
        $payload
    ) {
Severity: Minor
Found in src/Kbin/Entry/DTO/EntryDto.php - About 35 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

Avoid too many return statements within this method.
Open

        return \count($results) ? $results[0] : null;
Severity: Major
Found in src/Repository/ApActivityRepository.php - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return;
    Severity: Major
    Found in assets/controllers/subject_controller.js - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return null;
      Severity: Major
      Found in src/Service/ActivityPubManager.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $magazine;
        Severity: Major
        Found in src/Service/ActivityPubManager.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return 'post_comment_report';
          Severity: Major
          Found in src/Kbin/Report/DTO/ReportResponseDto.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language