Showing 286 of 512 total issues
Function create
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$sheets = check($request->input('sheets'));
$method = $request->input('method');
- 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 create
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
{
$fid = int($request->input('fid'));
$forums = (new Forum())->getChildren();
- 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 editDown
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function editDown(int $id, Request $request, Validator $validator)
{
$cid = int($request->input('category'));
/** @var Down $down */
- 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
Method delete
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete(Request $request, Validator $validator): View|RedirectResponse
{
$user = getUserByLogin($request->input('user'));
if (! $user) {
File _feed.blade.php
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
@forelse ($posts as $post)
{{-- Посты --}}
@if ($post instanceof \App\Models\Topic)
<div class="section mb-3 shadow">
<ol class="breadcrumb mb-1">
File PhotoController.php
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
Method create
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
{
$fid = int($request->input('fid'));
$forums = (new Forum())->getChildren();
Method create
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
{
$cid = int($request->input('category'));
if (! isAdmin() && ! setting('downupload')) {
Method create
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(int $id, Request $request, Validator $validator, Flood $flood): RedirectResponse
{
$msg = $request->input('msg');
if (! $user = getUser()) {
Method edit
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Method uploadFile
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function uploadFile(Request $request, Validator $validator): JsonResponse
{
$imageTypes = [
Article::$morphName,
Item::$morphName,
Method saveStatistic
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveStatistic(): void
{
session()->increment('hits');
if (session('online') > SITETIME) {
Validator
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Validator
{
/**
* @var array validation errors
*/
Method index
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(int $id): View
{
$user = getUser();
$topic = Topic::query()
Function edit
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
{
$cid = int($request->input('category'));
/** @var Down $down */
- 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 login
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function login(Request $request, Validator $validator, Flood $flood)
{
if (getUser()) {
setFlash('danger', __('main.already_authorized'));
- 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 LoadController.php
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Admin;
Method editDown
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function editDown(int $id, Request $request, Validator $validator)
{
$cid = int($request->input('category'));
/** @var Down $down */
File ApiController.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
Method rating
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rating(Request $request): JsonResponse
{
$types = [
Post::$morphName,
Article::$morphName,