visavi/rotor

View on GitHub

Showing 286 of 512 total issues

Avoid too many return statements within this method.
Open

        return view('users/login', compact('cookieLogin', 'isFlood'));
Severity: Major
Found in app/Http/Controllers/User/UserController.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return $num;
    Severity: Major
    Found in app/helpers.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return redirect('users?page=' . $end . '&user=' . $user . '&type=' . $type . '&sort=' . $sort);
      Severity: Major
      Found in app/Http/Controllers/User/ListController.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return round($num / 1000, 1) . 'K';
        Severity: Major
        Found in app/helpers.php - About 30 mins to fix

          Function close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function close(int $id, Request $request): RedirectResponse
              {
                  $vote = Vote::query()->where('id', $id)->first();
          
                  if (! $vote) {
          Severity: Minor
          Found in app/Http/Controllers/Admin/VoteController.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle(Request $request, Closure $next)
              {
                  if ($this->isBanned($request)) {
                      return redirect('ipban');
                  }
          Severity: Minor
          Found in app/Http/Middleware/CheckAccessSite.php - About 25 mins 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 change has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function change(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 25 mins 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 edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function edit(int $id, Request $request, Validator $validator)
              {
                  $page = int($request->input('page', 1));
          
                  if (! $user = getUser()) {
          Severity: Minor
          Found in app/Http/Controllers/Admin/ChatController.php - About 25 mins 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 moveArticle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function moveArticle(int $id, Request $request, Validator $validator)
              {
                  /** @var Article $article */
                  $article = Article::query()->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/ArticleController.php - About 25 mins 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 recovery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function recovery(Request $request, Validator $validator)
              {
                  if (getUser()) {
                      setFlash('danger', __('main.already_authorized'));
          
          
          Severity: Minor
          Found in app/Http/Controllers/MailController.php - About 25 mins 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 publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function publish(int $id, Request $request): RedirectResponse
              {
                  /** @var Down $down */
                  $down = Down::query()->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/LoadController.php - About 25 mins 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 downloadLink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function downloadLink(int $id, int $linkId, Validator $validator): Response
              {
                  /** @var Down $down */
                  $down = Down::query()->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Load/DownController.php - About 25 mins 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 deleteDown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function deleteDown(int $id, Request $request): RedirectResponse
              {
                  /** @var Down $down */
                  $down = Down::query()->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/LoadController.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function create(Request $request, Validator $validator)
              {
                  if ($request->isMethod('post')) {
                      $keys = int($request->input('keys'));
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/InvitationController.php - About 25 mins 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 moveTopic has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function moveTopic(int $id, Request $request, Validator $validator)
              {
                  /** @var Topic $topic */
                  $topic = Topic::query()->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Admin/ForumController.php - About 25 mins 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 edit has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 download has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function download(int $id, Validator $validator): Response
              {
                  /** @var File $file */
                  $file = File::query()->where('relate_type', Down::$morphName)->find($id);
          
          
          Severity: Minor
          Found in app/Http/Controllers/Load/DownController.php - About 25 mins 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 edit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function edit(int $id, Request $request, Validator $validator)
              {
                  if (! $user = getUser()) {
                      abort(403);
                  }
          Severity: Minor
          Found in app/Http/Controllers/GuestbookController.php - About 25 mins 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 edit has a Cognitive Complexity of 6 (exceeds 5 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/OfferController.php - About 25 mins 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 plural has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function plural(int $num, mixed $forms): string
          {
              if (! is_array($forms)) {
                  $forms = explode(',', $forms);
              }
          Severity: Minor
          Found in app/helpers.php - About 25 mins 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