pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

Avoid too many return statements within this method.
Open

        return Command::SUCCESS;
Severity: Major
Found in app/Console/Commands/UserRegistrationMagicLink.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return $this->banInstance();
    Severity: Major
    Found in app/Console/Commands/InstanceManager.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return;
      Severity: Major
      Found in app/Console/Commands/SendUpdateActor.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return url(Storage::url($path));
        Severity: Major
        Found in app/Profile.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $domain;
          Severity: Major
          Found in app/Console/Commands/AddUserDomainBlock.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $query->where('id', '>', $startCache);
            Severity: Major
            Found in app/Console/Commands/SendUpdateActor.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return Command::SUCCESS;
              Severity: Major
              Found in app/Console/Commands/SendUpdateActor.php - About 30 mins to fix

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

                        } else if($action === 'no_autolink') {
                            ModLogService::boot()
                                ->objectUid($profile->id)
                                ->objectId($profile->id)
                                ->objectType('App\Profile::class')
                Severity: Minor
                Found in app/Http/Controllers/Api/AdminApiController.php and 2 other locations - About 30 mins to fix
                app/Http/Controllers/Api/AdminApiController.php on lines 619..680
                app/Http/Controllers/Api/AdminApiController.php on lines 634..680

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

                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

                Avoid too many return statements within this method.
                Open

                        return 0;
                Severity: Major
                Found in app/Console/Commands/FixStatusCount.php - About 30 mins to fix

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

                          } else if($action === 'unlisted') {
                              ModLogService::boot()
                                  ->objectUid($profile->id)
                                  ->objectId($profile->id)
                                  ->objectType('App\Profile::class')
                  Severity: Minor
                  Found in app/Http/Controllers/Api/AdminApiController.php and 2 other locations - About 30 mins to fix
                  app/Http/Controllers/Api/AdminApiController.php on lines 634..680
                  app/Http/Controllers/Api/AdminApiController.php on lines 649..680

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

                  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 3 locations. Consider refactoring.
                  Open

                          } else if($action === 'cw') {
                              ModLogService::boot()
                                  ->objectUid($profile->id)
                                  ->objectId($profile->id)
                                  ->objectType('App\Profile::class')
                  Severity: Minor
                  Found in app/Http/Controllers/Api/AdminApiController.php and 2 other locations - About 30 mins to fix
                  app/Http/Controllers/Api/AdminApiController.php on lines 619..680
                  app/Http/Controllers/Api/AdminApiController.php on lines 649..680

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

                  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

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

                      public function handleAnnounceActivity()
                      {
                          $actor = $this->actorFirstOrCreate($this->payload['actor']);
                          $activity = $this->payload['object'];
                  
                  
                  Severity: Minor
                  Found in app/Util/ActivityPub/Inbox.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 handlePollVote has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handlePollVote()
                      {
                          $activity = $this->payload['object'];
                          $actor = $this->actorFirstOrCreate($this->payload['actor']);
                  
                  
                  Severity: Minor
                  Found in app/Util/ActivityPub/Inbox.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 redirect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  window.App.redirect = function() {
                      document.querySelectorAll('a').forEach(function(i,k) { 
                          let a = i.getAttribute('href');
                          if(a && a.length > 5 && a.startsWith('https://')) {
                              let url = new URL(a);
                  Severity: Minor
                  Found in resources/assets/js/app.js - 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 handleAcceptActivity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handleAcceptActivity()
                      {
                          $actor = $this->payload['object']['actor'];
                          $obj = $this->payload['object']['object'];
                          $type = $this->payload['object']['type'];
                  Severity: Minor
                  Found in app/Util/ActivityPub/Inbox.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 deliver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function deliver()
                      {
                          $status = $this->status;
                          $types = [
                              'photo',
                  Severity: Minor
                  Found in app/Jobs/StatusPipeline/StatusEntityLexer.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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle()
                      {
                          $profile = $this->profile;
                  
                          Cache::forget('avatar:'.$profile->id);
                  Severity: Minor
                  Found in app/Jobs/AvatarPipeline/RemoteAvatarFetchFromUrl.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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle(): void
                      {
                          $sid = $this->sid;
                          $hid = $this->hid;
                          $status = StatusService::get($sid, false);
                  Severity: Minor
                  Found in app/Jobs/HomeFeedPipeline/HashtagRemoveFanoutPipeline.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 profileFirstOrNew has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function profileFirstOrNew($url)
                      {
                          $url = self::validateUrl($url);
                          if ($url == false) {
                              return;
                  Severity: Minor
                  Found in app/Util/ActivityPub/Helpers.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 refetchAllPosts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function refetchAllPosts()
                      {
                          $profile = $this->profile;
                          $res = ActivityPubFetchService::get($profile->remote_url, false);
                          if(!$res) {
                  Severity: Minor
                  Found in app/Jobs/AdminPipeline/AdminProfileActionPipeline.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