madbob/GASdottoNG

View on GitHub

Showing 494 of 494 total issues

Function readRID has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function readRID($user, $request)
    {
        if ($user->gas->hasFeature('rid')) {
            $rid = $user->rid;
            $changed = false;
Severity: Minor
Found in code/app/Services/UsersService.php - About 55 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 testConstraints has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function testConstraints($quantity, $variant = null, $only_mandatory = false)
    {
        $sorted_contraints = Constraint::sortedContraints($only_mandatory);
        foreach($sorted_contraints as $constraints) {
            foreach($constraints as $constraint) {
Severity: Minor
Found in code/app/BookedProduct.php - About 55 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 fixModifiers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function fixModifiers($id, $action)
    {
        switch($action) {
            case 'none':
                break;
Severity: Minor
Found in code/app/Services/OrdersService.php - About 55 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 startTour has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function startTour(Request $request)
    {
        $user = $request->user();
        $gas = $user->gas;

Severity: Minor
Found in code/app/Http/Controllers/TourController.php - About 55 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 translateValueInComponent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function translateValueInComponent($params, $extraitem)
{
    $translated = [];

    if (!empty($params['value'])) {
Severity: Minor
Found in code/app/Helpers/Components.php - About 55 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 handle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        $this->doAlways();

        /*
Severity: Minor
Found in code/app/Console/Commands/FixDatabase.php - About 55 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 topLevelBookings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function topLevelBookings($status = null)
    {
        $ret = [];

        if (is_null($status)) {
Severity: Minor
Found in code/app/Order.php - About 55 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 handle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        $today = Carbon::today()->format('Y-m-d');
        $orders = Order::withoutGlobalScopes()->where('status', 'open')->where('end', '<', $today)->get();
        $notifications = [];
Severity: Minor
Found in code/app/Console/Commands/CloseOrders.php - About 55 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 saveInstances has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function saveInstances($event, $email, $message)
    {
        $instances = get_instances();
        $now = date('Y-m-d G:i:s');

Severity: Minor
Found in code/app/Http/Controllers/MailController.php - About 55 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 env_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function env_file()
{
    if (global_multi_installation()) {
        $instance = null;

Severity: Minor
Found in code/app/Helpers/Paths.php - About 55 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 descendReduction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function descendReduction($ret, $filters)
    {
        foreach ($this->describingAttributes() as $attr) {
            if (!isset($ret->$attr)) {
                $ret->$attr = 0;
Severity: Minor
Found in code/app/Models/Concerns/ReducibleTrait.php - About 55 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 plainStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function plainStatus()
    {
        if (is_null($this->suspended_at) && is_null($this->deleted_at)) {
            return 'active';
        }
Severity: Minor
Found in code/app/Models/Concerns/SuspendableTrait.php - About 55 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 printableHeader has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function printableHeader()
    {
        $ret = $this->printableName();

        $step = $this;
Severity: Minor
Found in code/app/Role.php - About 55 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 handleTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handleTable($obj, $request)
    {
        $action = $request['action'] ?? 'download';
        $status = $request['status'] ?? 'pending';
        $include_missing = $request['include_missing'] ?? 'no';
Severity: Minor
Found in code/app/Printers/Order.php - About 55 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 assignPeers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function assignPeers($m, $senders, $targets, $index)
    {
        $t = MovementType::find($m->type);

        foreach(['sender', 'target'] as $f) {
Severity: Minor
Found in code/app/Importers/CSV/Movements.php - About 55 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 guessGas has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function guessGas()
    {
        $candidates = [];
        $valid = [];
        $threshold = $this->orders->count();
Severity: Minor
Found in code/app/Aggregate.php - About 55 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 readXML has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function readXML($xml)
    {
        $supplier = new Supplier();
        $products = new Collection();
        $orders = new Collection();
Severity: Minor
Found in code/app/Importers/GDXP/Suppliers.php - About 55 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 importJSON has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function importJSON($master, $json, $replace)
    {
        if (is_null($replace)) {
            $supplier = new Supplier();
            $supplier->payment_method = '';
Severity: Minor
Found in code/app/Importers/GDXP/Suppliers.php - About 55 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 transactionType has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function transactionType($movement, $peer)
    {
        $o = $this->opsByMethod($movement->method);

        if ($o) {
Severity: Minor
Found in code/app/MovementType.php - About 55 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        $('.icons-legend button, .icons-legend a', container).click((e) => {
            e.preventDefault();
            this.iconsLegendTrigger($(e.currentTarget), '.icons-legend');
        });
Severity: Minor
Found in code/resources/assets/js/filters.js and 1 other location - About 50 mins to fix
code/resources/assets/js/filters.js on lines 15..18

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 51.

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

Further Reading

Severity
Category
Status
Source
Language