digitalbiblesociety/dbp

View on GitHub

Showing 65 of 67 total issues

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

    public function handle()
    {
        $chapters = glob(storage_path('data/bibles/runeberg/*.html'));
        foreach ($chapters as $chapter_path) {
            $book_number = substr($chapter_path,40,2);
Severity: Minor
Found in app/Console/Commands/BibleFormats/FormatRunberg.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 validateUser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private function validateUser($fileset = null)
    {
        $user = Auth::user();
        if (!$user) {
            $key = Key::where('key', $this->key)->first();

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

    public function update(Request $request, $id)
    {
        if ((int) $request->v === 1) {
            return redirect('http://api.dbp.test/login?reply=json');
        }
Severity: Minor
Found in app/Http/Controllers/User/UsersController.php - About 55 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 transform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function transform($fileset)
    {
        switch ($this->route) {

            /**
Severity: Minor
Found in app/Transformers/V2/LibraryVolumeTransformer.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

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

    public function store(Request $request)
    {
        $invalidUser = $this->validateUser();
        if ($invalidUser) {
            return $invalidUser;
Severity: Minor
Found in app/Http/Controllers/User/AccessGroupController.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

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

    public function handle()
    {
        $this->addGeoData();
        $current_time = Carbon::now();
        $files = Storage::disk('data')->files('api-node-logs');
Severity: Minor
Found in app/Console/Commands/S3LogBackup.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

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

    private function getV2Output($filesets)
    {
        $output = [];
        foreach ($filesets as $fileset) {
            $has_nondrama = $fileset->where('id', 'LIKE', substr($fileset->id, 0, 6).'%')->where('set_type_code', 'audio')->get();
Severity: Minor
Found in app/Http/Controllers/Bible/LibraryController.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

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

    public function highlightAlter()
    {
        if ($this->hash === request()->hash) {
            if (request()->method() == 'DELETE') {
                $deletedHighlight = Highlight::where('id', request()->id)->delete();
Severity: Minor
Found in app/Http/Controllers/User/UsersControllerV2.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

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

    private function selectColor($color)
    {
        $matches = [];
        $selectedColor = null;
        $highlightedColor = request()->highlighted_color;
Severity: Minor
Found in app/Http/Controllers/User/HighlightsController.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

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

    public function login()
    {
        $email    = request()->email ?? request()->login;
        $provider = request()->remote_type;
        $password = request()->password;
Severity: Minor
Found in app/Http/Controllers/User/UsersControllerV2.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

Method scopeUniqueFileset has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function scopeUniqueFileset($query, $id = null, $asset_id = null, $fileset_type = null, $ambigious_fileset_type = false, $testament_filter = null)
Severity: Minor
Found in app/Models/Bible/BibleFileset.php - About 45 mins to fix

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

        public function noteAlter()
        {
            if ($this->hash === request()->hash) {
    
                if(request()->_method === 'delete') {
    Severity: Minor
    Found in app/Http/Controllers/User/UsersControllerV2.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

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

        public function run(Faker $faker)
        {
            $highlighted_colors = \DB::connection('dbp_users')->table('user_highlight_colors')->select('id')->get();
            $bibles = \DB::connection('dbp')->table('bibles')->select('id')->get();
            $books  = \DB::connection('dbp')->table('books')->select('id')->get();
    Severity: Minor
    Found in database/seeds/AnnotationSeeder.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

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

        private function getOauthProvider($project_id, $provider)
        {
            $driver = ProjectOauthProvider::where('project_id', $project_id)->where('name', $provider)->first();
            switch ($provider) {
                case 'bitbucket':
    Severity: Minor
    Found in app/Http/Controllers/User/SocialController.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

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

        public function volumes($iso = null)
        {
            $iso = strtolower($iso);
            return \Cache::remember('media-languages_'.$iso, now()->addWeek(), function () use ($iso) {
    
    
    Severity: Minor
    Found in app/Http/Controllers/Connections/ArclightController.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

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

        public function handle()
        {
            $this->log_string = str_replace(array("\n", "\r"), '', $this->log_string);
            $this->addGeoData();
            $current_time = Carbon::now();
    Severity: Minor
    Found in app/Jobs/SendApiLogs.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

    Avoid too many return statements within this method.
    Open

                    return [];
    Severity: Major
    Found in app/Http/Controllers/Bible/LibraryController.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $this->setStatusCode(200)->reply(fractal($project, ProjectTransformer::class)->addMeta(['message' => trans('api.projects_created_200')]));
      Severity: Major
      Found in app/Http/Controllers/Organization/ProjectsController.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $this->reply($chapters);
        Severity: Major
        Found in app/Http/Controllers/Bible/BooksControllerV2.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return $this->setStatusCode(404)->replyWithError(trans('api.projects_404'));
          Severity: Major
          Found in app/Http/Controllers/User/UsersController.php - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language