willpower232/TOTPBTF3

View on GitHub

Showing 42 of 42 total issues

Method update has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function update()
    {
        if (config('app.readonly')) {
            abort(404);
        }
Severity: Minor
Found in app/Http/Controllers/SessionsController.php - About 1 hr to fix

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

        public function handle()
        {
            $email = $this->ask('Users email address?');
    
            $password = $this->secret('Password for user?');
    Severity: Minor
    Found in app/Console/Commands/Csv/Import.php - About 1 hr to fix

      Method handle has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function handle()
          {
              $email = $this->ask('Users email address?');
      
              $password = $this->secret('Password for user?');
      Severity: Minor
      Found in app/Console/Commands/Csv/Export.php - About 1 hr to fix

        Method store has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function store()
            {
                if (config('app.readonly')) {
                    abort(404);
                }
        Severity: Minor
        Found in app/Http/Controllers/TokensController.php - About 1 hr to fix

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

              public static function getValidationRules(string $for = '')
              {
                  $rules = array();
          
                  if ($for == 'login' || $for == 'create' || $for == 'update') {
          Severity: Minor
          Found in app/Models/User.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 boot has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function boot()
              {
                  // if your database type doesn't match https://laravel-news.com/laravel-5-4-key-too-long-error
                  // \Illuminate\Support\Facades\Schema::defaultStringLength(255);
          
          
          Severity: Minor
          Found in app/Providers/AppServiceProvider.php - About 1 hr to fix

            Method getFoldersOrTokensFromPath has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getFoldersOrTokensFromPath($path = '/')
                {
                    // guarantee input into the function
                    $path = Token::formatPath($path);
            
            
            Severity: Minor
            Found in app/Http/Controllers/TokensController.php - About 1 hr to fix

              Method getValidationRules has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getValidationRules(string $for = '')
                  {
                      $rules = array();
              
                      if ($for == 'login' || $for == 'create' || $for == 'update') {
              Severity: Minor
              Found in app/Models/User.php - About 1 hr to fix

                Method getFunctions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getFunctions()
                    {
                        return array(
                            /**
                             * Based on https://www.filamentgroup.com/lab/inlining-cache.html
                Severity: Minor
                Found in app/Helpers/TwigBridgeExtension/GetCriticalCSS.php - About 1 hr to fix

                  Method getQRCode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getQRCode()
                      {
                          // anonymous function to simplify hexadecimal colour input
                          $hexToRGB = function ($input) {
                              return array_map('hexdec', str_split(trim($input, '#'), 2));
                  Severity: Minor
                  Found in app/Models/Token.php - About 1 hr to fix

                    Each class must be in a namespace of at least one level (a top-level vendor name)
                    Open

                    class CreateTokensTable extends Migration

                    Each class must be in a namespace of at least one level (a top-level vendor name)
                    Open

                    class DatabaseSeeder extends Seeder

                    Each class must be in a namespace of at least one level (a top-level vendor name)
                    Open

                    class CreatePasswordResetsTable extends Migration

                    Each class must be in a namespace of at least one level (a top-level vendor name)
                    Open

                    class CreateUsersTable extends Migration

                    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 6 and the first side effect is on line 28.
                    Open

                    <?php
                    Severity: Minor
                    Found in routes/breadcrumbs.php by phpcodesniffer

                    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 10 and the first side effect is on line 24.
                    Open

                    <?php
                    Severity: Minor
                    Found in public_html/index.php by phpcodesniffer

                    Function handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function handle()
                        {
                            $email = $this->ask('Users email address?');
                    
                            $password = $this->secret('Password for user?');
                    Severity: Minor
                    Found in app/Console/Commands/Csv/Export.php - About 45 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

                    Consider simplifying this complex logical expression.
                    Open

                                                    if (response.status < 400 &&
                                                        ev.request.url.match(location.hostname) &&
                                                        response.headers.has('Content-Type') &&
                                                        (
                                                            response.headers.get('Content-Type').match(/^image\//i) ||
                    Severity: Major
                    Found in resources/assets/js/sw.js - About 40 mins to fix

                      Expected 1 space after FUNCTION keyword; 0 found
                      Open

                      Route::prefix('profile')->name('session')->group(function() {
                      Severity: Minor
                      Found in routes/web.php by phpcodesniffer

                      Function handle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function handle()
                          {
                              $email = $this->ask('Users email address?');
                      
                              $password = $this->secret('Password for user?');
                      Severity: Minor
                      Found in app/Console/Commands/Csv/Import.php - About 35 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