digitalbiblesociety/dbp

View on GitHub

Showing 65 of 67 total issues

Avoid too many return statements within this method.
Open

            return $this->reply(['success' => 'User updated', 'user' => $user]);
Severity: Major
Found in app/Http/Controllers/User/UsersController.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $session_param;
    Severity: Major
    Found in app/Helpers/Helpers.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return fractal($this->generateFilesetChapters($fileset, $fileset_chapters, $bible, $asset_id), new FileSetTransformer(), $this->serializer);
      Severity: Major
      Found in app/Http/Controllers/Bible/BibleFileSetsController.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

                  return $this->reply(fractal($verses, new TextTransformer(), $this->serializer));
          Severity: Major
          Found in app/Http/Controllers/Bible/TextController.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $this->setStatusCode(401)->replyWithError(trans('api.projects_developer_not_a_member', [], $GLOBALS['i18n_iso']));
            Severity: Major
            Found in app/Http/Controllers/User/UsersController.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $this->reply($fileset_chapters, [], $transaction_id ?? '');
              Severity: Major
              Found in app/Http/Controllers/Bible/BibleFileSetsController.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return view('dashboard.users.show', $id);
                Severity: Major
                Found in app/Http/Controllers/User/UsersController.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return [];
                  Severity: Major
                  Found in app/Transformers/BibleTransformer.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return response()->json($object, $this->statusCode, [], JSON_UNESCAPED_UNICODE)
                                            ->header('Content-Type', 'application/json; charset=utf-8')->setCallback($input);
                    Severity: Major
                    Found in app/Http/Controllers/APIController.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $this->setStatusCode(401)->replyWithError(trans('api.projects_users_needs_to_connect', [], $GLOBALS['i18n_iso']));
                      Severity: Major
                      Found in app/Http/Controllers/User/UsersController.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return response()->make($formatter->toCsv(), $this->statusCode)
                                                         ->header('Content-Type', 'text/csv; charset=utf-8');
                        Severity: Major
                        Found in app/Http/Controllers/APIController.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return fractal($chapters, new BookTransformer(), $this->serializer);
                          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 view('dashboard.projects.show', compact('user', 'project'));
                            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->setStatusCode(401)->replyWithError(trans('auth.failed'));
                              Severity: Major
                              Found in app/Http/Controllers/User/UsersController.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return $this->setStatusCode(404)->replyWithError('No Fileset Chapters Found for the provided params');
                                Severity: Major
                                Found in app/Http/Controllers/Bible/BibleFileSetsController.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return $this->setStatusCode(401)->replyWithError('hash does not match');
                                  Severity: Major
                                  Found in app/Http/Controllers/User/UsersControllerV2.php - About 30 mins to fix

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

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

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

                                        private function generateFilesetChapters($fileset, $fileset_chapters, $bible, $asset_id)
                                        {
                                            if ($fileset->set_type_code === 'video_stream') {
                                                foreach ($fileset_chapters as $key => $fileSet_chapter) {
                                                    $fileset_chapters[$key]->file_name = route('v4_video_stream', ['fileset_id' => $fileset->id, 'file_id' => $fileSet_chapter->id]);
                                    Severity: Minor
                                    Found in app/Http/Controllers/Bible/BibleFileSetsController.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

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

                                        public function user()
                                        {
                                            if (request()->getMethod() === 'POST') {
                                                $user = $user = User::where('email', request()->email)->first();
                                                if (!$user) {
                                    Severity: Minor
                                    Found in app/Http/Controllers/User/UsersControllerV2.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