Showing 35 of 536 total issues
Method makeZip
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeZip(string $filename, Version $version): void
{
$zip = new PharData(public_path($filename));
foreach ($version->files as $file) {
Function returnProjectView
has a Cognitive Complexity of 10 (exceeds 5 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();
- 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 process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function process(string $extension): void
{
if ($extension === 'v') {
$badges = $this->file->version->project->badges()->whereNotNull('commands')->get();
if ($badges->count() === 0) {
- 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
Avoid deeply nested control flow statements. Open
for (let p = 0; p < 8; p++) {
framebuffer[r][p] = document.getElementById('row' + r + 'pixel' + p);
if (!readOnly) {
framebuffer[r][p].onclick = function () {
this.style.backgroundColor = document.getElementById('colour').style.backgroundColor;
Method file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $device,
string $type,
string $category,
string $app,
string $name
Function makeZip
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function makeZip(string $filename, Version $version): void
{
$zip = new PharData(public_path($filename));
foreach ($version->files as $file) {
- 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 ensureWorkDirExists
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function ensureWorkDirExists(): void
{
$base = sys_get_temp_dir() . '/';
$path = str_replace($base, '', $this->tempFolder);
$dirs = explode('/', $path);
- 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 addFiles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function addFiles(string $dir, Version $version, $prefix = ''): void
{
$objects = scandir($dir);
$objects = $objects ? array_diff($objects, ['.git', '.', '..']) : [];
foreach ($objects as $object) {
- 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 getScoreAttribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getScoreAttribute(): float
{
if ($this->votes === null || $this->votes->count() === 0) {
return 0;
}
- 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 up
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function up()
{
auth()->loginUsingId(1);
foreach (Project::all() as $project) {
$version = $project->versions->last();
- 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
Avoid too many return
statements within this method. Open
return redirect()->route('projects.index')->withSuccesses([$project->name . ' being imported!']);
Avoid too many return
statements within this method. Open
return redirect()
->route('projects.edit', ['project' => $file->version->project])
->withSuccesses([$file->name . ' saved']);
Function execute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function execute(string $command): int
{
$stdOut = $stdErr = '';
$returnValue = 255;
$fds = [
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function update(FileUpdateRequest $request, File $file): RedirectResponse
{
try {
$file->content = $request->file_content;
$file->save();
- 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 getDescriptionAttribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getDescriptionAttribute(): ?string
{
$full = true;
$request = request();
if ($request->has('description') && $request->description === 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"