antaresproject/core

View on GitHub

Showing 306 of 306 total issues

Avoid too many return statements within this method.
Open

                return $this->renderSourceCode($fileName, $errorLine, $maxLines);
Severity: Major
Found in src/components/exception/Handler.php - About 30 mins to fix

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

        protected function component()
        {
    
            $function = function ($params) {
                if (($classname = $this->validate($params)) === false) {
    Severity: Minor
    Found in src/ui/components/templates/src/Twig/Component.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 getFilters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getFilters($view = null)
        {
            if (!$this->filters) {
                return false;
            }
    Severity: Minor
    Found in src/ui/components/datatables/src/Adapter/FilterAdapter.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 replaceAssetDependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function replaceAssetDependencies(&$assets)
        {
            foreach ($assets as $asset => $value) {
                if (empty($replaces = $value['replaces'])) {
                    continue;
    Severity: Minor
    Found in src/utils/asset/src/DependencyResolver.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 consumeSingleLineComment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function consumeSingleLineComment()
        {
            $comment = '';
            while (true) {
                $get = $this->get();
    Severity: Minor
    Found in src/utils/asset/src/JSMin.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 getBlock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getBlock($key, $default = null)
        {
            if (!isset($this->attributes['block'])) {
                return $default;
            }
    Severity: Minor
    Found in src/components/html/src/Form/Field.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 rules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function rules(Collection $fieldsets)
        {
            $grid = $this->grid;
            if (!empty($grid->rules)) {
                $controls = [];
    Severity: Minor
    Found in src/components/html/src/Form/FormBuilder.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render()
        {
            app('antares.asset')->container('antares/foundation::application')->add('webpack_forms_basic', '/webpack/forms_basic.js', ['app_cache']);
            $grid   = $this->grid;
            $action = '';
    Severity: Minor
    Found in src/components/html/src/Form/FormBuilder.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 compileColumnQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function compileColumnQuery($query, $method, $parameters, $column, $keyword)
        {
            if (method_exists($query, $method) && count($parameters) <= with(new \ReflectionMethod($query, $method))->getNumberOfParameters()
            ) {
                if (Str::contains(Str::lower($method), 'raw') || Str::contains(Str::lower($method), 'exists')
    Severity: Minor
    Found in src/ui/components/datatables/src/Engines/QueryBuilderEngine.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 evaluateAssetWithDependencies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function evaluateAssetWithDependencies($asset, $original, &$sorted, &$assets)
        {
            foreach ($assets[$asset]['dependencies'] as $key => $dependency) {
                if (! $this->dependencyIsValid($asset, $dependency, $original, $assets)) {
                    unset($assets[$asset]['dependencies'][$key]);
    Severity: Minor
    Found in src/utils/asset/src/DependencyResolver.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 crypt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function crypt($action, $string)
        {
            if (!array_get($this->config, 'enabled')) {
                return $string;
            }
    Severity: Minor
    Found in src/utils/security/src/Database/Cryptor.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 compare has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function compare($url)
        {
    
            if ($this->url == $url) {
                return true;
    Severity: Minor
    Found in src/components/support/src/Support/Fluent.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 beforeSendPerformed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function beforeSendPerformed(Swift_Events_SendEvent $evt)
        {
            $message = $evt->getMessage();
    
            $converter = new CssToInlineStyles();
    Severity: Minor
    Found in src/components/notifier/src/Plugins/CssInliner.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate($sendHeaders = true)
        {
            app('events')->fire('antares.form: validate', $this->grid);
            $inputs          = Input::all();
            $messages        = null;
    Severity: Minor
    Found in src/components/html/src/Validation/Validator.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 getAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getAll($brandId = null)
        {
            $columns = ['id', 'vendor', 'name', 'status', 'actions', 'permissions', 'options'];
            $builder = (!is_null($brandId)) ? static::select($columns)->where('brand_id', '=', $brandId)->orWhere('brand_id') : static::select($columns);
            $models  = $builder->with(['attachedActions'])->get();
    Severity: Minor
    Found in src/components/memory/src/Model/Permission.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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle()
        {
            if ($this->isCli()) {
                $artisan = base_path('artisan');
                while (true) {
    Severity: Minor
    Found in src/foundation/src/Console/Commands/QueueCommand.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 obfuscate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function obfuscate($value)
        {
            $safe = '';
    
            foreach (str_split($value) as $letter) {
    Severity: Minor
    Found in src/components/html/src/Support/Traits/ObfuscateTrait.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 handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function handle(Manager $manager)
        {
    
            $extensionName = $this->argument('extension');
            if ($extensionName) {
    Severity: Minor
    Found in src/components/extension/src/Console/AclCommand.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 import has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function import(OperationHandlerContract $handler, ExtensionContract $extension, bool $reload = false)
        {
            $name     = $extension->getPackage()->getName();
            $filePath = $extension->getPath() . '/acl.php';
            if (!File::exists($filePath)) {
    Severity: Minor
    Found in src/components/extension/src/Processors/Acl.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 getAvailableExtensions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getAvailableExtensions(): Extensions
        {
            if ($this->availableExtensions instanceof Extensions) {
                return $this->availableExtensions;
            }
    Severity: Minor
    Found in src/components/extension/src/Manager.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