Showing 35 of 536 total issues
Function onload
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
window.onload = function () {
const ext = document.getElementById('extension');
let langmode = 'python';
if (ext) {
if (ext.getAttribute('value') === 'json') {
- 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 onload
has 155 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.onload = function () {
const ext = document.getElementById('extension');
let langmode = 'python';
if (ext) {
if (ext.getAttribute('value') === 'json') {
File illustrated-layout.blade.php
has 388 lines of code (exceeds 250 allowed). Consider refactoring. Open
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
Project
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Project extends Model
{
use SoftDeletes;
use HasFactory;
File ProjectsController.php
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
File Project.php
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace App\Models;
File app.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global require */
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
ProjectsController
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class ProjectsController extends Controller
{
/**
* Create a new controller instance.
*/
Function pixelToHexA
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
window.pixelToHexA = function (rgba) {
let remove = 5;
if (rgba.indexOf('rgba') === -1) {
remove = 4;
}
- 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 PublicController.php
has 257 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace App\Http\Controllers;
Function pixelToHexA
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.pixelToHexA = function (rgba) {
let remove = 5;
if (rgba.indexOf('rgba') === -1) {
remove = 4;
}
Method returnProjectView
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function returnProjectView(Request $request, $projects, string $badge = '')
{
$category = '';
if ($request->has('category')) {
$category = Category::where('slug', $request->get('category'))->firstOrFail();
Method app
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function app(string $device, string $type, string $category, string $app): JsonResponse
{
/** @var Badge $badge */
$badge = Badge::whereSlug($device)->firstOrFail();
$categoryId = Category::whereSlug($category)->firstOrFail()->id;
Function manageBadges
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function manageBadges(Project $project, Request $request): void
{
if ($request->has('badge_ids')) {
$project->badges()->detach();
$badges = Badge::find($request->get('badge_ids'));
- 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 handle
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$sitemap = Sitemap::create()
->add(
Url::create('/')
Method execute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function execute(string $command): int
{
$stdOut = $stdErr = '';
$returnValue = 255;
$fds = [
Method boot
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function boot(): void
{
parent::boot();
static::creating(
Method handle
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(Git $git)
{
$version = $this->project->getUnpublishedVersion();
try {
Method projectJson
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function projectJson(string $slug): JsonResponse
{
/** @var Project|null $project */
$project = Project::where('slug', $slug)->first();
if ($project === null) {
Method update
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update(FileUpdateRequest $request, File $file): RedirectResponse
{
try {
$file->content = $request->file_content;
$file->save();