antaresproject/core

View on GitHub

Showing 306 of 306 total issues

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

    public function finish(array $items = [])
    {
        $changed = false;
        foreach ($items as $key => $value) {
            $isNew = $this->isNewKey($key);
Severity: Major
Found in src/components/html/src/Memory/Handler.php and 1 other location - About 2 hrs to fix
src/components/html/src/Memory/Config.php on lines 169..186

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

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

QueryBuilderEngine has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class QueryBuilderEngine extends BaseEngine
{

    /**
     * @param \Illuminate\Database\Query\Builder $builder
Severity: Minor
Found in src/ui/components/datatables/src/Engines/QueryBuilderEngine.php - About 2 hrs to fix

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

        protected function resolveTempFileName(UploadedFile $file)
        {
            $name      = $file->getClientOriginalName();
            $extension = File::extension($name);
            $subdir    = sha1(time());
    Severity: Major
    Found in src/foundation/src/Traits/UploadableTrait.php and 1 other location - About 2 hrs to fix
    src/foundation/src/Processor/Extension/ModuleConfigure.php on lines 176..184

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

    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 resolveTempFileName(UploadedFile $file)
        {
            $name      = $file->getClientOriginalName();
            $extension = File::extension($name);
            $subdir    = sha1(time());
    Severity: Major
    Found in src/foundation/src/Processor/Extension/ModuleConfigure.php and 1 other location - About 2 hrs to fix
    src/foundation/src/Traits/UploadableTrait.php on lines 42..50

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

    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

    Function resolveFieldValue has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function resolveFieldValue($name, $row, Fluent $control)
        {
            if (ends_with($name, '[]')) {
                $fieldnameInRequest = str_replace('[]', '', $name);
                $oldRequest         = $this->request->old($fieldnameInRequest);
    Severity: Minor
    Found in src/components/html/src/Form/Control.php - About 2 hrs 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 validateSource has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validateSource($attribute, $value, $parameters)
        {
            $name      = $value->getClientOriginalName();
            $directory = $value->directory;
            $filename  = $value->filename;
    Severity: Minor
    Found in src/foundation/src/Validation/CustomModule.php - About 2 hrs 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 render has 51 lines of code (exceeds 25 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: Major
    Found in src/components/html/src/Form/FormBuilder.php - About 2 hrs to fix

      Method validateSource has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function validateSource($attribute, $value, $parameters)
          {
              $name      = $value->getClientOriginalName();
              $directory = $value->directory;
              $filename  = $value->filename;
      Severity: Major
      Found in src/foundation/src/Validation/CustomModule.php - About 2 hrs to fix

        Method filtering has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function filtering()
            {
                $this->query->where(
                        function ($query) {
                    $globalKeyword = $this->setupKeyword($this->request->keyword());
        Severity: Minor
        Found in src/ui/components/datatables/src/Engines/QueryBuilderEngine.php - About 1 hr to fix

          Method fieldset has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function fieldset()
              {
          
                  return $this->grid->fieldset('user-fieldset', function (Fieldset $fieldset) {
                              $fieldset->control('input:text', 'email')
          Severity: Minor
          Found in src/foundation/src/Http/Form/User.php - About 1 hr to fix

            Method mailer has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function mailer($model)
                {
            
                    return $this->grid->fieldset(trans('antares/foundation::label.settings.mail'), function (Fieldset $fieldset) use ($model) {
                                $fieldset->legend('Mail configuration');
            Severity: Minor
            Found in src/foundation/src/Http/Form/Mail.php - About 1 hr to fix

              Function ordering has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function ordering()
                  {
                      if ($this->orderCallback) {
                          call_user_func($this->orderCallback, $this->getQueryBuilder());
              
              
              Severity: Minor
              Found in src/ui/components/datatables/src/Engines/QueryBuilderEngine.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 schedule has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function schedule(Schedule $schedule)
                  {
                      if (!extension_active('automation')) {
                          return false;
                      }
              Severity: Minor
              Found in src/components/console/src/Kernel.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 form has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function form(array $configuration = array())
                  {
              
                      Event::fire('antares.forms', 'commands.' . $this->name);
              
              
              Severity: Minor
              Found in src/components/view/src/Console/Command.php - About 1 hr to fix

                Method getFilters has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getFilters()
                    {
                        $str = new Twig_SimpleFilter(
                                'str_*', function ($name) {
                            $arguments = array_slice(func_get_args(), 1);
                Severity: Minor
                Found in src/utils/twig/Extension/Foundation.php - About 1 hr to fix

                  Function attachRules has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function attachRules(&$grid, array $rules = null)
                      {
                          $fieldsets = $grid->fieldsets();
                  
                          if (!empty(Input::get('ajax')) && Request::ajax() && !is_null($key = Input::get('key'))) {
                  Severity: Minor
                  Found in src/components/html/src/Form/ClientScript.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 up has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function up()
                      {
                          $this->down();
                          Schema::create('tbl_widgets', function(Blueprint $table) {
                              $table->increments('id');

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

                                    if (count(explode('.', $column)) > 1) {
                                        $eagerLoads     = $this->getEagerLoads();
                                        $parts          = explode('.', $column);
                                        $relationColumn = array_pop($parts);
                                        $relation       = implode('.', $parts);
                    src/ui/components/datatables/src/Engines/QueryBuilderEngine.php on lines 437..446

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

                    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

                                    if (count(explode('.', $column)) > 1) {
                                        $eagerLoads     = $this->getEagerLoads();
                                        $parts          = explode('.', $column);
                                        $relationColumn = array_pop($parts);
                                        $relation       = implode('.', $parts);
                    src/ui/components/datatables/src/Engines/QueryBuilderEngine.php on lines 329..337

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

                    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 prepareToSave has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function prepareToSave($classname, array $params = [], array $paramsFromSession = null)
                        {
                            $column = $params['column'];
                            $return = [];
                            if (is_null($paramsFromSession)) {
                    Severity: Minor
                    Found in src/foundation/src/Processor/FilterProcessor.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language