visavi/rotor

View on GitHub

Showing 512 of 512 total issues

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

        $validator->equal($request->input('_token'), csrf_token(), ['msg' => __('validator.token')])
            ->length($msg, 5, setting('guesttextlength'), ['msg' => __('validator.text')])
            ->false($flood->isFlood(), ['msg' => __('validator.flood', ['sec' => $flood->getPeriod()])]);
Severity: Major
Found in app/Http/Controllers/GuestbookController.php and 1 other location - About 1 hr to fix
app/Http/Controllers/MessageController.php on lines 136..138

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 108.

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

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

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

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

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

          public function index(
              Request $request,
              Validator $validator,
              ImageManager $imageManager,
          ) {
      Severity: Minor
      Found in app/Http/Controllers/User/PictureController.php - About 1 hr to fix

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

                    if ($vote->answers->isNotEmpty()) {
                        $results = Arr::pluck($vote->answers, 'result', 'answer');
                        $max = max($results);
        
                        arsort($results);
        Severity: Major
        Found in app/Http/Controllers/Forum/TopicController.php and 1 other location - About 1 hr to fix
        app/Http/Controllers/Admin/ForumController.php on lines 472..482

        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 107.

        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 ($vote->answers->isNotEmpty()) {
                        $results = Arr::pluck($vote->answers, 'result', 'answer');
                        $max = max($results);
        
                        arsort($results);
        Severity: Major
        Found in app/Http/Controllers/Admin/ForumController.php and 1 other location - About 1 hr to fix
        app/Http/Controllers/Forum/TopicController.php on lines 96..106

        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 107.

        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

        Method send has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function send(Request $request, Validator $validator, Flood $flood): RedirectResponse
            {
                $login = $request->input('user');
                $msg = $request->input('msg');
        
        
        Severity: Minor
        Found in app/Http/Controllers/MessageController.php - About 1 hr to fix

          Method edit has 33 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/BoardController.php - About 1 hr to fix

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

                public function index(Request $request)
                {
                    if ($request->isMethod('post')) {
                        $client = new Client(['timeout' => 30.0]);
            
            
            Severity: Minor
            Found in app/Http/Controllers/SocialController.php - About 1 hr to fix

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

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

                Method resizeProcess has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function resizeProcess(?string $path, array $params = []): array
                {
                    if (empty($params['alt'])) {
                        $params['alt'] = basename($path);
                    }
                Severity: Minor
                Found in app/helpers.php - About 1 hr to fix

                  Method editPassword has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function editPassword(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 setting has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Method restore has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

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

                            public function index(Request $request, Validator $validator)
                            {
                                $advert = AdminAdvert::query()
                                    ->where('user_id', getUser('id'))
                                    ->firstOrNew();
                        Severity: Minor
                        Found in app/Http/Controllers/Admin/AdminAdvertController.php - About 1 hr to fix

                          Method handle has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function handle()
                              {
                                  $lang1 = $this->argument('lang1');
                                  $lang2 = $this->argument('lang2');
                          
                          
                          Severity: Minor
                          Found in app/Console/Commands/LangCompare.php - About 1 hr to fix

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

                              Method dateFixed has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              function dateFixed(
                                  DateTimeInterface|int|null $timestamp,
                                  string $format = 'd.m.Y / H:i',
                                  bool $original = false,
                              ): string {
                              Severity: Minor
                              Found in app/helpers.php - About 1 hr to fix

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

                                    public function end(int $id): RedirectResponse
                                    {
                                        /** @var Topic $topic */
                                        $topic = Topic::query()->find($id);
                                
                                
                                Severity: Major
                                Found in app/Http/Controllers/Forum/TopicController.php and 1 other location - About 1 hr to fix
                                app/Http/Controllers/Admin/ForumController.php on lines 580..592

                                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 106.

                                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

                                    public function end(int $id): RedirectResponse
                                    {
                                        /** @var Topic $topic */
                                        $topic = Topic::query()->find($id);
                                
                                
                                Severity: Major
                                Found in app/Http/Controllers/Admin/ForumController.php and 1 other location - About 1 hr to fix
                                app/Http/Controllers/Forum/TopicController.php on lines 649..661

                                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 106.

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language