antaresproject/core

View on GitHub

Showing 265 of 306 total issues

Function registerEventListeners has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function registerEventListeners(DispatcherContract $events)
    {
        foreach ($this->listen as $event => $listeners) {
            $defaultPriority = 0;
            if (!is_array($listeners)) {
Severity: Minor
Found in src/components/support/src/Providers/Traits/EventProviderTrait.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 resolveNamespace has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolveNamespace(string $path, bool $asPackage = false): string
    {
        $file       = new File($path);
        $pathInfo   = array_filter(explode(DIRECTORY_SEPARATOR, trim(str_replace([$this->configRepository->getRootPath(), 'src'], '', $file->getRealPath()), DIRECTORY_SEPARATOR)));
        $prefix     = 'antares';
Severity: Minor
Found in src/components/extension/src/FilesystemFinder.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 min has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function min()
    {
        if ($this->output !== '') { // min already run
            return $this->output;
        }
Severity: Minor
Found in src/utils/asset/src/JSMin.php - About 1 hr to fix

    Method columnSearch has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function columnSearch()
        {
            $columns = $this->request->get('columns', []);
    
            foreach ($columns as $index => $column) {
    Severity: Minor
    Found in src/ui/components/datatables/src/Engines/QueryBuilderEngine.php - About 1 hr to fix

      Method getActionsColumn has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getActionsColumn(Authorization $acl): Closure
          {
              return function(ExtensionContract $extension) use($acl) {
                  $buttons = [];
                  $name    = $extension->getPackage()->getName();
      Severity: Minor
      Found in src/foundation/src/Http/Datatables/Extensions.php - About 1 hr to fix

        Method setDefaultOptions has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function setDefaultOptions()
            {
                $areas         = array_keys(config('areas.areas'));
                $default       = config('areas.default');
                $configuration = require_once(__DIR__ . '/../../../../../modules/brands/resources/config/install.php');

          Method registerEngine has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function registerEngine()
              {
                  $this->app->bindIf('twig', function () {
                      $extensions = $this->app->make('twig.extensions');
                      $lexer      = $this->app->make('twig.lexer');
          Severity: Minor
          Found in src/utils/testbench/src/Providers/TwigServiceProvider.php - About 1 hr to fix

            Method render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function render()
                {
                    $dropzoneAttributes = array_diff_key($this->field->attributes, array_flip(['class']));
            
                    if (!isset($dropzoneAttributes['container'])) {
            Severity: Minor
            Found in src/components/html/src/Control/Dropzone.php - About 1 hr to fix

              Method argumentsToString has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function argumentsToString($args)
                  {
                      $count = 0;
              
                      $isAssoc = $args !== array_values($args);
              Severity: Minor
              Found in src/components/exception/Handler.php - About 1 hr to fix

                Method decorate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function decorate($value, $safe = false)
                    {
                        if (is_string($value)) {
                            if (strpos($value, 'js:') === 0 && $safe === false)
                                return substr($value, 3);
                Severity: Minor
                Found in src/utils/asset/src/JavaScriptDecorator.php - About 1 hr to fix

                  Function getPatterned has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getPatterned($value)
                      {
                          if (!is_array($value)) {
                              return str_replace('%value', ucfirst($value), $this->pattern);
                          } else {
                  Severity: Minor
                  Found in src/ui/components/datatables/src/Filter/AbstractFilter.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 requireJs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function requireJs()
                      {
                          $scripts = $this->dispatcher->scripts('script', $this->assets, $this->path);
                  
                          $required = [];
                  Severity: Minor
                  Found in src/utils/asset/src/Asset.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 beforeTable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function beforeTable()
                      {
                          $hasMassActions  = $this->hasMassActions();
                          $filters         = $this->filterAdapter->getFilters();
                          $hasColumnFilter = $this->hasColumnFilter();
                  Severity: Minor
                  Found in src/ui/components/datatables/src/Html/Builder.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 findExtensions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function findExtensions(): Extensions
                      {
                          $extensions = new Extensions();
                  
                  
                  
                  Severity: Minor
                  Found in src/components/extension/src/FilesystemFinder.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 smtp has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function smtp(array $data = null)
                      {
                          $valid = true;
                          foreach (['email_address', 'email_host', 'email_port', 'email_username', 'email_password', 'email_encryption'] as $key) {
                  
                  
                  Severity: Minor
                  Found in src/foundation/src/Tester/ConnectionTester.php - About 1 hr to fix

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

                        public function run(OperationHandlerContract $handler, ExtensionContract $extension, array $flags = []) {
                            try {
                                $name = $extension->getPackage()->getName();
                    
                                if($this->componentsRepository->isRequired($name)) {
                    Severity: Minor
                    Found in src/components/extension/src/Processors/Uninstaller.php - About 1 hr to fix

                      Method customfieldsByFieldset has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function customfieldsByFieldset($grid, $name)
                          {
                              if (!extension_active('customfields')) {
                                  return;
                              }
                      Severity: Minor
                      Found in src/components/html/src/Form/Fieldset.php - About 1 hr to fix

                        Method up has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function up()
                            {
                                DB::transaction(function() {
                                    $datetime = Carbon::now();
                                    DB::table('tbl_roles')->insert([

                          Method adapt has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function adapt(Grid &$grid)
                              {
                                  $this->grid   = $grid;
                                  $customfields = app('customfields')->get();
                                  if (empty($customfields)) {
                          Severity: Minor
                          Found in src/components/html/src/Adapter/CustomfieldAdapter.php - About 1 hr to fix

                            Method up has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function up()
                                {
                                    $this->down();
                                    Schema::create('tbl_brand_options', function(Blueprint $table) {
                                        $table->increments('id')->unsigned();
                              Severity
                              Category
                              Status
                              Source
                              Language