ahk-ch/chamb.net

View on GitHub

Showing 11 of 36 total issues

DbUserRepository has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class DbUserRepository extends DbRepository implements UserRepository
{
    /**
     * DbUserRepository constructor.
     *
Severity: Minor
Found in app/Ahk/Repositories/User/DbUserRepository.php - About 2 hrs to fix

    File show.blade.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    @extends('ahk.layouts.master')
    @section('title', "{$company->name} - {$industry->name}")
    @section('inline-css')
        <style type="text/css">
            {!! File::get(public_path(elixir("css/industries/companies/show/above-the-fold-content.min.css"))) !!}
    Severity: Minor
    Found in resources/views/ahk/industries/companies/show.blade.php - About 2 hrs to fix

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

          public function transform($item)
          {
              return [
                  'name'            => $item->name,
                  'slug'            => $item->slug,
      Severity: Minor
      Found in app/Ahk/Transformers/Api/CompanyApiTransformer.php - About 1 hr to fix

        Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function run()
            {
                Service::create(['name' => 'Knowledge Exchange', 'color' => Service::$colors[array_rand(Service::$colors)]]);
                Service::create(['name' => 'Corporations', 'color' => Service::$colors[array_rand(Service::$colors)]]);
                Service::create(['name' => 'Buyer', 'color' => Service::$colors[array_rand(Service::$colors)]]);
        Severity: Minor
        Found in database/seeds/ServiceTableSeeder.php - About 1 hr to fix

          Method paginatePublishedByIndustry has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function paginatePublishedByIndustry(Industry $industry, $perPage = 10, $columns = ['*'], $pageName = 'page', $page = null)
          Severity: Minor
          Found in app/Ahk/Repositories/Article/DbArticleRepository.php - About 35 mins to fix

            Method paginateWorkGroups has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function paginateWorkGroups(Industry $industry, $perPage = null, $columns = ['*'], $pageName = 'page', $page = null);
            Severity: Minor
            Found in app/Ahk/Repositories/Industry/IndustryRepository.php - About 35 mins to fix

              Method paginateWorkGroups has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function paginateWorkGroups(Industry $industry, $perPage = 10, $columns = ['*'], $pageName = 'page', $page = null)
              Severity: Minor
              Found in app/Ahk/Repositories/Industry/DbIndustryRepository.php - About 35 mins to fix

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct(CompanyRepository $companyRepository, UserRepository $userRepository,
                                                IndustryRepository $industryRepository, CountryRepository $countryRepository,
                                                FileRepository $fileRepository)
                Severity: Minor
                Found in app/Http/Controllers/Ahk/User/CompaniesController.php - About 35 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $next($request);
                  Severity: Major
                  Found in app/Http/Middleware/Cms/AuthenticateCms.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return $next($request);
                    Severity: Major
                    Found in app/Http/Middleware/Ahk/AuthenticateAhk.php - About 30 mins to fix

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

                          public function handle(Request $request, Closure $next, Guard $guard = null)
                          {
                              if (Auth::guard($guard)->guest()) {
                                  if ($request->ajax()) {
                                      return response('Unauthorized.', 401);
                      Severity: Minor
                      Found in app/Http/Middleware/Ahk/AuthenticateAhk.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