visavi/rotor

View on GitHub

Showing 286 of 512 total issues

Method parsePhpModules has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static function parsePhpModules(): array
    {
        ob_start();
        phpinfo(INFO_MODULES);
        $s = ob_get_clean();
Severity: Minor
Found in app/Http/Controllers/InstallController.php - About 1 hr to fix

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

      Method createDialogue has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createDialogue(User $user, ?User $author, string $text, bool $withAuthor)
          {
              $authorId = $author->id ?? 0;
      
              $message = self::query()->create([
      Severity: Minor
      Found in app/Models/Message.php - About 1 hr to fix

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

            public function index(Request $request, Validator $validator)
            {
                $type = $this->type;
        
                if ($request->isMethod('post')) {
        Severity: Minor
        Found in app/Http/Controllers/Admin/BlacklistController.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

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

            public function index(Request $request, Validator $validator)
            {
                if ($request->isMethod('post')) {
                    $message = $request->input('message');
                    $name = $request->input('name');
        Severity: Minor
        Found in app/Http/Controllers/MailController.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

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

            public function index(Request $request, Validator $validator)
            {
                $user = getUser();
        
                if ($user->newchat !== statsNewChat()) {
        Severity: Minor
        Found in app/Http/Controllers/Admin/ChatController.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

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

            public function editItem(int $id, Request $request, Validator $validator)
            {
                /** @var Item $item */
                $item = Item::query()->find($id);
        
        
        Severity: Minor
        Found in app/Http/Controllers/Admin/BoardController.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

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

            public function delete(int $id, Request $request, Validator $validator): RedirectResponse
            {
                $del = intar($request->input('del'));
                $page = int($request->input('page'));
        
        
        Severity: Minor
        Found in app/Http/Controllers/Forum/TopicController.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

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

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

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

        function restatement(string $mode)
        {
            switch ($mode) {
                case 'forums':
                    DB::update('update topics set count_posts = (select count(*) from posts where topics.id = posts.topic_id)');
        Severity: Minor
        Found in app/helpers.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

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

            public static function statAdverts(): array
            {
                return Cache::remember('adminAdverts', 1800, static function () {
                    $data = self::query()->where('deleted_at', '>', SITETIME)->get();
        
        
        Severity: Minor
        Found in app/Models/AdminAdvert.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

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

            public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
            {
                $cid = int($request->input('cid'));
        
                if (! isAdmin() && ! setting('blog_create')) {
        Severity: Minor
        Found in app/Http/Controllers/ArticleController.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

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

            public function view(int $id, Request $request, Validator $validator)
            {
                $show = $request->input('show');
        
                /** @var Vote $vote */
        Severity: Minor
        Found in app/Http/Controllers/VoteController.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

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

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

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

            public function edit(int $id, Request $request, Validator $validator)
            {
                if (! isAdmin(User::BOSS)) {
                    abort(403, __('errors.forbidden'));
                }
        Severity: Minor
        Found in app/Http/Controllers/Admin/BoardController.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 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 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/ContactController.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 delete has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function delete(Request $request, Validator $validator): RedirectResponse
            {
                if (! is_writable(resource_path('views/' . $this->path))) {
                    abort(200, __('admin.files.directory_not_writable', ['dir' => $this->path]));
                }
        Severity: Minor
        Found in app/Http/Controllers/Admin/FileController.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 ($files->isNotEmpty()) {
                                    foreach ($files as $file) {
                                        $file->delete();
                                    }
                                }
        Severity: Major
        Found in app/Http/Controllers/Admin/UserController.php - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language