alientronics/fleetany-web-admin

View on GitHub

Showing 9 of 9 total issues

Function validateRole has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateRole($inputs, $idRole = null)
    {
        $role = Role::where(function ($query) use ($inputs) {
                        $query->where('name', $inputs['name'])
                            ->orWhere('slug', $inputs['slug'])

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

Each class must be in a file by itself
Open

class HelperRepository {
Severity: Minor
Found in helper/Controller.php by phpcodesniffer

Opening brace of a class must be on the line after the definition
Open

class HelperRepository {
Severity: Minor
Found in helper/Controller.php by phpcodesniffer

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

    public function validatePermission($inputs, $idPermission = null)
    {
        $permission = Permission::where(function ($query) use ($inputs) {
                        $query->where('name', $inputs['permissiondialog_name'])
                            ->orWhere('description', $inputs['permissiondialog_description']);

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

Spaces must be used to indent lines; tabs are not allowed
Open

    

Spaces must be used to indent lines; tabs are not allowed
Open

    

Opening brace should be on a new line
Open

    public function getFilters() { }
Severity: Minor
Found in helper/Controller.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in helper/Controller.php by phpcodesniffer

Closing brace must be on a line by itself
Open

    public function getFilters() { }
Severity: Minor
Found in helper/Controller.php by phpcodesniffer
Severity
Category
Status
Source
Language