rinvex/cortex-foundation

View on GitHub

Showing 43 of 183 total issues

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

    protected function getStub(): string
    {
        $stub = null;

        if ($this->option('parent')) {
Severity: Minor
Found in src/Console/Commands/ControllerMakeCommand.php - About 45 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 buildColumnByCollection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function buildColumnByCollection(array $row, Collection $columns, $type = 'printable'): array
    {
        $results = [];
        $visibleCOlumns = request()->get('visible_columnss', []);

Severity: Minor
Found in src/Transformers/DataArrayTransformer.php - About 45 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 route_domains has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    function route_domains(string $accessarea = null): array
    {
        static $cachedDomains = null;

        if (isset($cachedDomains[$accessarea])) {
Severity: Minor
Found in src/Support/helpers.php - About 45 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

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($name, SessionHandlerInterface $handler, EncrypterContract $encrypter, $id = null, $serialization = 'php')
Severity: Minor
Found in src/Overrides/Illuminate/Session/EncryptedStore.php - About 35 mins to fix

Function query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function query()
    {
        $model = app($this->model);
        $currentUser = $this->request()->user();
        $query = $model->query();
Severity: Minor
Found in src/DataTables/AbstractDataTable.php - About 35 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 too many return statements within this method.
Open

                return $this->guard = $guard;
Severity: Major
Found in src/Http/Request.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return $this->prepareResponse($request, $e);
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return false;
Severity: Major
Found in src/Providers/FoundationServiceProvider.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return intend([
                'url' => Route::has($route) ? route($route) : route("{$request->accessarea()}.home"),
                'with' => ['warning' => trans('cortex/foundation::messages.resource_not_found', ['resource' => $resource, 'identifier' => $matches[0]])],
            ], 404);
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return intend([
                'url' => route($request->accessarea().'.cortex.auth.account.login'),
                'with' => ['warning' => trans('cortex/auth::messages.unauthenticated')],
            ], 401);
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return intend([
                'back' => true,
                'withInput' => $request->all(),
                'with' => ['warning' => $e->getMessage()],
            ], $e->getStatusCode()); // 429
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return in_array($name, $parameterNames);
Severity: Major
Found in src/Providers/FoundationServiceProvider.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                return $this->guard = $guard;
Severity: Major
Found in src/Http/Request.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return $this->guard = $this->isApi ? config('auth.defaults.apiguard') : config('auth.defaults.guard');
Severity: Major
Found in src/Http/Request.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return intend([
                'url' => in_array($request->accessarea(), ['tenantarea', 'managerarea']) ? route('tenantarea.home') : route('frontarea.home'),
                'with' => ['warning' => $e->getMessage()],
            ], 403);
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return parent::render($request, $e);
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

                    return intend([
                        'url' => $originalUrl !== $localizedUrl ? $localizedUrl : route("{$request->accessarea()}.home"),
                        'with' => ['warning' => $e->getMessage()],
                    ], $e->getStatusCode()); // 404
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return intend([
                'url' => route('frontarea.home'),
                'with' => ['warning' => $e->getMessage()],
            ], 404); // 429
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

        return (array) $accessareas;
Severity: Major
Found in src/Traits/Accessible.php - About 30 mins to fix

Avoid too many return statements within this method.
Open

            return intend([
                'url' => route("{$request->accessarea()}.home"),
                'with' => ['warning' => $e->getMessage()],
            ], 404);
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 30 mins to fix
Severity
Category
Status
Source
Language