antaresproject/core

View on GitHub

Showing 306 of 306 total issues

Function apply has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function apply(Builder $builder, Model $model)
    {
        $column = $this->getPolicyColumn($model);
        if (is_null($column) && get_class($model) !== \Antares\Model\User::class) {
            return;
Severity: Minor
Found in src/utils/security/src/Scope/AccessScope.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 handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        if (!$this->passesAuthorization()) {
            return;
        }
Severity: Minor
Found in src/ui/components/templates/src/Http/Handlers/ComponentsSelector.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

Avoid deeply nested control flow statements.
Open

                            for (;;) {
                                $this->output .= $this->a;
                                $this->a = $this->get();
                                $pattern .= $this->a;
                                if ($this->a === ']') {
Severity: Major
Found in src/utils/asset/src/JSMin.php - About 45 mins to fix

    Function clientSubmit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function clientSubmit($buttons)
        {
            if (empty($buttons)) {
                return false;
            }
    Severity: Minor
    Found in src/components/html/src/Form/FormBuilder.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 resolveDependenciesForAsset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function resolveDependenciesForAsset(&$assets, $asset, $replaces)
        {
            foreach ($assets as $name => $value) {
                $changed = false;
    
    
    Severity: Minor
    Found in src/utils/asset/src/DependencyResolver.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 generateScripts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generateScripts()
        {
    
            app('antares.asset')->container('antares/foundation::application')
                    ->add('gridstack', '/webpack/view_datatables.js', ['webpack_gridstack', 'app_cache'])
    Severity: Minor
    Found in src/ui/components/datatables/src/Html/Builder.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 isActive has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isActive()
        {
            if (!isset($this->attributes['link'])) {
                return false;
            }
    Severity: Minor
    Found in src/components/support/src/Support/Fluent.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 validateRequest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function validateRequest(Request $request)
        {
            if (php_sapi_name() === 'cli') {
                return false;
            }
    Severity: Minor
    Found in src/ui/components/templates/src/Http/Middleware/Middleware.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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __construct(Application $app, Router $router, Request $request, UrlGenerator $url)
        {
            $this->app     = $app;
            $this->router  = $router;
            $this->request = $request;
    Severity: Minor
    Found in src/ui/components/datatables/src/Adapter/FilterAdapter.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 isRegexpLiteral has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function isRegexpLiteral()
        {
            if (false !== strpos("(,=:[!&|?+-~*{;", $this->a)) {
                // we can't divide after these tokens
                return true;
    Severity: Minor
    Found in src/utils/asset/src/JSMin.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

    Method lookInDeep has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function lookInDeep(array $elements, $after, $item, &$buffer = [], &$return = '', $current = null)
    Severity: Minor
    Found in src/components/support/src/Support/Nesty.php - About 45 mins to fix

      Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function render($object = false)
          {
              $output = array_merge([
                  'draw'            => (int) $this->request['draw'],
                  'recordsTotal'    => $this->totalRecords,
      Severity: Minor
      Found in src/ui/components/datatables/src/Engines/BaseEngine.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

      Method register has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          protected function register($type, $name, $source, $dependencies, $attributes, $replaces)
      Severity: Minor
      Found in src/utils/asset/src/Asset.php - About 45 mins to fix

        Function finish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function finish(array $items = [])
            {
                $changed = false;
                if (!isset($items['terminate'])) {
                    $items = array_dot($items);
        Severity: Minor
        Found in src/components/memory/src/Handlers/Primary.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

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

                ComposerHandler $composerHandler,
                Container $container,
                Dispatcher $dispatcher,
                Kernel $kernel,
                ExtensionsRepository $extensionsRepository,
        Severity: Minor
        Found in src/components/extension/src/Processors/Uninstaller.php - About 45 mins to fix

          Function finish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function finish(array $items = [])
              {
                  $changed = false;
          
                  foreach ($items as $key => $value) {
          Severity: Minor
          Found in src/components/memory/src/DatabaseHandler.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 push has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function push($message)
              {
                  $addresses = $message->getTo();
                  $body      = $message->getContent();
                  $params    = array(
          Severity: Minor
          Found in src/components/notifier/src/Adapter/FastSmsAdapter.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

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

                  Container $container,
                  Dispatcher $dispatcher,
                  Kernel $kernel,
                  ExtensionsRepository $extensionsRepository,
                  Migration $aclMigration,
          Severity: Minor
          Found in src/components/extension/src/Processors/Deactivator.php - About 45 mins to fix

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

                public function __construct(Container $container, Dispatcher $dispatcher, Kernel $kernel, ExtensionsRepository $extensionsRepository, Acl $aclMigration, ComponentsRepository $componentsRepository)
            Severity: Minor
            Found in src/components/extension/src/Processors/Activator.php - About 45 mins to fix

              Function whenValidated has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function whenValidated($messageBag, $sendHeaders)
                  {
                      $messages = empty($messageBag) ? [] : $messageBag->getMessages();
                      if ($this->request->ajax() && $sendHeaders) {
                          $return = [];
              Severity: Minor
              Found in src/components/html/src/Validation/Validator.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

              Severity
              Category
              Status
              Source
              Language