Showing 1,326 of 1,561 total issues
Function publicTimelineApi
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
public function publicTimelineApi(Request $request)
{
$this->validate($request,[
'page' => 'nullable|integer|max:40',
'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
- Read upRead up
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 landing.js
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require('./polyfill');
import Vue from 'vue';
window.Vue = Vue;
import VueRouter from "vue-router";
import Vuex from "vuex";
File app.js
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require('./polyfill');
window._ = require('lodash');
window.Popper = require('popper.js').default;
window.pixelfed = window.pixelfed || {};
window.$ = window.jQuery = require('jquery');
Method handleVerb
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handleVerb()
{
$verb = (string) $this->payload['type'];
switch ($verb) {
Method handle
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle()
{
$profile = null;
$headers = $this->headers;
$payload = json_decode($this->payload, true, 8);
Method getJson
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Method directoryStore
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function directoryStore(Request $request)
{
$this->validate($request, [
'location' => 'string|min:1|max:53',
'summary' => 'string|nullable|max:140',
Method showEmbed
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function showEmbed(Request $request, $username, int $id)
{
if (! (bool) config_cache('instance.embed.post')) {
$res = view('status.embed-removed');
Method transform
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function transform(Status $status)
{
$pid = request()->user()->profile_id;
$taggedPeople = MediaTagService::get($status->id);
$poll = $status->type === 'poll' ? PollService::get($status->id, $pid) : null;
Method handle
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle()
{
$enabled = (bool) config_cache('pixelfed.cloud_storage');
if(!$enabled) {
$this->error('Cloud storage not enabled. Exiting...');
Method handle
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle()
{
$old_memory_limit = ini_get('memory_limit');
ini_set('memory_limit', '256M');
$path = storage_path('app/cities.json');
Method getVerifyCredentials
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getVerifyCredentials($key, $secret, $region, $bucket, $endpoint)
{
$client = new S3Client([
'version' => 'latest',
'region' => $region,
Method handle
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(): void
{
if ($this->batch()->cancelled()) {
return;
}
Consider simplifying this complex logical expression. Open
Open
if(
!$json ||
!isset($json['id']) ||
!isset($json['type']) ||
$json['type'] !== 'Emoji' ||
Method getRequirements
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getRequirements()
{
abort_if(file_exists(base_path('.env')), 404);
$reqs = [];
Method updateConfiguration
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function updateConfiguration(Request $request)
{
abort_if(!$request->user() || !$request->user()->token(), 404);
abort_unless($request->user()->is_admin == 1, 404);
Method handle
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle()
{
$status = $this->status;
$actor = $status->profile;
$reply = Status::find($status->in_reply_to_id);
Method remoteAnnounceDeliver
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function remoteAnnounceDeliver()
{
if (config('app.env') !== 'production' || (bool) config_cache('federation.activitypub.enabled') == false) {
$status->delete();
Method getMastodon
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function getMastodon($id, $publicOnly = true)
{
$status = self::get($id, $publicOnly, true);
if(!$status) {
return null;
Method bookmarks
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function bookmarks(Request $request)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);