pixelfed/pixelfed

View on GitHub

Showing 1,558 of 1,561 total issues

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

    public function store(Request $request)
    {
        $this->validate($request, [
            'item'    => 'required|integer|min:1',
        ]);
Severity: Minor
Found in app/Http/Controllers/LikeController.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 instagramStepOneStore has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function instagramStepOneStore(Request $request, $uuid)
    {
        if((bool) config_cache('pixelfed.import.instagram.enabled') != true) {
            abort(404, 'Feature not enabled');
        }
Severity: Minor
Found in app/Http/Controllers/Import/Instagram.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 thumbnailUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function thumbnailUrl()
    {
        if($this->thumbnail_url) {
            return $this->thumbnail_url;
        }
Severity: Minor
Found in app/Media.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 deleting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleting(Avatar $avatar)
    {
        $path = storage_path('app/'.$avatar->media_path);
        if (is_file($path) &&
            $avatar->media_path != 'public/avatars/default.png' &&
Severity: Minor
Found in app/Observers/AvatarObserver.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 autospamHandle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function autospamHandle(Request $request)
    {
        abort_if(!$request->user() || !$request->user()->token(), 404);

        abort_unless($request->user()->is_admin == 1, 404);
Severity: Minor
Found in app/Http/Controllers/Api/AdminApiController.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 includeStatus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function includeStatus(Notification $notification)
    {
        $item = $notification;
        if($item->item_id && $item->item_type == 'App\Status') {
            $status = Status::with('media')->find($item->item_id);
Severity: Minor
Found in app/Transformer/Api/Mastodon/v1/NotificationTransformer.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 clientBroadcastPublish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function clientBroadcastPublish(Request $request)
    {
        abort_if(!config('livestreaming.enabled'), 400);
        abort_if($request->ip() != '127.0.0.1', 400);
        $key = $request->input('name');
Severity: Minor
Found in app/Http/Controllers/LiveStreamController.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()
    {
        $enabled = (bool) config_cache('pixelfed.cloud_storage');
        if(!$enabled) {
            $this->error('Cloud storage not enabled. Exiting...');
Severity: Minor
Found in app/Console/Commands/MediaS3GarbageCollector.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()
    {
        $tag = $this->argument('tag');
        $hashtag = Hashtag::whereName($tag)->orWhere('slug', $tag)->first();
        if(!$hashtag) {
Severity: Minor
Found in app/Console/Commands/HashtagRelatedGenerate.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 validateDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validateDomain($domain)
    {
        if(!strpos($domain, '.')) {
            return;
        }
Severity: Minor
Found in app/Console/Commands/AddUserDomainBlock.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()
    {
        $this->info('Pixelfed Avatar Storage Manager');
        $this->line(' ');
        $segments = [
Severity: Minor
Found in app/Console/Commands/AvatarStorage.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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function url($forceLocal = false)
    {
        if($this->uri) {
            return $forceLocal ? "/i/web/post/_/{$this->profile_id}/{$this->id}" : $this->uri;
        } else {
Severity: Minor
Found in app/Status.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 adminStatusLabel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function adminStatusLabel()
    {
        if($this->user_has_responded) {
            return '<span class="border border-warning px-3 py-1 rounded text-white font-weight-bold">Awaiting Admin Response</span>';
        }
Severity: Minor
Found in app/Models/CuratedRegister.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 schedule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function schedule(Schedule $schedule)
    {
        $schedule->command('media:optimize')->hourlyAt(40)->onOneServer();
        $schedule->command('media:gc')->hourlyAt(5)->onOneServer();
        $schedule->command('horizon:snapshot')->everyFiveMinutes()->onOneServer();
Severity: Minor
Found in app/Console/Kernel.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()
    {
        $old_memory_limit = ini_get('memory_limit');
        ini_set('memory_limit', '256M');
        $path = storage_path('app/cities.json');
Severity: Minor
Found in app/Console/Commands/ImportCities.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()
    {

        $this->info('       ____  _           ______         __  ');
        $this->info('      / __ \(_)  _____  / / __/__  ____/ /  ');
Severity: Minor
Found in app/Console/Commands/FixHashtags.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 handleChoice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handleChoice($id)
    {
        switch ($id) {
            case 'Cancel':
                return;
Severity: Minor
Found in app/Console/Commands/AvatarStorage.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 validateDomain has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validateDomain($domain)
    {
        if(!strpos($domain, '.')) {
            return;
        }
Severity: Minor
Found in app/Console/Commands/DeleteUserDomainBlock.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