reliqarts/laravel-docweaver

View on GitHub

Showing 15 of 15 total issues

Method show has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show(string $productKey, string $version, string $page = null)
    {
        // ensure product exists
        $product = $this->productFinder->findProduct($productKey);
        if ($product === null) {
Severity: Minor
Found in src/Http/Controller/DocumentationController.php - About 1 hr to fix

    Method registerBindings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function registerBindings(): self
        {
            $this->app->singleton(FilesystemContract::class, Filesystem::class);
            $this->app->singleton(DocumentationPublisherContract::class, DocumentationPublisher::class);
            $this->app->singleton(DocumentationProviderContract::class, DocumentationProvider::class);
    Severity: Minor
    Found in src/ServiceProvider.php - About 1 hr to fix

      Method publish has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function publish(Product $product, string $source): Result
          {
              $result = new Result();
              $versions = [Product::VERSION_MAIN];
              $versionsPublished = [];
      Severity: Minor
      Found in src/Service/Product/Publisher.php - About 1 hr to fix

        Function initSidebar has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            initSidebar() {
                let _self = this,
                    $sidebar = this.$wrapper.find('.docweaver-sidebar'),
                    $sidebarPopper = $sidebar.find('.docweaver-sidebar-popper'),
                    $activeLink = $sidebar.find('li a[href="' + decodeURIComponent(window.location.pathname) + '"]');
        Severity: Minor
        Found in resources/js/modules/core.js - About 1 hr to fix

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

              public function update(Product $product): Result
              {
                  $result = new Result();
                  $publishedVersions = array_keys($product->getVersions());
                  $availableTags = $this->listAvailableProductTags($product);
          Severity: Minor
          Found in src/Service/Product/Publisher.php - About 1 hr to fix

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

                public function getDefaultVersion(bool $allowWordedDefault = false): string
                {
                    $versions = empty($this->versions) ? $this->getVersions() : $this->versions;
                    $allowWordedDefault = $allowWordedDefault || $this->configProvider->isWordedDefaultVersionAllowed();
                    $defaultVersion = self::VERSION_UNKNOWN;
            Severity: Minor
            Found in src/Model/Product.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 initBlockquotes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                initBlockquotes() {
                    // It's nice to just write in Markdown, so this will adjust
                    // our blockquote style to fill in the icon flag and label
                    this.$wrapper.find('.docs blockquote p:first-child').each(function () {
                        let str = $(this).html(),
            Severity: Minor
            Found in resources/js/modules/core.js - About 1 hr to fix

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

                      string $masterTemplate,
                      string $masterSection,
                      string $styleStack,
                      string $scriptStack,
                      string $indexTitle,
              Severity: Major
              Found in src/Model/TemplateConfig.php - About 1 hr to fix

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

                        array $command,
                        string $cwd = null,
                        array $env = null,
                        $input = null,
                        ?float $timeout = 60
                Severity: Minor
                Found in src/Contract/ProcessHelper.php - About 35 mins to fix

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

                          Filesystem $filesystem,
                          Logger $logger,
                          ConfigProvider $configProvider,
                          ProductPublisher $productPublisher,
                          ProductFactory $productFactory
                  Severity: Minor
                  Found in src/Service/Documentation/Publisher.php - About 35 mins to fix

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

                            array $command,
                            string $cwd = null,
                            array $env = null,
                            $input = null,
                            ?float $timeout = 60
                    Severity: Minor
                    Found in src/Helper/ProcessHelper.php - About 35 mins to fix

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

                              Filesystem $filesystem,
                              ConfigProvider $configProvider,
                              FileHelper $fileHelper,
                              YamlHelper $yamlHelper,
                              string $directory
                      Severity: Minor
                      Found in src/Model/Product.php - About 35 mins to fix

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

                            protected function tell($text, $direction = self::TELL_DIRECTION_OUT): string
                            {
                                $direction = strtolower($direction);
                                $nl = app()->runningInConsole() ? "\n" : '<br/>';
                                $dirSymbol = ($direction === self::TELL_DIRECTION_IN
                        Severity: Minor
                        Found in src/Service/Publisher.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 show has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function show(string $productKey, string $version, string $page = null)
                            {
                                // ensure product exists
                                $product = $this->productFinder->findProduct($productKey);
                                if ($product === null) {
                        Severity: Minor
                        Found in src/Http/Controller/DocumentationController.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 listProducts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function listProducts(bool $includeUnknowns = false): array
                            {
                                $products = [];
                                $documentationDirectory = $this->configProvider->getDocumentationDirectory();
                                $productDirectories = $this->filesystem->directories(base_path($documentationDirectory));
                        Severity: Minor
                        Found in src/Service/Product/Finder.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