pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

File NotificationService.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Services;

use App\Jobs\InternalPipeline\NotificationEpochUpdatePipeline;
Severity: Minor
Found in app/Services/NotificationService.php - About 2 hrs to fix

    Method createConfiguration has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function createConfiguration($request)
        {
            abort_if(file_exists(base_path('.env')), 404);
            $source = base_path('.env.example');
            $target = base_path('.env');
    Severity: Major
    Found in app/Http/Controllers/InstallController.php - About 2 hrs to fix

      Method handle has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handle()
          {
      
              $this->info('       ____  _           ______         __  ');
              $this->info('      / __ \(_)  _____  / / __/__  ____/ /  ');
      Severity: Major
      Found in app/Console/Commands/FixHashtags.php - About 2 hrs to fix

        Method apiV1Add has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function apiV1Add(Request $request)
            {
                abort_if(! (bool) config_cache('instance.stories.enabled') || ! $request->user(), 404);
        
                $this->validate($request, [
        Severity: Major
        Found in app/Http/Controllers/StoryComposeController.php - About 2 hrs to fix

          Function timeAhead has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

                  timeAhead: (function(ts, short = true) {
                      let date = Date.parse(ts);
                      let diff = date - Date.parse(new Date());
                      let seconds = Math.floor((diff) / 1000);
                      let interval = Math.floor(seconds / 63072000);
          Severity: Minor
          Found in resources/assets/js/app.js - About 2 hrs 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 handle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle()
              {
                  $media = $this->media;
                  $path = $media->media_path;
                  $thumb = $media->thumbnail_path;
          Severity: Minor
          Found in app/Jobs/MediaPipeline/MediaDeletePipeline.php - About 2 hrs 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 handle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle(): void
              {
                  $spamExists = Storage::exists(AutospamService::MODEL_SPAM_PATH);
                  if($spamExists) {
                      $spam = json_decode(Storage::get(AutospamService::MODEL_SPAM_PATH), true);
          Severity: Minor
          Found in app/Jobs/AutospamPipeline/AutospamUpdateCachedDataPipeline.php - About 2 hrs 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 statusContext has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function statusContext(Request $request, $id)
              {
                  abort_if(! $request->user() || ! $request->user()->token(), 403);
                  abort_unless($request->user()->tokenCan('read'), 403);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Api/ApiV1Controller.php - About 2 hrs 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 networkTimelineApi has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function networkTimelineApi(Request $request)
              {
                  if(!$request->user()) {
                      return response('', 403);
                  }
          Severity: Minor
          Found in app/Http/Controllers/PublicApiController.php - About 2 hrs 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 publicTimelineApi has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function publicTimelineApi(Request $request)
              {
                  $this->validate($request,[
                    'page'        => 'nullable|integer|max:40',
                    'min_id'      => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
          Severity: Minor
          Found in app/Http/Controllers/PublicApiController.php - About 2 hrs 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 browse has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function browse(Request $request)
              {
                  $this->validate($request, [
                      'a' => 'nullable|string|in:inbox,sent,filtered',
                      'page' => 'nullable|integer|min:1|max:99'
          Severity: Minor
          Found in app/Http/Controllers/DirectMessageController.php - About 2 hrs 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

          File app.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require('./polyfill');
          window._ = require('lodash');
          window.Popper = require('popper.js').default;
          window.pixelfed = window.pixelfed || {};
          window.$ = window.jQuery = require('jquery');
          Severity: Minor
          Found in resources/assets/js/app.js - About 2 hrs to fix

            File landing.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require('./polyfill');
            import Vue from 'vue';
            window.Vue = Vue;
            import VueRouter from "vue-router";
            import Vuex from "vuex";
            Severity: Minor
            Found in resources/assets/js/landing.js - About 2 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function instagramStepOne(Request $request, $uuid)
                  {
                      if((bool) config_cache('pixelfed.import.instagram.enabled') != true) {
                          abort(404, 'Feature not enabled');
                      }
              Severity: Major
              Found in app/Http/Controllers/Import/Instagram.php and 1 other location - About 2 hrs to fix
              app/Http/Controllers/Import/Instagram.php on lines 127..139

              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 122.

              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

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  public function instagramStepTwo(Request $request, $uuid)
                  {
                      if((bool) config_cache('pixelfed.import.instagram.enabled') != true) {
                          abort(404, 'Feature not enabled');
                      }
              Severity: Major
              Found in app/Http/Controllers/Import/Instagram.php and 1 other location - About 2 hrs to fix
              app/Http/Controllers/Import/Instagram.php on lines 68..80

              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 122.

              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

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              <?php
              
              namespace App\Jobs\DirectPipeline;
              
              use Illuminate\Bus\Queueable;
              Severity: Major
              Found in app/Jobs/DirectPipeline/DirectDeliverPipeline.php and 1 other location - About 2 hrs to fix
              app/Jobs/DirectPipeline/DirectDeletePipeline.php on lines 1..42

              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 122.

              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

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              <?php
              
              namespace App\Jobs\DirectPipeline;
              
              use Illuminate\Bus\Queueable;
              Severity: Major
              Found in app/Jobs/DirectPipeline/DirectDeletePipeline.php and 1 other location - About 2 hrs to fix
              app/Jobs/DirectPipeline/DirectDeliverPipeline.php on lines 1..42

              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 122.

              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

              Further Reading

              Method handle has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function handle()
                  {
                      $profile = null;
                      $headers = $this->headers;
                      $payload = json_decode($this->payload, true, 8);
              Severity: Major
              Found in app/Jobs/InboxPipeline/DeleteWorker.php - About 2 hrs to fix

                Method handleVerb has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handleVerb()
                    {
                        $verb = (string) $this->payload['type'];
                        switch ($verb) {
                
                
                Severity: Major
                Found in app/Util/ActivityPub/Inbox.php - About 2 hrs to fix

                  Method getJson has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getJson($url, $verifyCheck = true, $ttl = 3600, $allowRedirects = true)
                      {
                          $vc = $verifyCheck ? 'vc1:' : 'vc0:';
                          $ar = $allowRedirects ? 'ar1:' : 'ar0';
                          $key = self::CACHE_KEY.sha1($url).':'.$vc.$ar.$ttl;
                  Severity: Major
                  Found in app/Services/FetchCacheService.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language