visavi/rotor

View on GitHub

Showing 286 of 512 total issues

Method dialogues has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function dialogues(Request $request): Response
    {
        /** @var User $user */
        $user = $request->attributes->get('user');

Severity: Minor
Found in app/Http/Controllers/ApiController.php - About 1 hr to fix

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

      Method createSticker has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createSticker(Request $request, Validator $validator)
          {
              $cid = int($request->input('cid'));
      
              $categories = StickersCategory::query()->get();
      Severity: Minor
      Found in app/Http/Controllers/Admin/StickerController.php - About 1 hr to fix

        Method edit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function edit(int $id, Request $request, Validator $validator)
            {
                $vote = Vote::query()->where('id', $id)->first();
        
                if (! $vote) {
        Severity: Minor
        Found in app/Http/Controllers/Admin/VoteController.php - About 1 hr to fix

          Method ban has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function ban(Request $request, Validator $validator)
              {
                  if (! $user = getUser()) {
                      abort(403, __('main.not_authorized'));
                  }
          Severity: Minor
          Found in app/Http/Controllers/User/BanController.php - About 1 hr to fix

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

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

                Method forums has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function forums(int $id): Response
                    {
                        /** @var Forum $forum */
                        $forum = Forum::query()->find($id);
                
                
                Severity: Minor
                Found in app/Http/Controllers/ApiController.php - About 1 hr to fix

                  Method userlist has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function userlist(Request $request)
                      {
                          $type = check($request->input('type', 'users'));
                          $sort = check($request->input('sort', 'point'));
                          $user = $request->input('user', getUser('login'));
                  Severity: Minor
                  Found in app/Http/Controllers/User/ListController.php - About 1 hr to fix

                    Method create has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function create(Request $request, Validator $validator)
                        {
                            if ($request->isMethod('post')) {
                                $title = $request->input('title');
                                $text = $request->input('text');
                    Severity: Minor
                    Found in app/Http/Controllers/Admin/NewsController.php - About 1 hr to fix

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

                        Method comments has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function comments(int $id, Request $request, Validator $validator, Flood $flood): View|RedirectResponse
                            {
                                /** @var Down $down */
                                $down = Down::query()->find($id);
                        
                        
                        Severity: Minor
                        Found in app/Http/Controllers/Load/DownController.php - About 1 hr to fix

                          Method vote has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function vote(int $id, Request $request, Validator $validator): RedirectResponse
                              {
                                  if (! $user = getUser()) {
                                      abort(403, __('main.not_authorized'));
                                  }
                          Severity: Minor
                          Found in app/Http/Controllers/Forum/TopicController.php - About 1 hr to fix

                            Function icons has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function icons(string $ext): HtmlString
                            {
                                switch ($ext) {
                                    case 'php':
                                        $ico = 'fa-regular fa-file-code';
                            Severity: Minor
                            Found in app/helpers.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 surprise has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function surprise(): RedirectResponse
                                {
                                    $money = mt_rand(10000, 50000);
                                    $point = mt_rand(150, 250);
                                    $rating = mt_rand(3, 10);
                            Severity: Minor
                            Found in app/Http/Controllers/PageController.php - About 1 hr to fix

                              Method topic has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function topic(int $id): View
                                  {
                                      $topic = Topic::query()->where('id', $id)->with('forum.parent')->first();
                              
                                      if (! $topic) {
                              Severity: Minor
                              Found in app/Http/Controllers/Admin/ForumController.php - About 1 hr to fix

                                Method zipView has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function zipView(int $id, int $fid): 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 1 hr to fix

                                  Method comments has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function comments(int $id, Request $request, Validator $validator, Flood $flood)
                                      {
                                          /** @var Photo $photo */
                                          $photo = Photo::query()->find($id);
                                  
                                  
                                  Severity: Minor
                                  Found in app/Http/Controllers/PhotoController.php - About 1 hr to fix

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

                                      Method index has 38 lines of code (exceeds 25 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 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language