visavi/rotor

View on GitHub

Showing 286 of 512 total issues

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

    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

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

            public function index(string $login, Request $request, Validator $validator)
            {
                $vote = $request->input('vote');
                $user = getUserByLogin($login);
        
        
        Severity: Major
        Found in app/Http/Controllers/RatingController.php - About 2 hrs to fix

          Method complaint has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function complaint(Request $request, Validator $validator): JsonResponse
              {
                  $path = null;
                  $model = false;
                  $id = int($request->input('id'));
          Severity: Minor
          Found in app/Http/Controllers/AjaxController.php - About 2 hrs to fix

            Method index has 50 lines of code (exceeds 25 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

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

                  public function edit(Request $request, Validator $validator)
                  {
                      $user = User::query()->where('login', $request->input('user'))->with('lastBan')->first();
              
                      if (! $user) {
              Severity: Minor
              Found in app/Http/Controllers/Admin/BanController.php - About 2 hrs to fix

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

                    public function uploadFile(UploadedFile $file, bool $record = true): array
                    {
                        $mime = $file->getClientMimeType();
                        $extension = strtolower($file->getClientOriginalExtension());
                        $basename = getBodyName($file->getClientOriginalName());
                Severity: Minor
                Found in app/Traits/UploadTrait.php - About 1 hr to fix

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

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

                    Method edit has 45 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: Minor
                    Found in app/Http/Controllers/BoardController.php - About 1 hr to fix

                      Method create has 44 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/PhotoController.php - About 1 hr to fix

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

                            public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
                            {
                                $places = PaidAdvert::PLACES;
                        
                                /** @var PaidAdvert $advert */
                        Severity: Minor
                        Found in app/Http/Controllers/Admin/PaidAdvertController.php - About 1 hr to fix

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

                              public function edit(Request $request, Validator $validator): View|RedirectResponse
                              {
                                  $user = getUserByLogin($request->input('user'));
                          
                                  if (! $user) {
                          Severity: Minor
                          Found in app/Http/Controllers/Admin/UserController.php - About 1 hr 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 index has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function index(string $login, Request $request, Validator $validator)
                              {
                                  $vote = $request->input('vote');
                                  $user = getUserByLogin($login);
                          
                          
                          Severity: Minor
                          Found in app/Http/Controllers/RatingController.php - About 1 hr 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 statAdverts has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function statAdverts(): array
                              {
                                  return Cache::remember('paidAdverts', 3600, static function () {
                                      $data = self::query()->where('deleted_at', '>', SITETIME)->orderBy('created_at')->get();
                          
                          
                          Severity: Minor
                          Found in app/Models/PaidAdvert.php - About 1 hr 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 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function create(Request $request, Validator $validator): View|RedirectResponse
                              {
                                  $places = PaidAdvert::PLACES;
                                  $advert = new PaidAdvert();
                                  $place = $request->input('place');
                          Severity: Minor
                          Found in app/Http/Controllers/Admin/PaidAdvertController.php - About 1 hr to fix

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

                                public function index(Request $request, Validator $validator)
                                {
                                    $user = getUser();
                            
                                    if ($user->newchat !== statsNewChat()) {
                            Severity: Minor
                            Found in app/Http/Controllers/Admin/ChatController.php - About 1 hr to fix

                              Method actionTopic has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function actionTopic(int $id, Request $request): RedirectResponse
                                  {
                                      $page = int($request->input('page', 1));
                              
                                      /** @var Topic $topic */
                              Severity: Minor
                              Found in app/Http/Controllers/Admin/ForumController.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language