rinvex/cortex-foundation

View on GitHub

Showing 43 of 183 total issues

Function guard has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

    public function guard(): string
    {
        if (! is_null($this->guard)) {
            return $this->guard;
        }
Severity: Minor
Found in src/Http/Request.php - About 4 hrs 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 getMessages has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getMessages($noSort)
    {
        $messages = [];

        foreach (array_merge(array_values(app('translation.loader')->namespaces()), [$this->sourcePath]) as $directory) {
Severity: Minor
Found in src/Generators/LangJsGenerator.php - About 3 hrs 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 render has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function render($request, Throwable $e)
    {
        if ($e instanceof TokenMismatchException) {
            return intend([
                'back' => true,
Severity: Major
Found in src/Exceptions/ExceptionHandler.php - About 3 hrs to fix

Store has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Store extends BaseStore
{
    /**
     * Start the session, reading the data from a handler.
     *
Severity: Minor
Found in src/Overrides/Illuminate/Session/Store.php - About 2 hrs to fix

Function render has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function render($request, Throwable $e)
    {
        if ($e instanceof TokenMismatchException) {
            return intend([
                'back' => true,
Severity: Minor
Found in src/Exceptions/ExceptionHandler.php - About 2 hrs 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

Accessarea has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Accessarea extends Model
{
    use HasSlug;
    use Taggable;
    use Auditable;
Severity: Minor
Found in src/Models/Accessarea.php - About 2 hrs to fix

Function handle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle($request, Closure $next)
    {
        $containers = $this->session->get($this->key, []);

        if (count($containers) > 0) {
Severity: Minor
Found in src/Http/Middleware/NotificationMiddleware.php - About 2 hrs 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 getMessages has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getMessages($noSort)
    {
        $messages = [];

        foreach (array_merge(array_values(app('translation.loader')->namespaces()), [$this->sourcePath]) as $directory) {
Severity: Minor
Found in src/Generators/LangJsGenerator.php - About 1 hr to fix

Method guard has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function guard(): string
    {
        if (! is_null($this->guard)) {
            return $this->guard;
        }
Severity: Minor
Found in src/Http/Request.php - About 1 hr to fix

Method run has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $accessAbilities = [
            ['name' => 'access-adminarea', 'title' => 'Access adminarea'],
        ];
Severity: Minor
Found in database/seeders/CortexFoundationSeeder.php - About 1 hr to fix

Method boot has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function boot(): void
    {
        // Fix the specified key was too long error
        Schema::defaultStringLength(191);

Severity: Minor
Found in src/Providers/FoundationServiceProvider.php - About 1 hr to fix

Method boot has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function boot()
    {
        $configPath = $this->app->basePath('vendor/barryvdh/laravel-debugbar/config/debugbar.php');
        $this->publishes([$configPath => $this->getConfigPath()], 'config');

Severity: Minor
Found in src/Overrides/Barryvdh/Debugbar/DebugbarServiceProvider.php - About 1 hr to fix

Method replaceClasses has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function replaceClasses($stub, $model, $transformer = null): string
    {
        if ($transformer) {
            $transformer = str_replace('/', '\\', $transformer);

Severity: Minor
Found in src/Console/Commands/DataTableMakeCommand.php - About 1 hr to fix

Function prepareAccessareaIds has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepareAccessareaIds($accessareas): array
    {
        // Convert collection to plain array
        if ($accessareas instanceof BaseCollection && is_string($accessareas->first())) {
            $accessareas = $accessareas->toArray();
Severity: Minor
Found in src/Traits/Accessible.php - About 1 hr 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 getBuilderParameters has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getBuilderParameters(): array
    {
        $buttons = $this->getButtons();

        return [
Severity: Minor
Found in src/DataTables/LogsDataTable.php - About 1 hr to fix

Method bindBlueprintMacro has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function bindBlueprintMacro(): void
    {
        Blueprint::macro('auditable', function () {
            $this->integer('created_by_id')->unsigned()->after('created_at')->nullable();
            $this->string('created_by_type')->after('created_at')->nullable();
Severity: Minor
Found in src/Providers/FoundationServiceProvider.php - About 1 hr to fix

Method query has 27 lines of code (exceeds 25 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 1 hr to fix

Method morphToMany has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $related,
        $name,
        $table = null,
        $foreignPivotKey = null,
        $relatedPivotKey = null,
Severity: Major
Found in src/Traits/Accessible.php - About 1 hr to fix

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

    protected function commands()
    {
        foreach (['module', 'extension'] as $moduleType) {
            $resources = $this->app['files']->{"{$moduleType}Resources"}('src/Console/Commands', 'directories', 2);
            $paths = array_filter(array_unique(collect($resources)->map->getPathname()->toArray()), fn ($path) => is_dir($path));
Severity: Minor
Found in src/Console/Kernel.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

Method getCount has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function getCount($model, $column, $value, $excludeId = null, $idColumn = null, array $extra = [])
Severity: Minor
Found in src/Verifiers/EloquentPresenceVerifier.php - About 45 mins to fix
Severity
Category
Status
Source
Language