visavi/rotor

View on GitHub

Showing 512 of 512 total issues

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 389..396

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

<?php

return [
    'empty_categories'         => 'Категории еще не созданы!',
    'empty_stickers'           => 'Стикеры не найдены!',
Severity: Major
Found in resources/lang/ru/stickers.php and 2 other locations - About 2 hrs to fix
resources/lang/en/stickers.php on lines 1..28
resources/lang/ua/stickers.php on lines 1..28

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

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

<?php

return [
    'empty_categories'         => 'Категорії ще не створені!',
    'empty_stickers'           => 'Стікери не знайдені!',
Severity: Major
Found in resources/lang/ua/stickers.php and 2 other locations - About 2 hrs to fix
resources/lang/en/stickers.php on lines 1..28
resources/lang/ru/stickers.php on lines 1..28

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

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

<?php

return [
    'empty_categories'         => 'Categories not yet created!',
    'empty_stickers'           => 'No stickers found!',
Severity: Major
Found in resources/lang/en/stickers.php and 2 other locations - About 2 hrs to fix
resources/lang/ru/stickers.php on lines 1..28
resources/lang/ua/stickers.php on lines 1..28

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

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

    public function create(Request $request, Validator $validator)
    {
        if ($this->user->point < setting('rekuserpoint')) {
            abort(200, __('adverts.advert_point', ['point' => plural(50, setting('scorename'))]));
        }
Severity: Major
Found in app/Http/Controllers/AdvertController.php - About 2 hrs to fix

    Method up has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function up(): void
        {
            if (! Schema::hasTable('users')) {
                Schema::create('users', function (Blueprint $table) {
                    $table->increments('id');
    Severity: Major
    Found in database/migrations/2018_04_20_180049_create_users_table.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($title, 3, 50, ['title' => __('validator.text')])
                      ->length($text, 5, 1000, ['text' => __('validator.text')])
                      ->false($flood->isFlood(), ['msg' => __('validator.flood', ['sec' => $flood->getPeriod()])])
                      ->in($type, Offer::TYPES, ['type' => __('offers.type_invalid')])
      Severity: Major
      Found in app/Http/Controllers/OfferController.php and 1 other location - About 2 hrs to fix
      app/Http/Controllers/Load/DownController.php on lines 86..91

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

      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($title, 3, 50, ['title' => __('validator.text')])
                      ->length($text, 50, 5000, ['text' => __('validator.text')])
                      ->false($flood->isFlood(), ['msg' => __('validator.flood', ['sec' => $flood->getPeriod()])])
      Severity: Major
      Found in app/Http/Controllers/Load/DownController.php and 1 other location - About 2 hrs to fix
      app/Http/Controllers/OfferController.php on lines 84..88

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

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

          public function create(Request $request, Validator $validator)
          {
              if ($request->isMethod('post')) {
                  $sheets = check($request->input('sheets'));
                  $method = $request->input('method');
      Severity: Major
      Found in app/Http/Controllers/Admin/BackupController.php - About 2 hrs to fix

        Method view has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function view(int $id, Request $request, Validator $validator)
            {
                $show = $request->input('show');
        
                /** @var Vote $vote */
        Severity: Major
        Found in app/Http/Controllers/VoteController.php - About 2 hrs to fix

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

          <?php
          
          declare(strict_types=1);
          
          use Illuminate\Database\Migrations\Migration;
          database/migrations/2018_04_20_180006_create_bookmarks_table.php on lines 1..36
          database/migrations/2018_04_20_180028_create_notes_table.php on lines 1..36

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

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

          <?php
          
          declare(strict_types=1);
          
          use Illuminate\Database\Migrations\Migration;
          database/migrations/2018_04_20_180028_create_notes_table.php on lines 1..36
          database/migrations/2018_04_20_180043_create_socials_table.php on lines 1..36

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

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

          <?php
          
          declare(strict_types=1);
          
          use Illuminate\Database\Migrations\Migration;
          database/migrations/2018_04_20_180006_create_bookmarks_table.php on lines 1..36
          database/migrations/2018_04_20_180043_create_socials_table.php on lines 1..36

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

          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 16 (exceeds 5 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 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 handle has a Cognitive Complexity of 16 (exceeds 5 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 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 account has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function account(Request $request, Validator $validator)
              {
                  $lang = $request->input('lang', 'ru');
                  $login = $request->input('login');
                  $password = $request->input('password');
          Severity: Major
          Found in app/Http/Controllers/InstallController.php - About 2 hrs to fix

            Method getFeed has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getFeed(): HtmlString
                {
                    $polls = [];
                    $collect = new Collection();
            
            
            Severity: Major
            Found in app/Classes/Feed.php - About 2 hrs to fix

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

                          $validator
                              ->true(getUser(), __('main.not_authorized'))
                              ->equal($request->input('_token'), csrf_token(), __('validator.token'))
                              ->length($msg, 5, setting('comment_length'), ['msg' => __('validator.text')])
                              ->false($flood->isFlood(), ['msg' => __('validator.flood', ['sec' => $flood->getPeriod()])]);
              Severity: Major
              Found in app/Http/Controllers/Load/DownController.php and 1 other location - About 2 hrs to fix
              app/Http/Controllers/OfferController.php on lines 196..200

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

              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 gave(string $login): View
                  {
                      $user = getUserByLogin($login);
              
                      if (! $user) {
              Severity: Major
              Found in app/Http/Controllers/RatingController.php and 1 other location - About 2 hrs to fix
              app/Http/Controllers/RatingController.php on lines 114..129

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

              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

                          $validator
                              ->true(getUser(), __('main.not_authorized'))
                              ->equal($request->input('_token'), csrf_token(), __('validator.token'))
                              ->length($msg, 5, setting('comment_length'), ['msg' => __('validator.text')])
                              ->false($flood->isFlood(), ['msg' => __('validator.flood', ['sec' => $flood->getPeriod()])])
              Severity: Major
              Found in app/Http/Controllers/OfferController.php and 1 other location - About 2 hrs to fix
              app/Http/Controllers/Load/DownController.php on lines 381..385

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

              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