visavi/rotor

View on GitHub

Showing 512 of 512 total issues

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

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                          if (notify_badge.length > 0) {
                                              notify_badge.html(data.countMessages);
                                          } else {
                                              notify_item.append('<span class="badge bg-notify">' + data.countMessages + '</span>');
                                          }
                      Severity: Major
                      Found in public/themes/default/src/js/messages.js and 1 other location - About 1 hr to fix
                      public/assets/js/main.js on lines 630..634

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 57.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      if (notify_badge.length > 0) {
                                          notify_badge.html(data.countMessages);
                                      } else {
                                          notify_item.append('<span class="badge bg-notify">' + data.countMessages + '</span>');
                                      }
                      Severity: Major
                      Found in public/assets/js/main.js and 1 other location - About 1 hr to fix
                      public/themes/default/src/js/messages.js on lines 12..16

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 57.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      if (data.type === 'added') {
                                          toastr.success(data.message);
                                          $(el).text($(el).data('from'));
                                      }
                      Severity: Major
                      Found in public/assets/js/main.js and 1 other location - About 1 hr to fix
                      public/assets/js/main.js on lines 261..264

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 57.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                              data: {
                                  id: $(el).data('id'),
                                  type: $(el).data('type'),
                                  _token: $(el).data('token')
                              },
                      Severity: Major
                      Found in public/assets/js/main.js and 1 other location - About 1 hr to fix
                      public/assets/js/main.js on lines 409..409

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 57.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      if (data.type === 'deleted') {
                                          toastr.success(data.message);
                                          $(el).text($(el).data('to'));
                                      }
                      Severity: Major
                      Found in public/assets/js/main.js and 1 other location - About 1 hr to fix
                      public/assets/js/main.js on lines 256..259

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 57.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                                      data: {id: $(el).data('id'), login: $(el).data('login'), _token: $(el).data('token')},
                      Severity: Major
                      Found in public/assets/js/main.js and 1 other location - About 1 hr to fix
                      public/assets/js/main.js on lines 575..579

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 57.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language