pixelfed/pixelfed

View on GitHub

Showing 1,326 of 1,561 total issues

Function settingsApiUpdateType has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function settingsApiUpdateType(Request $request, $type)
    {
        abort_unless(in_array($type, [
            'posts',
            'platform',
Severity: Minor
Found in app/Http/Controllers/Admin/AdminSettingsController.php - About 1 hr 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 twoFactorVerify has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function twoFactorVerify(Request $request)
    {
        $this->validate($request, [
            'code'  => 'required|string|max:32'
        ]);
Severity: Minor
Found in app/Http/Controllers/AccountController.php - About 1 hr 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 spam has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function spam(Request $request)
    {
        $this->validate($request, [
            'tab' => 'sometimes|in:home,not-spam,spam,settings,custom,exemptions',
        ]);
Severity: Minor
Found in app/Http/Controllers/Admin/AdminReportController.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle($request, Closure $next)
    {
        $ar = [
            'login', 
            'logout',
Severity: Minor
Found in app/Http/Middleware/AccountInterstitial.php - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function redirect(Request $request)
    {
        abort_unless((
            config_cache('pixelfed.open_registration') &&
            config('remote-auth.mastodon.enabled')
Severity: Minor
Found in app/Http/Controllers/RemoteAuthController.php - About 1 hr 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 accountStatuses has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function accountStatuses(Request $request, $id)
    {
        $this->validate($request, [
            'only_media' => 'nullable',
            'pinned' => 'nullable',
Severity: Minor
Found in app/Http/Controllers/PublicApiController.php - About 1 hr 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 transform has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function transform(Profile $profile)
    {
        if (! $profile) {
            return [];
        }
Severity: Minor
Found in app/Transformer/Api/AccountTransformer.php - About 1 hr 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 statusReplies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function statusReplies(Request $request, $id)
    {
        abort_if(! $request->user(), 403);

        $this->validate($request, [
Severity: Minor
Found in app/Http/Controllers/Api/ApiV1Controller.php - About 1 hr 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 statusComments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function statusComments(Request $request, $username, int $postId)
    {
        $this->validate($request, [
            'min_id'    => 'nullable|integer|min:1',
            'max_id'    => 'nullable|integer|min:1|max:'.PHP_INT_MAX,
Severity: Minor
Found in app/Http/Controllers/PublicApiController.php - About 1 hr 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 createStream has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function createStream(Request $request)
    {
        abort_if(!config('livestreaming.enabled'), 400);
        abort_if(!$request->user(), 403);

Severity: Minor
Found in app/Http/Controllers/LiveStreamController.php - About 1 hr 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 statusShare has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function statusShare(Request $request, $id)
    {
        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 1 hr 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 notifications has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function notifications(Request $request)
    {
        abort_if(!$request->user(), 403);

        $pid = $request->user()->profile_id;
Severity: Minor
Found in app/Http/Controllers/Api/BaseApiController.php - About 1 hr 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 scopeToAudience has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function scopeToAudience($audience)
    {
        if(!in_array($audience, ['to', 'cc']) || $this->local == false) { 
            return;
        }
Severity: Minor
Found in app/Status.php - About 1 hr 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

Method validate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function validate($payload)
    {
        $valid = Validator::make($payload, [
            '@context' => 'required',
            'id' => 'required|string',
Severity: Minor
Found in app/Util/ActivityPub/Validator/Add.php - About 1 hr to fix

    Method get has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get($profile)
        {
            abort_if(! (bool) config_cache('federation.activitypub.enabled'), 404);
            abort_if(! config('federation.activitypub.outbox'), 404);
    
    
    Severity: Minor
    Found in app/Util/ActivityPub/Outbox.php - About 1 hr to fix

      Method deliver has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function deliver()
          {
              $status = $this->status;
              $types = [
                  'photo',
      Severity: Minor
      Found in app/Jobs/StatusPipeline/StatusEntityLexer.php - About 1 hr to fix

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

            public function handle()
            {
                $like = $this->like;
        
                $status = $this->like->status;
        Severity: Minor
        Found in app/Jobs/LikePipeline/UnlikePipeline.php - About 1 hr to fix

          Method apiEmailCheck has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function apiEmailCheck(Request $request)
              {
                  $this->validate($request, [
                      'token' => 'required',
                      'email' => 'required'
          Severity: Minor
          Found in app/Http/Controllers/AdminInviteController.php - About 1 hr to fix

            Method store has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function store(Request $request)
                {
                    abort_unless($request->user(), 404);
            
                    $this->validate($request, [
            Severity: Minor
            Found in app/Http/Controllers/PortfolioController.php - About 1 hr to fix

              Method embed has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function embed(Request $request, $username)
                  {
                      $res = view('profile.embed-removed');
              
                      if (! (bool) config_cache('instance.embed.profile')) {
              Severity: Minor
              Found in app/Http/Controllers/ProfileController.php - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language