GrafiteInc/CMS

View on GitHub

Showing 60 of 103 total issues

Function convertDataToItems has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function convertDataToItems($data, $key, $conversions = [], $limit = 15)
    {
        if (!isset($conversions['unknown'])) {
            $conversions['unknown'] = 0;
        }
Severity: Minor
Found in src/Services/AnalyticsService.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 sortable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function sortable($label, $field)
    {
        $query = request()->query();
        $newQuery = $query;

Severity: Minor
Found in src/Helpers/general.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 moduleLinks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function moduleLinks($ignoredModules = [], $linkClass = 'nav-link', $listClass = 'nav-item')
    {
        $links = '';

        $modules = config('cms.modules', []);
Severity: Minor
Found in src/Services/Traits/ModuleServiceTrait.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 handle has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle()
    {
        $moduleDir = base_path(config('cms.module-directory')).'/'.ucfirst($this->argument('module'));
        if (is_dir($moduleDir)) {
            $readMeStub = file_get_contents(__DIR__.'/../Templates/Composer/readme.stub');
Severity: Minor
Found in src/Console/ModuleComposer.php - About 1 hr to fix

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

        public function handle()
        {
            $name = $this->argument('name');
    
            $fileSystem = new Filesystem();
    Severity: Minor
    Found in src/Console/ThemePublish.php - About 1 hr to fix

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

          public function check($form, $jsonInput = false)
          {
              $result = [];
              $errors = [];
              $inputs = [];
      Severity: Minor
      Found in src/Services/ValidationService.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 promotion has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          public function promotion($slug)
          {
              $promotion = app(PromotionRepository::class)->getBySlug($slug);
      
              if ($promotion) {
      Severity: Minor
      Found in src/Services/Traits/DefaultModuleServiceTrait.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 preview has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function preview($entity, $id)
          {
              $modelString = 'Grafite\Cms\Models\\'.ucfirst($entity);
      
              if (!class_exists($modelString)) {
      Severity: Minor
      Found in src/Controllers/GrafiteCmsFeatureController.php - About 1 hr to fix

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

            public function asPreview($encFileName, Filesystem $fileSystem)
            {
                try {
                    return Cache::remember($encFileName.'_preview', 3600, function () use ($encFileName, $fileSystem) {
                        $fileName = CryptoServiceFacade::url_decode($encFileName);
        Severity: Minor
        Found in src/Services/AssetService.php - About 1 hr to fix

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

              public function register()
              {
                  $loader = AliasLoader::getInstance();
          
                  $loader->alias('Cms', \Grafite\Cms\Facades\CmsServiceFacade::class);
          Severity: Minor
          Found in src/Providers/CmsServiceProvider.php - About 1 hr to fix

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

                public function asset($encPath, $contentType, Filesystem $fileSystem)
                {
                    try {
                        $path = CryptoServiceFacade::url_decode($encPath);
            
            
            Severity: Minor
            Found in src/Services/AssetService.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 saveFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function saveFile($fileName, $directory = '', $fileTypes = [], $isImage = false)
                {
                    if (is_object($fileName)) {
                        $file = $fileName;
                        $originalName = $file->getClientOriginalName();
            Severity: Minor
            Found in src/Services/FileService.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 handle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function handle()
                {
                    $name = $this->argument('name');
            
                    $fileSystem = new Filesystem();
            Severity: Minor
            Found in src/Console/ThemeGenerate.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 allTags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function allTags()
                {
                    $tags = [];
            
                    if (app()->getLocale() !== config('cms.default-language', 'en')) {
            Severity: Minor
            Found in src/Repositories/BlogRepository.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 main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function main()
                {
                    if (!is_null(config('analytics.view_id')) && config('cms.analytics') == 'google') {
                        $period = Period::days(7);
            
            
            Severity: Minor
            Found in src/Controllers/DashboardController.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 inputsArray has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private function inputsArray($jsonInput)
                {
                    if ($jsonInput) {
                        $inputs = Input::json();
                    } else {
            Severity: Minor
            Found in src/Services/ValidationService.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function update($image, $input)
                {
                    if (isset($input['location']) && !empty($input['location'])) {
                        $savedFile = app(FileService::class)->saveFile($input['location'], 'public/images', [], true);
            
            
            Severity: Minor
            Found in src/Repositories/ImageRepository.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 widget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function widget($slug)
                {
                    $widget = app(WidgetRepository::class)->getBySlug($slug);
            
                    if ($widget) {
            Severity: Minor
            Found in src/Services/Traits/DefaultModuleServiceTrait.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 store has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function store(Request $request)
                {
                    try {
                        $validation = app(ValidationService::class)->check(['location' => 'required']);
                        if (!$validation['errors']) {
            Severity: Minor
            Found in src/Controllers/ImagesController.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 collectSiteMapItems has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function collectSiteMapItems()
                {
                    $itemCollection = [];
                    $modules = config('site-mapped-modules', [
                        'blog' => 'Grafite\Cms\Repositories\BlogRepository',
            Severity: Minor
            Found in src/Services/CmsService.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

            Severity
            Category
            Status
            Source
            Language