visavi/rotor

View on GitHub

Showing 286 of 512 total issues

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

    public function index(Request $request, Validator $validator)
    {
        $login = $request->input('user');

        if ($request->isMethod('post')) {
Severity: Minor
Found in app/Http/Controllers/IgnoreController.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 install has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function install(Request $request): RedirectResponse
    {
        $moduleName = $request->input('module');
        $enable = int($request->input('enable'));
        $update = int($request->input('update'));
Severity: Minor
Found in app/Http/Controllers/Admin/ModuleController.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 getLevelByKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getLevelByKey(string $level): string
    {
        switch ($level) {
            case self::BOSS:
                $status = __('main.boss');
Severity: Minor
Found in app/Models/User.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

Avoid deeply nested control flow statements.
Open

                            if ($ans->exists) {
                                $ans->update(['answer' => $answer]);
                            } elseif ($countAnswers < 10) {
                                $ans->fill(['answer' => $answer])->save();
                                $countAnswers++;
Severity: Major
Found in app/Http/Controllers/Forum/TopicController.php - About 45 mins to fix

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

        public function generateLogin($network, string $delimiter = '-'): ?string
        {
            $firstName = ucfirst(Str::slug($network->first_name, $delimiter));
            $lastName = ucfirst(Str::slug($network->last_name, $delimiter));
            $firstLetter = $firstName[0];
    Severity: Minor
    Found in app/Models/Social.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 auth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function auth(string $login, string $password, bool $remember = true)
        {
            if (! empty($login) && ! empty($password)) {
                $user = getUserByLoginOrEmail($login);
    
    
    Severity: Minor
    Found in app/Models/User.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 logTagSize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function logTagSize($count, $minCount, $maxCount, $minSize = 10, $maxSize = 30): int
    Severity: Minor
    Found in app/Models/Article.php - About 35 mins to fix

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

          public function length($input, int $min, int $max, $label, bool $required = true): Validator
      Severity: Minor
      Found in app/Classes/Validator.php - About 35 mins to fix

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

            public function editComment(int $id, int $cid, Request $request, Validator $validator)
            {
                $page = int($request->input('page', 1));
        
                if (! $user = getUser()) {
        Severity: Minor
        Found in app/Http/Controllers/PhotoController.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

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

            public function editComment(int $id, int $cid, Request $request, Validator $validator)
            {
                $page = int($request->input('page', 1));
        
                /** @var News $news */
        Severity: Minor
        Found in app/Http/Controllers/NewsController.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

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

            public function add(Request $request, Validator $validator, Flood $flood): RedirectResponse
            {
                $msg = $request->input('msg');
                $user = getUser();
        
        
        Severity: Minor
        Found in app/Http/Controllers/GuestbookController.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

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

            public function comments(int $id, Request $request, Validator $validator, Flood $flood)
            {
                /** @var News $news */
                $news = News::query()->find($id);
        
        
        Severity: Minor
        Found in app/Http/Controllers/NewsController.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

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

            public function edit(Request $request, Validator $validator)
            {
                $path = $this->path;
                $file = $path ? '/' . $this->file : $this->file;
                $writable = is_writable(resource_path('views/' . $path . $file . '.blade.php'));
        Severity: Minor
        Found in app/Http/Controllers/Admin/FileController.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

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

            public function index(Request $request, Validator $validator)
            {
                $find = $request->input('find');
                $downs = collect();
        
        
        Severity: Minor
        Found in app/Http/Controllers/Load/SearchController.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

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

            public function delComment(Request $request, Validator $validator): JsonResponse
            {
                if (! isAdmin()) {
                    return response()->json([
                        'success' => false,
        Severity: Minor
        Found in app/Http/Controllers/AjaxController.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

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

            public function complaint(Request $request, Validator $validator): JsonResponse
            {
                $path = null;
                $model = false;
                $id = int($request->input('id'));
        Severity: Minor
        Found in app/Http/Controllers/AjaxController.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

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

            public function zip(int $id): View
            {
                /** @var File $file */
                $file = File::query()->where('relate_type', Down::$morphName)->find($id);
                $down = $file?->relate;
        Severity: Minor
        Found in app/Http/Controllers/Load/DownController.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

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

            public function edit(int $id, Request $request, Validator $validator)
            {
                /** @var News $news */
                $news = News::query()->find($id);
                $page = int($request->input('page', 1));
        Severity: Minor
        Found in app/Http/Controllers/Admin/NewsController.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

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

            public function editComment(int $id, int $cid, Request $request, Validator $validator): View|RedirectResponse
            {
                $down = Down::query()->find($id);
        
                if (! $down) {
        Severity: Minor
        Found in app/Http/Controllers/Load/DownController.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

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

            public function close(int $id, Request $request, Validator $validator): RedirectResponse
            {
                if (! $user = getUser()) {
                    abort(403, __('main.not_authorized'));
                }
        Severity: Minor
        Found in app/Http/Controllers/BoardController.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

        Severity
        Category
        Status
        Source
        Language