visavi/rotor

View on GitHub

Showing 512 of 512 total issues

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

    public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
    {
        $cid = int($request->input('category'));

        /** @var Down $down */
Severity: Major
Found in app/Http/Controllers/Load/DownController.php - About 2 hrs to fix

    Method generateLogin has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function generateLogin($network, string $delimiter = '-'): ?string
        {
            $firstName = ucfirst(Str::slug($network->first_name, $delimiter));
            $lastName = ucfirst(Str::slug($network->last_name, $delimiter));
            $firstLetter = $firstName[0];
    Severity: Major
    Found in app/Models/Social.php - About 2 hrs to fix

      Function edit has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs 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 icons has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function icons(string $ext): HtmlString
      {
          switch ($ext) {
              case 'php':
                  $ico = 'fa-regular fa-file-code';
      Severity: Major
      Found in app/helpers.php - About 2 hrs to fix

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

                    $validator->equal($request->input('_token'), csrf_token(), __('validator.token'))
                        ->length($question, 5, 100, ['question' => __('validator.text')])
                        ->length($description, 5, 1000, ['description' => __('validator.text')], false)
                        ->between(count($answers), 2, 10, ['answer' => __('votes.answer_not_enough')]);
        Severity: Major
        Found in app/Http/Controllers/VoteController.php and 1 other location - About 2 hrs to fix
        app/Http/Controllers/Admin/VoteController.php on lines 67..70

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

        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

                    $validator->equal($request->input('_token'), csrf_token(), __('validator.token'))
                        ->length($question, 3, 100, ['question' => __('validator.text')])
                        ->length($description, 5, 1000, ['description' => __('validator.text')], false)
                        ->between(count($answers), 2, 10, ['answer' => __('votes.answer_not_enough')]);
        Severity: Major
        Found in app/Http/Controllers/Admin/VoteController.php and 1 other location - About 2 hrs to fix
        app/Http/Controllers/VoteController.php on lines 200..203

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

        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

        File BBCode.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare(strict_types=1);
        
        namespace App\Classes;
        Severity: Minor
        Found in app/Classes/BBCode.php - About 2 hrs to fix

          File admin.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          return [
              'antimat' => [
                  'text' => '
          Severity: Minor
          Found in resources/lang/ru/admin.php - About 2 hrs to fix

            File admin.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            return [
                'antimat' => [
                    'text' => '
            Severity: Minor
            Found in resources/lang/en/admin.php - About 2 hrs to fix

              File admin.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              return [
                  'antimat' => [
                      'text' => '
              Severity: Minor
              Found in resources/lang/ua/admin.php - About 2 hrs to fix

                ArticleController has 22 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ArticleController extends Controller
                {
                    /**
                     * Главная страница
                     */
                Severity: Minor
                Found in app/Http/Controllers/ArticleController.php - About 2 hrs to fix

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

                      public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
                      {
                          $cid = int($request->input('cid'));
                  
                          if (! isAdmin() && ! setting('blog_create')) {
                  Severity: Major
                  Found in app/Http/Controllers/ArticleController.php - About 2 hrs to fix

                    Method key has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function key(Request $request, Validator $validator)
                        {
                            /* @var User $user */
                            if (! $user = getUser()) {
                                abort(403, __('main.not_authorized'));
                    Severity: Major
                    Found in app/Http/Controllers/User/UserController.php - About 2 hrs to fix

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

                          public function index(Request $request, Validator $validator)
                          {
                              $act = $request->input('act', 'mains');
                      
                              if (! in_array($act, Setting::getActions(), true)) {
                      Severity: Minor
                      Found in app/Http/Controllers/Admin/SettingController.php - About 2 hrs 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 getFeed has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getFeed(): HtmlString
                          {
                              $polls = [];
                              $collect = new Collection();
                      
                      
                      Severity: Minor
                      Found in app/Classes/Feed.php - About 2 hrs 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 create has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function create(Request $request, Validator $validator, Flood $flood)
                          {
                              $bid = int($request->input('bid'));
                      
                              if (! $user = getUser()) {
                      Severity: Major
                      Found in app/Http/Controllers/BoardController.php - About 2 hrs to fix

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

                                        success: function (data) {
                                            if (data.success) {
                                                toastr.success(translate.message_deleted);
                                                $(el).closest('.section').hide('slow');
                                            } else {
                        Severity: Major
                        Found in public/assets/js/main.js and 3 other locations - About 2 hrs to fix
                        public/assets/js/main.js on lines 279..286
                        public/assets/js/main.js on lines 389..396
                        public/assets/js/main.js on lines 411..418

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

                        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 4 locations. Consider refactoring.
                        Open

                                        success: function (data) {
                                            if (data.success) {
                                                toastr.success(data.message);
                                                $(el).closest('.section').hide('slow');
                                            } else {
                        Severity: Major
                        Found in public/assets/js/main.js and 3 other locations - About 2 hrs to fix
                        public/assets/js/main.js on lines 306..313
                        public/assets/js/main.js on lines 389..396
                        public/assets/js/main.js on lines 411..418

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

                        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 4 locations. Consider refactoring.
                        Open

                                success: function (data) {
                                    if (data.success) {
                                        toastr.success(translate.record_deleted);
                                        $(el).closest('.section').hide('slow');
                                    } else {
                        Severity: Major
                        Found in public/assets/js/main.js and 3 other locations - About 2 hrs to fix
                        public/assets/js/main.js on lines 279..286
                        public/assets/js/main.js on lines 306..313
                        public/assets/js/main.js on lines 411..418

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

                        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 talk has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function talk(string $login, Request $request): Response
                            {
                                /** @var User $user */
                                $user = $request->attributes->get('user');
                        
                        
                        Severity: Major
                        Found in app/Http/Controllers/ApiController.php - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language