Showing 494 of 494 total issues
Function init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static init(container)
{
$('.dates-for-orders', container).each((index, item) => {
/*
Questo è per fare in modo che le date siano sempre coerenti tra
Method index
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request)
{
try {
$data['movements'] = $this->service->list($request->all());
$ret = null;
Method store
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(Request $request)
{
DB::beginTransaction();
$data = $request->input('data');
Method up
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up()
{
Schema::table('roles', function (Blueprint $table) {
$table->string('identifier')->default('');
$table->boolean('system')->default(false);
Method run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run($request)
{
$user = Auth::user();
$service = app()->make('BookingsService');
Method filterBySupplier
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function filterBySupplier($supplier, $user, $query, $own)
{
$type = 'all';
if ($supplier) {
Method handle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$hub = app()->make('GlobalScopeHub');
$gas = $hub->getGasObj();
Method selective
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function selective()
{
if (currentAbsoluteGas()->hasFeature('shipping_places')) {
return [
'truck' => (object) [
Function updateBookingModifiers
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
static updateBookingModifiers(dynamic_modifiers, container)
{
$('input[name^="modifier-"]', container).each(function() {
let modid = parseInt($(this).attr('name').split('-')[1]);
if (modid == 0) {
Method descriptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function descriptions($target)
{
/*
Qui predispongo le stringhe descrittive per tutte le possibili
combinazioni di valori, destinate a rendere più comprensibile la
Method getConvenientStringsAttribute
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConvenientStringsAttribute()
{
$suppliers = [];
$shipping_date = PHP_INT_MAX;
Function completionRowsInit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function completionRowsInit(node) {
$(node).find('input:text').each(function() {
if ($(this).hasClass('ui-autocomplete-input') == true) {
return;
}
Method saving
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saving(Movement $movement)
{
if ($this->movements_hub->isSuspended()) {
return true;
}
Method update
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update(Request $request, $id)
{
DB::beginTransaction();
$user = Auth::user();
Method retrievePreSelectedFields
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function retrievePreSelectedFields($parameters)
{
$selected = [];
if (isset($parameters['sorted_fields']) && empty($parameters['sorted_fields']) == false) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('.table-number-filters input.table-number-filter', container).keyup((e) => {
this.tableFilters($(e.currentTarget).closest('.table-number-filters').attr('data-table-target'));
});
- 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 57.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('.table-filters input:radio', container).change((e) => {
this.tableFilters($(e.currentTarget).closest('.table-filters').attr('data-table-target'));
});
- 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 57.
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
Function applyDefinition
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function applyDefinition($booking, $modifier, $amount, $definition, $target)
{
list($quantity_attribute, $price_attribute, $weight_attribute) = $this->applicationOffsets($booking);
$reference_quantity = 1;
- 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 hasWarningWithinOrder
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function hasWarningWithinOrder($summary)
{
if (isset($summary->products[$this->id])) {
$quantity = $summary->products[$this->id]->quantity;
- 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 postFeedback
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function postFeedback(Request $request, $id)
{
$ret = [];
if ($id == 'booking-payment') {
- 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"