visavi/rotor

View on GitHub

Showing 512 of 512 total issues

Function uploadFile has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function uploadFile(Request $request, Validator $validator): JsonResponse
    {
        $imageTypes = [
            Article::$morphName,
            Item::$morphName,
Severity: Minor
Found in app/Http/Controllers/AjaxController.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function index(Request $request, Validator $validator)
    {
        if ($request->isMethod('post')) {
            $page = int($request->input('page', 1));
            $choice = intar($request->input('choice'));
Severity: Minor
Found in app/Http/Controllers/Admin/ReglistController.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 create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

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

        if (! $user = getUser()) {
Severity: Minor
Found in app/Http/Controllers/Forum/TopicController.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 parsePhpModules has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private static function parsePhpModules(): array
    {
        ob_start();
        phpinfo(INFO_MODULES);
        $s = ob_get_clean();
Severity: Minor
Found in app/Http/Controllers/InstallController.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 makeCalendar has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function makeCalendar(int $month, int $year): array
    {
        $date = date('w', mktime(0, 0, 0, $month, 1, $year));

        if ($date === '0') {
Severity: Minor
Found in app/Classes/Calendar.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function index(Request $request, Validator $validator)
    {
        $find = $request->input('find');
        $type = $request->input('type') === 'title' ? 'title' : 'text';
        $data = collect();
Severity: Minor
Found in app/Http/Controllers/Forum/SearchController.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 edit has a Cognitive Complexity of 11 (exceeds 5 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

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

    public function index(): View
    {
        $count = statsCounter();
        $online = statsOnline();

Severity: Minor
Found in app/Http/Controllers/CounterController.php - About 1 hr to fix

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

        public function index(Request $request, Validator $validator)
        {
            $find = $request->input('find');
            $type = $request->input('type') === 'title' ? 'title' : 'text';
            $data = collect();
    Severity: Minor
    Found in app/Http/Controllers/Forum/SearchController.php - About 1 hr to fix

      Method pagination has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function pagination(string $url = '/topics'): ?HtmlString
          {
              if (! $this->count_posts) {
                  return null;
              }
      Severity: Minor
      Found in app/Models/Topic.php - About 1 hr to fix

        Method users has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function users(string $login): Response
            {
                $user = getUserByLogin($login);
        
                if (! $user) {
        Severity: Minor
        Found in app/Http/Controllers/ApiController.php - About 1 hr to fix

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

              public function edit(int $id, Request $request, Validator $validator)
              {
                  if (! isAdmin(User::BOSS)) {
                      abort(403, __('errors.forbidden'));
                  }
          Severity: Minor
          Found in app/Http/Controllers/Admin/ArticleController.php - About 1 hr to fix

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

                public function edit(int $id, Request $request, Validator $validator)
                {
                    if (! isAdmin(User::BOSS)) {
                        abort(403, __('errors.forbidden'));
                    }
            Severity: Minor
            Found in app/Http/Controllers/Admin/LoadController.php - About 1 hr to fix

              Method zip has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function zip(int $id): View
                  {
                      /** @var File $file */
                      $file = File::query()->where('relate_type', Down::$morphName)->find($id);
                      $down = $file?->relate;
              Severity: Minor
              Found in app/Http/Controllers/Load/DownController.php - About 1 hr to fix

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

                    public function edit(int $id, Request $request, Validator $validator)
                    {
                        $offer = Offer::query()->where('id', $id)->first();
                
                        if (! $offer) {
                Severity: Minor
                Found in app/Http/Controllers/Admin/OfferController.php - About 1 hr to fix

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

                      public function edit(int $id, Request $request, Validator $validator)
                      {
                          $page = int($request->input('page', 1));
                          $link = Advert::query()->find($id);
                  
                  
                  Severity: Minor
                  Found in app/Http/Controllers/Admin/AdvertController.php - About 1 hr to fix

                    Method edit has 30 lines of code (exceeds 25 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/PhotoController.php - About 1 hr to fix

                      Method restatement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function restatement(string $mode)
                      {
                          switch ($mode) {
                              case 'forums':
                                  DB::update('update topics set count_posts = (select count(*) from posts where topics.id = posts.topic_id)');
                      Severity: Minor
                      Found in app/helpers.php - About 1 hr to fix

                        Method close has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function close(int $id, Request $request, Validator $validator): RedirectResponse
                            {
                                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 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function create(Request $request, Validator $validator)
                              {
                                  if ($request->isMethod('post')) {
                                      $type = $request->input('type');
                                      $name = $request->input('name');
                          Severity: Minor
                          Found in app/Http/Controllers/Admin/NoticeController.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language