alientronics/fleetany-web

View on GitHub

Showing 188 of 188 total issues

Expected 1 blank line at end of file; 2 found
Open

];

Expected 1 blank line at end of file; 2 found
Open

];

Avoid too many return statements within this method.
Open

        return '';
Severity: Major
Found in app/Repositories/HelperRepository.php - About 30 mins to fix

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

        public function setInputs($inputs)
        {
            $inputs['entity_key'] = "part";
            if (empty($inputs['vehicle_id'])) {
                unset($inputs['vehicle_id']);
    Severity: Minor
    Found in app/Repositories/PartRepositoryEloquent.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 results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function results($filters = [])
        {
            $types = $this->scopeQuery(function ($query) use ($filters) {
    
                $query = $query->select('types.*', 'types.entity_key as entity-key');
    Severity: Minor
    Found in app/Repositories/TypeRepositoryEloquent.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 getFleetSensorDatetimeData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getFleetSensorDatetimeData($fleetTireData)
        {
            if (!empty($fleetTireData)) {
                foreach ($fleetTireData as $idVehicle => $tireData) {
                    $lastDatetimeData = $this->getLastDatetimeData($tireData);
    Severity: Minor
    Found in app/Http/Controllers/VehicleController.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

    Avoid using App\Repositories\count() function in for loops.
    Open

                    for ($i = $positionOrder; $i < count($historicalDataPos); $i++) {
                        $historicalData[$countPoints][substr($dataPos->created_at, 11)] .= ", null, null";
                    }

    CountInLoopExpression

    Since: 2.7.0

    Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

    Example

    class Foo {
    
      public function bar()
      {
        $array = array();
    
        for ($i = 0; count($array); $i++) {
          // ...
        }
      }
    }

    Source https://phpmd.org/rules/design.html#countinloopexpression

    Avoid using App\Repositories\count() function in for loops.
    Open

                for ($index = 1; $index <= count($chartElements); $index++) {
                    $tireSensorData['columns'][$value][] = ($key * count($chartElements)) + $index;
                }

    CountInLoopExpression

    Since: 2.7.0

    Using count/sizeof in loops expressions is considered bad practice and is a potential source of many bugs, especially when the loop manipulates an array, as count happens on each iteration.

    Example

    class Foo {
    
      public function bar()
      {
        $array = array();
    
        for ($i = 0; count($array); $i++) {
          // ...
        }
      }
    }

    Source https://phpmd.org/rules/design.html#countinloopexpression

    Line exceeds 120 characters; contains 144 characters
    Open

        "required_if"      => "É obrigatória a indicação de um valor para o campo :attribute quando o valor do campo :other é igual a :value.",

    Line exceeds 120 characters; contains 122 characters
    Open

                        class='$class mdl-color-text--primary-dark mdl-button mdl-js-button mdl-js-ripple-effect button-link' 
    Severity: Minor
    Found in resources/macros/form.php by phpcodesniffer

    Line exceeds 120 characters; contains 133 characters
    Open

        "required_with_all" => "É obrigatória a indicação de um valor para o campo :attribute quando um dos :values está presente.",

    Line exceeds 120 characters; contains 140 characters
    Open

        "required_without_all" => "É obrigatória a indicação de um valor para o campo :attribute quando nenhum dos :values está presente.",

    Line exceeds 120 characters; contains 130 characters
    Open

        "required_without" => "É obrigatória a indicação de um valor para o campo :attribute quanto :values não está presente.",

    Line exceeds 120 characters; contains 125 characters
    Open

        "required_with"    => "É obrigatória a indicação de um valor para o campo :attribute quando :values está presente.",

    Expected 1 newline at end of file; 0 found
    Open

    ];

    Expected 1 newline at end of file; 0 found
    Open

    ];

    Expected 1 newline at end of file; 0 found
    Open

    ];
    Severity: Minor
    Found in resources/lang/en/masks.php by phpcodesniffer

    HACK found
    Open

    * HACK: Even though the intention is to have the current .mdl-spinner__layer-N
    Severity: Minor
    Found in public/css/style-edit.css by fixme

    TODO found
    Open

        // TODO: remove 'name' arg after deprecation is removed
    Severity: Minor
    Found in public/js/moment.js by fixme

    TODO found
    Open

            // TODO: Move this to another part of the creation flow to prevent circular deps
    Severity: Minor
    Found in public/js/moment.js by fixme
    Severity
    Category
    Status
    Source
    Language