pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

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

                if($status->uri == null) {
                    $media = $status->media;
                    $ai = new AccountInterstitial;
                    $ai->user_id = $status->profile->user_id;
                    $ai->type = 'post.cw';
Severity: Major
Found in app/Http/Controllers/InternalApiController.php and 1 other location - About 7 hrs to fix
app/Http/Controllers/InternalApiController.php on lines 263..289

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

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

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

            if (config('instance.timeline.local.cached')) {
                Cache::remember('api:v1:timelines:public:cache_check', 10368000, function () {
                    if (PublicTimelineService::count() == 0) {
                        PublicTimelineService::warmCache(true, 400);
                    }
Severity: Major
Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 7 hrs to fix
app/Http/Controllers/Api/ApiV1Controller.php on lines 2684..2729

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

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

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

            if (config('instance.timeline.network.cached')) {
                Cache::remember('api:v1:timelines:network:cache_check', 10368000, function () {
                    if (NetworkTimelineService::count() == 0) {
                        NetworkTimelineService::warmCache(true, config('instance.timeline.network.cache_dropoff'));
                    }
Severity: Major
Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 7 hrs to fix
app/Http/Controllers/Api/ApiV1Controller.php on lines 2731..2776

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

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

    protected function checkPermissions($request, $abortOnFail = true)
    {
        $user = $request->user();

        if($abortOnFail) {
Severity: Minor
Found in app/Http/Controllers/ImportPostController.php - About 7 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 activity-log.blade.php has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<template v-if="loaded">
@if($email_verified_at === null)
<div class="alert alert-danger mb-3">
    <p class="mb-0 font-weight-bold">Applicant has not verified their email address yet, action can not be taken at this time.</p>
</div>

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

            $ids = $ids->map(function ($profile) {
                return AccountService::get($profile->id, true);
            })
                ->filter(function ($profile) {
                    return $profile && isset($profile['id'], $profile['locked']) && ! $profile['locked'];
    Severity: Major
    Found in app/Http/Controllers/Api/ApiV1Controller.php and 1 other location - About 7 hrs to fix
    app/Http/Controllers/DiscoverController.php on lines 400..419

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

    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

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

            $ids = $ids->map(function ($profile) {
                return AccountService::get($profile->id, true);
            })
                ->filter(function ($profile) {
                    return $profile && isset($profile['id'], $profile['locked']) && ! $profile['locked'];
    Severity: Major
    Found in app/Http/Controllers/DiscoverController.php and 1 other location - About 7 hrs to fix
    app/Http/Controllers/Api/ApiV1Controller.php on lines 4080..4099

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

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

        public function statusCreate(Request $request)
        {
            abort_if(! $request->user() || ! $request->user()->token(), 403);
            abort_unless($request->user()->tokenCan('write'), 403);
    
    
    Severity: Minor
    Found in app/Http/Controllers/Api/ApiV1Controller.php - About 7 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

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

                "@context" => [
                    "https://www.w3.org/ns/activitystreams",
                    "https://w3id.org/security/v1",
                    [
                        "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
    Severity: Major
    Found in app/Http/Controllers/InstanceActorController.php and 1 other location - About 7 hrs to fix
    app/Models/InstanceActor.php on lines 26..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 229.

    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

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

                "@context" => [
                    "https://www.w3.org/ns/activitystreams",
                    "https://w3id.org/security/v1",
                    [
                        "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
    Severity: Major
    Found in app/Models/InstanceActor.php and 1 other location - About 7 hrs to fix
    app/Http/Controllers/InstanceActorController.php on lines 28..82

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

    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

    File PortfolioController.php has 465 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace App\Http\Controllers;
    
    use Illuminate\Http\Request;
    Severity: Minor
    Found in app/Http/Controllers/PortfolioController.php - About 7 hrs to fix

      Method statusCreate has 177 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function statusCreate(Request $request)
          {
              abort_if(! $request->user() || ! $request->user()->token(), 403);
              abort_unless($request->user()->tokenCan('write'), 403);
      
      
      Severity: Major
      Found in app/Http/Controllers/Api/ApiV1Controller.php - About 7 hrs to fix

        Method getData has 173 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getData(Request $request)
            {
                abort_if(now()->gt('2021-03-01 00:00:00'), 404);
                abort_if(config('database.default') != 'mysql', 404);
        
        
        Severity: Major
        Found in app/Http/Controllers/SeasonalController.php - About 6 hrs to fix

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

          <?php
          
          namespace App\Jobs\FollowPipeline;
          
          use Illuminate\Bus\Queueable;
          Severity: Major
          Found in app/Jobs/FollowPipeline/FollowRejectPipeline.php and 1 other location - About 6 hrs to fix
          app/Jobs/FollowPipeline/FollowAcceptPipeline.php on lines 1..69

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

          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\StoryPipeline;
          
          use App\Story;
          Severity: Major
          Found in app/Jobs/StoryPipeline/StoryReplyDeliver.php and 1 other location - About 6 hrs to fix
          app/Jobs/StoryPipeline/StoryReactionDeliver.php on lines 1..70

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

          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\StoryPipeline;
          
          use App\Story;
          Severity: Major
          Found in app/Jobs/StoryPipeline/StoryReactionDeliver.php and 1 other location - About 6 hrs to fix
          app/Jobs/StoryPipeline/StoryReplyDeliver.php on lines 1..70

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

          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\FollowPipeline;
          
          use Illuminate\Bus\Queueable;
          Severity: Major
          Found in app/Jobs/FollowPipeline/FollowAcceptPipeline.php and 1 other location - About 6 hrs to fix
          app/Jobs/FollowPipeline/FollowRejectPipeline.php on lines 1..69

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

          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

          File StoryComposeController.php has 444 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace App\Http\Controllers;
          
          use App\DirectMessage;
          Severity: Minor
          Found in app/Http/Controllers/StoryComposeController.php - About 6 hrs to fix

            File StoryApiV1Controller.php has 440 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            namespace App\Http\Controllers\Stories;
            
            use App\DirectMessage;
            Severity: Minor
            Found in app/Http/Controllers/Stories/StoryApiV1Controller.php - About 6 hrs to fix

              File home.blade.php has 430 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              @extends('admin.partial.template-full')
              
              @section('section')
              </div>
              <div class="header bg-primary pb-2 mt-n4">
              Severity: Minor
              Found in resources/views/admin/home.blade.php - About 6 hrs to fix
                Severity
                Category
                Status
                Source
                Language