visavi/rotor

View on GitHub

Showing 512 of 512 total issues

Method run has 144 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        $data = [
            ['name' => 'app_installed', 'value' => 0],
            ['name' => 'addbansend', 'value' => 1],
Severity: Major
Found in database/seeders/SettingSeeder.php - About 5 hrs to fix

    Function create has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
        {
            $cid = int($request->input('category'));
    
            if (! isAdmin() && ! setting('downupload')) {
    Severity: Minor
    Found in app/Http/Controllers/Load/DownController.php - About 5 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

    File ForumController.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    namespace App\Http\Controllers\Admin;
    Severity: Minor
    Found in app/Http/Controllers/Admin/ForumController.php - About 5 hrs to fix

      Method run has 121 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run()
          {
              $data = [
                  [
                      'type'       => 'register',
      Severity: Major
      Found in database/seeders/NoticeSeeder.php - About 4 hrs to fix

        User has 36 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class User extends BaseModel implements
            AuthenticatableContract,
            AuthorizableContract,
            CanResetPasswordContract
        {
        Severity: Minor
        Found in app/Models/User.php - About 4 hrs to fix

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

          <?php
          
          return [
              'category'                 => 'Категорія',
              'categories'               => 'Категорії',
          Severity: Major
          Found in resources/lang/ua/boards.php and 2 other locations - About 4 hrs to fix
          resources/lang/en/boards.php on lines 1..39
          resources/lang/ru/boards.php on lines 1..39

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

          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 [
              'category'                 => 'Category',
              'categories'               => 'Categories',
          Severity: Major
          Found in resources/lang/en/boards.php and 2 other locations - About 4 hrs to fix
          resources/lang/ru/boards.php on lines 1..39
          resources/lang/ua/boards.php on lines 1..39

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

          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 [
              'category'                 => 'Категория',
              'categories'               => 'Категории',
          Severity: Major
          Found in resources/lang/ru/boards.php and 2 other locations - About 4 hrs to fix
          resources/lang/en/boards.php on lines 1..39
          resources/lang/ua/boards.php on lines 1..39

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

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

              public function register(Request $request, Validator $validator)
              {
                  if (getUser()) {
                      abort(403, __('users.already_registered'));
                  }
          Severity: Major
          Found in app/Http/Controllers/User/UserController.php - About 4 hrs to fix

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

                public function edit(Request $request, Validator $validator): View|RedirectResponse
                {
                    $user = getUserByLogin($request->input('user'));
            
                    if (! $user) {
            Severity: Major
            Found in app/Http/Controllers/Admin/UserController.php - About 4 hrs to fix

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

                  public function delete(Request $request, Validator $validator): RedirectResponse
                  {
                      $id = int($request->input('id'));
              
                      $validator->equal($request->input('_token'), csrf_token(), __('validator.token'));
              Severity: Major
              Found in app/Http/Controllers/Admin/AntimatController.php and 1 other location - About 4 hrs to fix
              app/Http/Controllers/Admin/StatusController.php on lines 114..132

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

              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 delete(Request $request, Validator $validator): RedirectResponse
                  {
                      $id = int($request->input('id'));
              
                      $validator->equal($request->input('_token'), csrf_token(), __('validator.token'));
              Severity: Major
              Found in app/Http/Controllers/Admin/StatusController.php and 1 other location - About 4 hrs to fix
              app/Http/Controllers/Admin/AntimatController.php on lines 56..74

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

              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_votes'    => 'Голосований еще нет!',
                  'archive_votes'  => 'Архив голосований',
              Severity: Major
              Found in resources/lang/ru/votes.php and 2 other locations - About 4 hrs to fix
              resources/lang/en/votes.php on lines 1..37
              resources/lang/ua/votes.php on lines 1..37

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

              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

              <?php
              
              declare(strict_types=1);
              
              use Illuminate\Database\Migrations\Migration;
              database/migrations/2019_11_18_224739_create_admin_adverts_table.php on lines 1..37

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

              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_votes'    => 'No vote yet!',
                  'archive_votes'  => 'Voting Archive',
              Severity: Major
              Found in resources/lang/en/votes.php and 2 other locations - About 4 hrs to fix
              resources/lang/ru/votes.php on lines 1..37
              resources/lang/ua/votes.php on lines 1..37

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

              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_votes'    => 'Голосувань ще немає!',
                  'archive_votes'  => 'Архів голосувань',
              Severity: Major
              Found in resources/lang/ua/votes.php and 2 other locations - About 4 hrs to fix
              resources/lang/en/votes.php on lines 1..37
              resources/lang/ru/votes.php on lines 1..37

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

              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

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

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

              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 register has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function register(Request $request, Validator $validator)
                  {
                      if (getUser()) {
                          abort(403, __('users.already_registered'));
                      }
              Severity: Minor
              Found in app/Http/Controllers/User/UserController.php - About 4 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

              File AjaxController.php has 330 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=1);
              
              namespace App\Http\Controllers;
              Severity: Minor
              Found in app/Http/Controllers/AjaxController.php - About 3 hrs to fix

                Function create has a Cognitive Complexity of 27 (exceeds 5 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: Minor
                Found in app/Http/Controllers/Admin/BackupController.php - About 3 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

                Severity
                Category
                Status
                Source
                Language