madbob/GASdottoNG

View on GitHub

Showing 437 of 494 total issues

Avoid too many return statements within this method.
Open

            return output_csv($filename, $data->headers, $flat_contents, function($row) {
                return $row;
            });
Severity: Major
Found in code/app/Printers/Aggregate.php - About 30 mins to fix

    Function creditHistory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function creditHistory($class, $date)
        {
            $currencies = Currency::enabled();
            $balances = Balance::whereDate('date', $date)->where('target_type', $class)->get();
            $ret = [];
    Severity: Minor
    Found in code/app/Services/MovementsService.php - About 25 mins to fix

    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 queryMovements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function queryMovements($query = null, $type = 'all')
        {
            if (is_null($query)) {
                $query = Movement::orderBy('created_at', 'desc');
            }
    Severity: Minor
    Found in code/app/Supplier.php - About 25 mins to fix

    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 fastShipping has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fastShipping($deliverer, $aggregate, $users = null)
        {
            DB::beginTransaction();
    
            $service = app()->make('BookingsService');
    Severity: Minor
    Found in code/app/Services/FastBookingsService.php - About 25 mins to fix

    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 saveValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function saveValue($modifier, $obj_mod_target, $altered_amount)
        {
            $modifier_value = $this->retrieveExistingValue($modifier, $obj_mod_target);
    
            /*
    Severity: Minor
    Found in code/app/Singletons/ModifierEngine.php - About 25 mins to fix

    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 dispatchToReferents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function dispatchToReferents($notifiable_users)
        {
            foreach($notifiable_users as $notifiable) {
                if ($notifiable->user->gas->auto_referent_order_summary) {
                    try {
    Severity: Minor
    Found in code/app/Jobs/NotifyClosedOrder.php - About 25 mins to fix

    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 getPrintableUpdaterAttribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getPrintableUpdaterAttribute()
        {
            $last_update = null;
            $last_updater = null;
    
    
    Severity: Minor
    Found in code/app/AggregateBooking.php - About 25 mins to fix

    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 attachUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function attachUser($user_id, $role_id, $target)
        {
            $this->checkAccessToRole($role_id);
            $r = Role::findOrFail($role_id);
            $u = User::tFind($user_id, true);
    Severity: Minor
    Found in code/app/Services/RolesService.php - About 25 mins to fix

    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 revisioned has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function revisioned($id, $approved)
        {
            DB::beginTransaction();
    
            $user = $this->show($id);
    Severity: Minor
    Found in code/app/Services/UsersService.php - About 25 mins to fix

    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 enforceMeasureDiscrete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function enforceMeasureDiscrete(node) {
        var form = node.closest('form');
        var selected = node.find('option:selected').val();
        var discrete = measure_discrete[selected];
        var disabled = (discrete == '1');
    Severity: Minor
    Found in code/resources/assets/js/gasdotto.js - About 25 mins to fix

    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 list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function list($start, $end, $supplier_id, $user_id = 0)
        {
            if ($user_id == '0') {
                $this->ensureAuth(['movements.admin' => 'gas']);
            }
    Severity: Minor
    Found in code/app/Services/ReceiptsService.php - About 25 mins to fix

    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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function destroy($id)
        {
            $product = DB::transaction(function() use ($id) {
                $product = $this->show($id);
                $this->ensureAuth(['supplier.modify' => $product->supplier]);
    Severity: Minor
    Found in code/app/Services/ProductsService.php - About 25 mins to fix

    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 evaluateEmptyBooking has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        static evaluateEmptyBooking(form) {
            if (form.find('input:hidden[name=action]').val() == 'shipped') {
                var test = false;
    
                form.find('.booking-total').each(function() {
    Severity: Minor
    Found in code/resources/assets/js/callables.js - About 25 mins to fix

    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 unalignedPrices has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function unalignedPrices($product)
        {
            $to_change = [];
            $orders = $product->supplier->active_orders;
    
    
    Severity: Minor
    Found in code/app/Http/Controllers/ProductsController.php - About 25 mins to fix

    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 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function create(Request $request)
        {
            $type = $request->input('type', null);
            if (is_null($type)) {
                return view('movement.create');
    Severity: Minor
    Found in code/app/Http/Controllers/MovementsController.php - About 25 mins to fix

    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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function show(Request $request, $id)
        {
            $receipt = $this->service->show($id);
            $user = $request->user();
    
    
    Severity: Minor
    Found in code/app/Http/Controllers/ReceiptsController.php - About 25 mins to fix

    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 iterateUsers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private function iterateUsers($users, $gas, $amount)
        {
            $auto_fee = $gas->getConfig('auto_fee');
    
            foreach($users as $user) {
    Severity: Minor
    Found in code/app/Console/Commands/CheckFees.php - About 25 mins to fix

    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 someoneCan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function someoneCan($permission, $subject = null)
    {
        $basic_roles = App\Role::havingAction($permission);
    
        foreach($basic_roles as $br) {
    Severity: Minor
    Found in code/app/Helpers/Permissions.php - About 25 mins to fix

    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 systemParameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    function systemParameters($type)
    {
        static $types = [];
    
        if (!isset($types[$type])) {
    Severity: Minor
    Found in code/app/Helpers/Reflection.php - About 25 mins to fix

    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 columnsByFeatures has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static function columnsByFeatures($ret)
        {
            $current_gas = currentAbsoluteGas();
    
            if ($current_gas->hasFeature('shipping_places')) {
    Severity: Minor
    Found in code/app/Formatters/User.php - About 25 mins to fix

    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

    Severity
    Category
    Status
    Source
    Language