visavi/rotor

View on GitHub

Showing 286 of 512 total issues

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

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

        public function talk(string $login): View
        {
            if (is_numeric($login)) {
                $user = new User();
                $user->id = $login;
    Severity: Minor
    Found in app/Http/Controllers/MessageController.php - About 1 hr to fix

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

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

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

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

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

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

                public function editTopic(int $id, Request $request, Validator $validator)
                {
                    /** @var Topic $topic */
                    $topic = Topic::query()->find($id);
            
            
            Severity: Minor
            Found in app/Http/Controllers/Admin/ForumController.php - About 1 hr to fix

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

                  public function deleteFile(Request $request, Validator $validator): JsonResponse
                  {
                      $types = [
                          Article::$morphName,
                          Item::$morphName,
              Severity: Minor
              Found in app/Http/Controllers/AjaxController.php - About 1 hr to fix

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

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

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

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

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

                        public function create(string $login, Request $request, Validator $validator, Flood $flood): RedirectResponse
                        {
                            if (! getUser()) {
                                abort(403, __('main.not_authorized'));
                            }
                    Severity: Minor
                    Found in app/Http/Controllers/WallController.php - About 1 hr to fix

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

                        Method edit has 36 lines of code (exceeds 25 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/ForumController.php - About 1 hr to fix

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

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

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

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

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

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

                                    public function login(Request $request, Validator $validator, Flood $flood)
                                    {
                                        if (getUser()) {
                                            setFlash('danger', __('main.already_authorized'));
                                
                                
                                Severity: Minor
                                Found in app/Http/Controllers/User/UserController.php - About 1 hr to fix

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

                                      public function editComment(int $id, int $cid, Request $request, Validator $validator): View|RedirectResponse
                                      {
                                          $page = int($request->input('page', 1));
                                  
                                          /** @var Article $article */
                                  Severity: Minor
                                  Found in app/Http/Controllers/ArticleController.php - About 1 hr to fix

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

                                        public function editComment(int $id, int $cid, Request $request, Validator $validator)
                                        {
                                            $page = int($request->input('page', 1));
                                    
                                            /** @var Offer $offer */
                                    Severity: Minor
                                    Found in app/Http/Controllers/OfferController.php - About 1 hr to fix

                                      Function actionTopic has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          public function actionTopic(int $id, Request $request): RedirectResponse
                                          {
                                              $page = int($request->input('page', 1));
                                      
                                              /** @var Topic $topic */
                                      Severity: Minor
                                      Found in app/Http/Controllers/Admin/ForumController.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

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

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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language