Showing 1,558 of 1,561 total issues
Method directoryStore
has 51 lines of code (exceeds 25 allowed). Consider refactoring. 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
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
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
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
public function handle()
{
$old_memory_limit = ini_get('memory_limit');
ini_set('memory_limit', '256M');
$path = storage_path('app/cities.json');
Method handle
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(): void
{
if ($this->batch()->cancelled()) {
return;
}
Method getVerifyCredentials
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getVerifyCredentials($key, $secret, $region, $bucket, $endpoint)
{
$client = new S3Client([
'version' => 'latest',
'region' => $region,
Consider simplifying this complex logical expression. 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
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
public function updateConfiguration(Request $request)
{
abort_if(!$request->user() || !$request->user()->token(), 404);
abort_unless($request->user()->is_admin == 1, 404);
Identical blocks of code found in 2 locations. Consider refactoring. Open
for ($y = 0; $y < $height; ++$y) {
$row = [];
for ($x = 0; $x < $width; ++$x) {
$index = imagecolorat($image, $x, $y);
$colors = imagecolorsforindex($image, $index);
- Read upRead up
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 121.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
for ($y = 0; $y < $height; ++$y) {
$row = [];
for ($x = 0; $x < $width; ++$x) {
$index = imagecolorat($image, $x, $y);
$colors = imagecolorsforindex($image, $index);
- Read upRead up
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 121.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method handle
has 49 lines of code (exceeds 25 allowed). Consider refactoring. 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
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
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
public function bookmarks(Request $request)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);
Method sessionValidateUsername
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sessionValidateUsername(Request $request)
{
abort_unless((
config_cache('pixelfed.open_registration') &&
config('remote-auth.mastodon.enabled')
Method transform
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transform(Status $status)
{
$taggedPeople = MediaTagService::get($status->id);
$poll = $status->type === 'poll' ? PollService::get($status->id) : null;
$rendered = config('exp.autolink') ?
Method create
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function create()
{
$this->info('Create Invite');
$this->line('=============');
$this->info('Set an optional invite name (only visible to admins)');
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function exportFollowing()
{
$data = Cache::remember('account:export:profile:following:'.Auth::user()->profile->id, now()->addMinutes(60), function() {
return Auth::user()->profile->following()->get()->map(function($i) {
return $i->url();
- Read upRead up
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 120.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76