visavi/rotor

View on GitHub

Showing 286 of 512 total issues

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

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

    public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
    {
        $fid = int($request->input('fid'));

        $forums = (new Forum())->getChildren();
Severity: Minor
Found in app/Http/Controllers/Forum/ForumController.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

Function editDown has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function editDown(int $id, Request $request, Validator $validator)
    {
        $cid = int($request->input('category'));

        /** @var Down $down */
Severity: Minor
Found in app/Http/Controllers/Admin/LoadController.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

Method delete has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function delete(Request $request, Validator $validator): View|RedirectResponse
    {
        $user = getUserByLogin($request->input('user'));

        if (! $user) {
Severity: Major
Found in app/Http/Controllers/Admin/UserController.php - About 3 hrs to fix

    File _feed.blade.php has 321 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    @forelse ($posts as $post)
        {{-- Посты --}}
        @if ($post instanceof \App\Models\Topic)
            <div class="section mb-3 shadow">
                <ol class="breadcrumb mb-1">
    Severity: Minor
    Found in resources/views/widgets/_feed.blade.php - About 3 hrs to fix

      File PhotoController.php has 320 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/PhotoController.php - About 3 hrs to fix

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

            public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
            {
                $fid = int($request->input('fid'));
        
                $forums = (new Forum())->getChildren();
        Severity: Major
        Found in app/Http/Controllers/Forum/ForumController.php - About 3 hrs to fix

          Method create has 83 lines of code (exceeds 25 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: Major
          Found in app/Http/Controllers/Load/DownController.php - About 3 hrs to fix

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

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

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

                  public function edit(int $id, Request $request, Validator $validator)
                  {
                      if (! $user = getUser()) {
                          abort(403, __('main.not_authorized'));
                      }
              Severity: Major
              Found in app/Http/Controllers/Forum/TopicController.php - About 3 hrs to fix

                Method uploadFile has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function uploadFile(Request $request, Validator $validator): JsonResponse
                    {
                        $imageTypes = [
                            Article::$morphName,
                            Item::$morphName,
                Severity: Major
                Found in app/Http/Controllers/AjaxController.php - About 3 hrs to fix

                  Method saveStatistic has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function saveStatistic(): void
                      {
                          session()->increment('hits');
                  
                          if (session('online') > SITETIME) {
                  Severity: Major
                  Found in app/Classes/Metrika.php - About 2 hrs to fix

                    Validator has 25 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Validator
                    {
                        /**
                         * @var array validation errors
                         */
                    Severity: Minor
                    Found in app/Classes/Validator.php - About 2 hrs to fix

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

                          public function index(int $id): View
                          {
                              $user = getUser();
                      
                              $topic = Topic::query()
                      Severity: Major
                      Found in app/Http/Controllers/Forum/TopicController.php - About 2 hrs to fix

                        Function edit has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
                            {
                                $cid = int($request->input('category'));
                        
                                /** @var Down $down */
                        Severity: Minor
                        Found in app/Http/Controllers/Load/DownController.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 login has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function login(Request $request, Validator $validator, Flood $flood)
                            {
                                if (getUser()) {
                                    setFlash('danger', __('main.already_authorized'));
                        
                        
                        Severity: Minor
                        Found in app/Http/Controllers/User/UserController.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

                        File LoadController.php has 280 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/LoadController.php - About 2 hrs to fix

                          Method editDown has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function editDown(int $id, Request $request, Validator $validator)
                              {
                                  $cid = int($request->input('category'));
                          
                                  /** @var Down $down */
                          Severity: Major
                          Found in app/Http/Controllers/Admin/LoadController.php - About 2 hrs to fix

                            File ApiController.php has 279 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/ApiController.php - About 2 hrs to fix

                              Method rating has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function rating(Request $request): JsonResponse
                                  {
                                      $types = [
                                          Post::$morphName,
                                          Article::$morphName,
                              Severity: Major
                              Found in app/Http/Controllers/AjaxController.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language