antaresproject/core

View on GitHub

Showing 306 of 306 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    protected function validate(array $data = array())
    {
        $id = auth()->user()->id;
        if (empty($data)) {
            return false;
Severity: Major
Found in src/components/auth/src/Auth/Multiuser.php and 1 other location - About 1 hr to fix
src/components/auth/src/Auth/Composers/MultiuserPlaceholder.php on lines 80..95

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    protected function validate(array $data = array())
    {
        $id = auth()->user()->id;
        if (empty($data)) {
            return false;
src/components/auth/src/Auth/Multiuser.php on lines 36..51

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 108.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          public function __construct($name, array $config, Container $repository, Repository $cache)
          {
              parent::__construct($name, $config);
              $this->repository = $repository;
              if (Arr::get($this->config, 'cache', false)) {
      Severity: Major
      Found in src/components/html/src/Memory/Config.php and 1 other location - About 1 hr to fix
      src/components/html/src/Memory/Handler.php on lines 71..80

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 107.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          public function __construct($name, array $config, Container $repository, Repository $cache)
          {
              parent::__construct($name, $config);
              $this->repository = $repository;
              if (Arr::get($this->config, 'cache', false)) {
      Severity: Major
      Found in src/components/html/src/Memory/Handler.php and 1 other location - About 1 hr to fix
      src/components/html/src/Memory/Config.php on lines 70..78

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 107.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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();

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

                  public function run(OperationHandlerContract $handler, array $extensionsNames)
                  {
                      if (count($extensionsNames) === 0) {
                          return $handler->operationInfo(new Operation('No extensions to install. Skipping composer.'));
                      }
              Severity: Minor
              Found in src/components/extension/src/Processors/Composer.php - About 1 hr to fix

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

                    public function customfield($grid, $name)
                    {
                        if (!extension_active('customfields')) {
                            return;
                        }
                Severity: Minor
                Found in src/components/html/src/Form/Fieldset.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 dumpManagerAssets has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function dumpManagerAssets(AssetManager $am)
                    {
                        foreach ($am->getNames() as $name) {
                            $asset = $am->get($name);
                            if ($am instanceof LazyAssetManager) {
                Severity: Minor
                Found in src/utils/asset/src/Dumper.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 getPolicyColumn has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function getPolicyColumn(Model $model)
                    {
                
                        $connection = $model->getConnection();
                        $table      = $connection->getTablePrefix() . $model->getTable();
                Severity: Minor
                Found in src/utils/security/src/Scope/AccessScope.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 lookInDeep has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function lookInDeep(array $elements, $after, $item, &$buffer = [], &$return = '', $current = null)
                    {
                        $branch = array();
                
                        foreach ($elements as $key => $element) {
                Severity: Minor
                Found in src/components/support/src/Support/Nesty.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function render()
                    {
                        if ($this->value) {
                            foreach ($this->valueOptions as $option) {
                                if ($option instanceof Option) {
                Severity: Minor
                Found in src/utils/form/src/Controls/SelectType.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 resolveFields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function resolveFields(Collection $fieldsets, $key = null)
                    {
                        $name          = $fieldsets->first()->name;
                        $name instanceof \Closure and $name          = sprintf('fieldset-%d', $fieldsets->count());
                        $formName      = str_slug($name);
                Severity: Minor
                Found in src/components/html/src/Adapter/FieldPermissionAdapter.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 render has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function render()
                    {
                        if ($this->value) {
                            foreach ($this->valueOptions as $option) {
                                if ($option instanceof Option) {
                Severity: Minor
                Found in src/utils/form/src/Controls/MultiCheckboxType.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 detectUiComponents has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function detectUiComponents()
                    {
                        $components  = [];
                        $factory     = app('antares.extension');
                        $directories = [];
                Severity: Minor
                Found in src/ui/components/templates/src/Finder.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 getConfigurable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getConfigurable($group = null)
                    {
                        if (empty($this->configurable)) {
                            foreach ($this->customfields as $category => $customfield) {
                                foreach ($customfield as $field) {
                Severity: Minor
                Found in src/components/html/src/CustomfieldsFinder.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

                Severity
                Category
                Status
                Source
                Language