Showing 160 of 160 total issues
Function getFindData
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function getFindData()
{
$q = request('q');
$id = request('id');
$limit = request('limit') ?: 10;
- 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 getPreview
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function getPreview($one, $two = null, $three = null, $four = null, $five = null)
{
if ($two) {
$fullFilePath = 'uploads'.DIRECTORY_SEPARATOR.$one.DIRECTORY_SEPARATOR.$two;
- 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
CBController
has 36 functions (exceeds 20 allowed). Consider refactoring. Open
class CBController extends Controller
{
public $data_inputan;
public $columns_table;
Method validation
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validation($id = null)
{
$request_all = Request::all();
$array_input = [];
Method postEditSave
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postEditSave($id)
{
$this->cbLoader();
$row = DB::table($this->table)->where($this->primary_key, $id)->first();
Method input_assignment
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function input_assignment($id = null)
{
$hide_form = (request('hide_form')) ? unserialize(request('hide_form')) : [];
Method postAddSave
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postAddSave()
{
$this->cbLoader();
if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
CRUDBooster::insertLog(cbLang('log_try_add_save', [
Function getColumnTable
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
function getColumnTable($table, $type = 'list')
{
$this->cbLoader();
$result = [];
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($ro['relationship_table'] && $ro["datatable_orig"] == "") {
$datatable = explode(",", $ro['datatable'])[0];
$foreignKey2 = CRUDBooster::getForeignKey($datatable, $ro['relationship_table']);
$foreignKey = CRUDBooster::getForeignKey($this->table, $ro['relationship_table']);
- 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 156.
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 ($ro['relationship_table']) {
$datatable = explode(",", $ro['datatable'])[0];
$foreignKey2 = CRUDBooster::getForeignKey($datatable, $ro['relationship_table']);
$foreignKey = CRUDBooster::getForeignKey($this->table, $ro['relationship_table']);
- 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 156.
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 postDoImportChunk
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postDoImportChunk()
{
$this->cbLoader();
$file_md5 = md5(request('file'));
Method getPreview
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPreview($one, $two = null, $three = null, $four = null, $five = null)
{
if ($two) {
$fullFilePath = 'uploads'.DIRECTORY_SEPARATOR.$one.DIRECTORY_SEPARATOR.$two;
File MenusController.php
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php namespace crocodicstudio\crudbooster\controllers;
use CRUDBooster;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
Function sidebarMenu
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function sidebarMenu()
{
$menu_active = DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".self::myPrivilegeId()."')")->where('parent_id', 0)->where('is_active', 1)->where('is_dashboard', 0)->orderby('sorting', 'asc')->select('cms_menus.*')->get();
foreach ($menu_active as &$menu) {
- 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 getFindData
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFindData()
{
$q = request('q');
$id = request('id');
$limit = request('limit') ?: 10;
Method postAddSave
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function postAddSave()
{
$this->cbLoader();
if (! CRUDBooster::isCreate() && $this->global_privilege == false) {
Function checkRequirements
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function checkRequirements()
{
$this->info('System Requirements Checking:');
$system_failed = 0;
$laravel = app();
- 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 checkRequirements
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function checkRequirements()
{
$this->info('System Requirements Checking:');
$system_failed = 0;
$laravel = app();
- 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 ApiCustomController.php
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php namespace crocodicstudio\crudbooster\controllers;
use CRUDbooster;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Excel;
Method checkRequirements
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function checkRequirements()
{
$this->info('System Requirements Checking:');
$system_failed = 0;
$laravel = app();