visavi/rotor

View on GitHub

Showing 286 of 512 total issues

Function file has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function file(?UploadedFile $input, array $rules, $label, bool $required = true): Validator
    {
        if (! $required && blank($input)) {
            return $this;
        }
Severity: Minor
Found in app/Classes/Validator.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 profile has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

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

      Method generateLogin has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function generateLogin($network, string $delimiter = '-'): ?string
          {
              $firstName = ucfirst(Str::slug($network->first_name, $delimiter));
              $lastName = ucfirst(Str::slug($network->last_name, $delimiter));
              $firstLetter = $firstName[0];
      Severity: Major
      Found in app/Models/Social.php - About 2 hrs to fix

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

            public function edit(int $id, Request $request, Validator $validator)
            {
                $vote = Vote::query()->where('id', $id)->first();
        
                if (! $vote) {
        Severity: Minor
        Found in app/Http/Controllers/Admin/VoteController.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 icons has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function icons(string $ext): HtmlString
        {
            switch ($ext) {
                case 'php':
                    $ico = 'fa-regular fa-file-code';
        Severity: Major
        Found in app/helpers.php - About 2 hrs to fix

          File BBCode.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare(strict_types=1);
          
          namespace App\Classes;
          Severity: Minor
          Found in app/Classes/BBCode.php - About 2 hrs to fix

            File admin.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            return [
                'antimat' => [
                    'text' => '
            Severity: Minor
            Found in resources/lang/ru/admin.php - About 2 hrs to fix

              File admin.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              return [
                  'antimat' => [
                      'text' => '
              Severity: Minor
              Found in resources/lang/en/admin.php - About 2 hrs to fix

                File admin.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                return [
                    'antimat' => [
                        'text' => '
                Severity: Minor
                Found in resources/lang/ua/admin.php - About 2 hrs to fix

                  ArticleController has 22 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ArticleController extends Controller
                  {
                      /**
                       * Главная страница
                       */
                  Severity: Minor
                  Found in app/Http/Controllers/ArticleController.php - About 2 hrs to fix

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

                        public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
                        {
                            $cid = int($request->input('cid'));
                    
                            if (! isAdmin() && ! setting('blog_create')) {
                    Severity: Major
                    Found in app/Http/Controllers/ArticleController.php - About 2 hrs to fix

                      Method key has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function key(Request $request, Validator $validator)
                          {
                              /* @var User $user */
                              if (! $user = getUser()) {
                                  abort(403, __('main.not_authorized'));
                      Severity: Major
                      Found in app/Http/Controllers/User/UserController.php - About 2 hrs to fix

                        Function index has a Cognitive Complexity of 17 (exceeds 5 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

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

                            public function getFeed(): HtmlString
                            {
                                $polls = [];
                                $collect = new Collection();
                        
                        
                        Severity: Minor
                        Found in app/Classes/Feed.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 create has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Method talk has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function talk(string $login, Request $request): Response
                              {
                                  /** @var User $user */
                                  $user = $request->attributes->get('user');
                          
                          
                          Severity: Major
                          Found in app/Http/Controllers/ApiController.php - About 2 hrs to fix

                            Method up has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function up(): void
                                {
                                    if (! Schema::hasTable('users')) {
                                        Schema::create('users', function (Blueprint $table) {
                                            $table->increments('id');
                            Severity: Major
                            Found in database/migrations/2018_04_20_180049_create_users_table.php - About 2 hrs to fix

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

                                  public function create(Request $request, Validator $validator)
                                  {
                                      if ($this->user->point < setting('rekuserpoint')) {
                                          abort(200, __('adverts.advert_point', ['point' => plural(50, setting('scorename'))]));
                                      }
                              Severity: Major
                              Found in app/Http/Controllers/AdvertController.php - About 2 hrs to fix

                                Method create has 53 lines of code (exceeds 25 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: Major
                                Found in app/Http/Controllers/Admin/BackupController.php - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language