Showing 1,326 of 1,561 total issues
Method get
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get($aid, $tid)
{
$actor = AccountService::get($aid, true);
$target = AccountService::get($tid, true);
if(!$actor || !$target) {
Method getCollection
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getCollection($id)
{
$collection = Cache::remember(self::CACHE_KEY . 'get:' . $id, 86400, function() use($id) {
$collection = Collection::find($id);
if(!$collection) {
Method likedBy
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function likedBy($status)
{
$empty = [
'username' => null,
'others' => false
Method warmCache
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function warmCache($force = false, $limit = 100)
{
if(self::count() == 0 || $force == true) {
$hideNsfw = config('instance.hide_nsfw_on_public_feeds');
Redis::del(self::CACHE_KEY);
Method privateAccountOptions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function privateAccountOptions(Request $request)
{
$this->validate($request, [
'mode' => 'required|string|in:keep-all,mutual-only,only-followers,remove-all',
'duration' => 'required|integer|min:60|max:525600',
Method transform
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Status $status)
{
return [
'id' => (string) $status->id,
'created_at' => $status->created_at->toJSON(),
Method sponsorStore
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sponsorStore(Request $request)
{
$this->validate($request, [
'patreon' => 'nullable|string',
'liberapay' => 'nullable|string',
Method deleteId
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deleteId(Request $request)
{
abort_if(!$request->user(), 403);
$this->validate($request, [
'collection_id' => 'required|int|min:1|exists:collections,id',
Method relistInstance
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function relistInstance()
{
$id = search(
'Search by domain',
fn (string $value) => strlen($value) > 0
Method unbanInstance
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function unbanInstance()
{
$id = search(
'Search by domain',
fn (string $value) => strlen($value) > 0
Method refetchRemoteAvatars
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function refetchRemoteAvatars()
{
if(!$this->confirm('Are you sure you want to refetch all remote avatars? This could take a while.')) {
return;
}
Method unlistInstance
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function unlistInstance()
{
$id = search(
'Search by domain',
fn (string $value) => strlen($value) > 0
Method banInstance
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function banInstance()
{
$id = search(
'Search by domain',
fn (string $value) => strlen($value) > 0
Function handleUpdateActivity
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function handleUpdateActivity()
{
$activity = $this->payload['object'];
if(!isset($activity['type'], $activity['id'])) {
- 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
Function run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
pixlfed.run = function() {
var lazyFrames = [].slice.call(document.querySelectorAll("div.pixelfed-embed"));
if ("IntersectionObserver" in window) {
let lazyFrameObserver = new IntersectionObserver(function(entries, observer) {
- 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
Function importActivity
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function importActivity($activity)
{
$profile = $this->profile;
$supported = $this->supported;
$attachments = $activity['object']['attachment'];
- 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
Function handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function handle(): void
{
$sid = $this->sid;
$status = StatusService::get($sid, false);
- 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
Function blindKeyRotation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function blindKeyRotation($headers, $profile, $payload)
{
$signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
$date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
if(!$signature) {
- 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
Function handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$pid = $this->profileId;
$type = $this->followType;
- 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
Function blindKeyRotation
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function blindKeyRotation($headers, $payload)
{
$signature = is_array($headers['signature']) ? $headers['signature'][0] : $headers['signature'];
$date = is_array($headers['date']) ? $headers['date'][0] : $headers['date'];
if(!$signature) {
- 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"