visavi/rotor

View on GitHub

Showing 286 of 512 total issues

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

    public function edit(int $id, Request $request, Validator $validator)
    {
        $page = int($request->input('page', 1));
        $link = Advert::query()->find($id);

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

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

        public function edit(int $id, 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 restatement has 30 lines of code (exceeds 25 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 1 hr to fix

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

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

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

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

              Method newMessages has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function newMessages(Request $request): Response
                  {
                      if (! $request->ajax()) {
                          return redirect('/');
                      }
              Severity: Minor
              Found in app/Http/Controllers/MessageController.php - About 1 hr to fix

                Method editSticker has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function editSticker(int $id, Request $request, Validator $validator)
                    {
                        /** @var Sticker $sticker */
                        $sticker = Sticker::query()->find($id);
                        $page = int($request->input('page', 1));
                Severity: Minor
                Found in app/Http/Controllers/Admin/StickerController.php - About 1 hr to fix

                  Method getCounter has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getCounter(int $online): void
                      {
                          $counter = $this->getResultCounter();
                  
                          if (! $counter) {
                  Severity: Minor
                  Found in app/Classes/Metrika.php - About 1 hr to fix

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

                        public function edit(Request $request, Validator $validator)
                        {
                            $id = int($request->input('id'));
                    
                            $status = Status::query()->find($id);
                    Severity: Minor
                    Found in app/Http/Controllers/Admin/StatusController.php - About 1 hr to fix

                      Method moveArticle has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method moveTopic has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function moveTopic(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 edit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function edit(int $id, Request $request, Validator $validator)
                              {
                                  $page = int($request->input('page', 1));
                          
                                  if (! $user = getUser()) {
                          Severity: Minor
                          Found in app/Http/Controllers/Admin/ChatController.php - About 1 hr to fix

                            Method reply has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Method searchTag has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function searchTag(string $tag, Request $request): View|RedirectResponse
                                  {
                                      $tag = urldecode($tag);
                              
                                      if (! isUtf($tag)) {
                              Severity: Minor
                              Found in app/Http/Controllers/ArticleController.php - About 1 hr to fix

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

                                    public function index(int $id): View
                                    {
                                        $user = getUser();
                                
                                        $topic = Topic::query()
                                Severity: Minor
                                Found in app/Http/Controllers/Forum/TopicController.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 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function create(Request $request, Validator $validator)
                                    {
                                        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 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 editTopic has a Cognitive Complexity of 10 (exceeds 5 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

                                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 10 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function edit(Request $request, Validator $validator)
                                    {
                                        $user = User::query()->where('login', $request->input('user'))->with('lastBan')->first();
                                
                                        if (! $user) {
                                Severity: Minor
                                Found in app/Http/Controllers/Admin/BanController.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 10 (exceeds 5 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

                                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