AJenbo/agcms

View on GitHub

Showing 151 of 1,190 total issues

Function resize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function resize() {
    $("save").style.display = "";
    $("loading").style.visibility = "hidden";
    if (resizeHandle !== null) {
        resizeHandle.destroy();
Severity: Minor
Found in source/javascript/admin/image-edit.js - About 1 hr to fix

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

        private function findCategories(string $searchString, string $antiWords): array
        {
            if (!$searchString) {
                return [];
            }
    Severity: Minor
    Found in application/inc/Http/Controllers/Search.php - About 1 hr to fix

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

          public function getPages(string $order = 'navn'): array
          {
              if (!in_array($order, ['navn', 'for', 'pris', 'varenr'], true)) {
                  $order = 'navn';
              }
      Severity: Minor
      Found in application/inc/Models/Brand.php - About 1 hr to fix

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

        function resize() {
            $("save").style.display = "";
            $("loading").style.visibility = "hidden";
            if (resizeHandle !== null) {
                resizeHandle.destroy();
        Severity: Minor
        Found in source/javascript/admin/image-edit.js - 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 mismatchedBindings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function mismatchedBindings(): JsonResponse
            {
                $html = '';
        
                // Map out active / inactive
        Severity: Minor
        Found in application/inc/Http/Controllers/Admin/MaintenanceController.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 fileRename has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function fileRename(Request $request, int $id): JsonResponse
            {
                try {
                    $file = app(OrmService::class)->getOne(File::class, $id);
                    if (!$file) {
        Severity: Minor
        Found in application/inc/Http/Controllers/Admin/ExplorerController.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 index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function index(Request $request, ?int $id = null): Response
            {
                $selectedId = intval($request->cookies->get('activekat', -1));
                $openCategories = explode('<', strval($request->cookies->get('openkat', '')));
                $openCategories = array_map('intval', $openCategories);
        Severity: Minor
        Found in application/inc/Http/Controllers/Admin/PageController.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 files has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function files(Request $request): JsonResponse
            {
                $path = $request->query->get('path');
                if (!is_string($path)) {
                    $path = '';
        Severity: Minor
        Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 1 hr to fix

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

              public function address(Request $request): Response
              {
                  $rawCart = $request->get('cart');
                  if (!is_string($rawCart)) {
                      $rawCart = '';
          Severity: Minor
          Found in application/inc/Http/Controllers/Shopping.php - About 1 hr to fix

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

                public function search(Request $request): JsonResponse
                {
                    $returnType = $request->query->get('return');
                    if (!is_string($returnType)) {
                        $returnType = '';
            Severity: Minor
            Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 1 hr to fix

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

                  public function imageSaveThumb(Request $request, int $id): Response
                  {
                      $file = app(OrmService::class)->getOne(File::class, $id);
                      if (!$file) {
                          throw new InvalidInput(_('File not found.'), Response::HTTP_NOT_FOUND);
              Severity: Minor
              Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 1 hr to fix

                Function addToEditor has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    addToEditor() {
                        let data = "";
                        let html = "<a href=\"" + htmlEncode(this.path) + "\" target=\"_blank\">" + htmlEncode(this.name) + "</a>";
                        switch (this.type()) {
                            case "image":
                Severity: Minor
                Found in source/javascript/admin/File.js - About 1 hr to fix

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

                      public function badFolderNames(): JsonResponse
                      {
                          $db = app(DbService::class);
                  
                          $db->addLoadedTable('files');
                  Severity: Minor
                  Found in application/inc/Http/Controllers/Admin/MaintenanceController.php - About 1 hr to fix

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

                        public function redirectToSearch(Request $request): RedirectResponse
                        {
                            $redirectUrl = '/search/';
                    
                            $query = preg_replace(
                    Severity: Minor
                    Found in application/inc/Http/Controllers/Base.php - About 1 hr to fix

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

                          public function imageSave(Request $request, int $id): Response
                          {
                              $file = app(OrmService::class)->getOne(File::class, $id);
                              if (!$file) {
                                  throw new InvalidInput(_('File not found.'), Response::HTTP_NOT_FOUND);
                      Severity: Minor
                      Found in application/inc/Http/Controllers/Admin/ExplorerController.php - About 1 hr to fix

                        Function cleanAddressData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function cleanAddressData(array $data): array
                            {
                                $data = [
                                    'name'                 => $data['name'] ?? '',
                                    'attn'                 => $data['attn'] ?? '',
                        Severity: Minor
                        Found in application/inc/Services/InvoiceService.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 getShippingAddress has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function getShippingAddress(array $countries): string
                            {
                                if (!$this->invoice->hasShippingAddress()) {
                                    return '';
                                }
                        Severity: Minor
                        Found in application/inc/Services/InvoicePdfService.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 getRows has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getRows(?int $orderBy = null): array
                            {
                                $db = app(DbService::class);
                        
                                $dataRows = $db->fetchArray(
                        Severity: Minor
                        Found in application/inc/Models/Table.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 checkSearchable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function checkSearchable(Request $request): ?RedirectResponse
                            {
                                $brandId = $request->get('maerke');
                                if (!$request->get('q')
                                    && !$request->get('varenr')
                        Severity: Minor
                        Found in application/inc/Http/Controllers/Search.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 files has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function files(Request $request): JsonResponse
                            {
                                $path = $request->query->get('path');
                                if (!is_string($path)) {
                                    $path = '';
                        Severity: Minor
                        Found in application/inc/Http/Controllers/Admin/ExplorerController.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

                        Severity
                        Category
                        Status
                        Source
                        Language