Showing 1,558 of 1,561 total issues
Method blindKeyRotation
has 46 lines of code (exceeds 25 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) {
Method blindKeyRotation
has 46 lines of code (exceeds 25 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) {
Method directoryHandleServerSubmission
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function directoryHandleServerSubmission(Request $request)
{
$reqs = [];
$reqs['feature_config'] = [
'open_registration' => (bool) config_cache('pixelfed.open_registration'),
Method show
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show(Request $request, $username, $id)
{
// redirect authed users to Metro 2.0
if ($request->user()) {
// unless they force static view
Method store
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(Request $request)
{
$this->validate($request, [
'item' => 'required|integer|min:1',
]);
Method trendingApi
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function trendingApi(Request $request)
{
abort_if(config('instance.discover.public') == false && ! $request->user(), 403);
$this->validate($request, [
Method statusComments
has 46 lines of code (exceeds 25 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,
Method hugeMode
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function hugeMode($minId, $limit, $log)
{
$cloudDisk = Storage::disk(config('filesystems.cloud'));
$localDisk = Storage::disk('local');
Method handle
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(): void
{
$this->info(' ____ _ ______ __ ');
$this->info(' / __ \(_) _____ / / __/__ ____/ / ');
$this->info(' / /_/ / / |/_/ _ \/ / /_/ _ \/ __ / ');
Identical blocks of code found in 2 locations. Consider refactoring. Open
if($collection['published_at'] == null || $collection['visibility'] != 'public') {
abort_unless($user, 404);
if($user->profile_id != $collection['pid']) {
if(!$user->is_admin) {
abort_if($collection['visibility'] != 'private', 404);
- 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 117.
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
if($collection['published_at'] == null || $collection['visibility'] != 'public') {
abort_unless($user, 404);
if($user->profile_id != $collection['pid']) {
if(!$user->is_admin) {
abort_if($collection['visibility'] != 'private', 404);
- 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 117.
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 updateMedia
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updateMedia($status, $activity)
{
if (! isset($activity['attachment'])) {
return;
}
Method fanoutExpiry
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fanoutExpiry()
{
$story = $this->story;
$profile = $story->profile;
Method run
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function run($query)
{
$this->query = $query;
$q = urldecode($query->input('q'));
Method toArray
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function toArray($request)
{
$status = $this;
$taggedPeople = MediaTagService::get($status->id);
$poll = $status->type === 'poll' ? PollService::get($status->id) : null;
Method cleanup
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function cleanup($avatar, $confirm = false)
{
if(!$avatar || !$confirm) {
return;
}
Method apiUsernameCheck
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apiUsernameCheck(Request $request)
{
$this->validate($request, [
'token' => 'required',
'username' => 'required'
Method statusFavouriteById
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function statusFavouriteById(Request $request, $id)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('write'), 403);
Method accountFavourites
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function accountFavourites(Request $request)
{
abort_if(! $request->user() || ! $request->user()->token(), 403);
abort_unless($request->user()->tokenCan('read'), 403);
Method handle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$this->info('Welcome to the avatar sync manager');
$this->line(' ');
$this->line(' ');