Juniorsz/easy-repository

View on GitHub

Showing 13 of 13 total issues

BaseRepository has 74 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class BaseRepository implements RepositoryInterface, CriteriaInterface
{

    use HandleCache;

Severity: Major
Found in src/Repositories/Eloquent/BaseRepository.php - About 1 day to fix

    File BaseRepository.php has 461 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace VyDev\Repositories\Eloquent;
    
    use Illuminate\Support\Arr;
    Severity: Minor
    Found in src/Repositories/Eloquent/BaseRepository.php - About 7 hrs to fix

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

      <?php
      
      namespace VyDev\Commands\Build;
      
      use VyDev\Commands\BaseCommand;
      Severity: Major
      Found in src/Commands/Build/MakeCriteria.php and 1 other location - About 4 hrs to fix
      src/Commands/Build/MakeFormatter.php on lines 1..28

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

      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

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

      <?php
      
      namespace VyDev\Commands\Build;
      
      use VyDev\Commands\BaseCommand;
      Severity: Major
      Found in src/Commands/Build/MakeFormatter.php and 1 other location - About 4 hrs to fix
      src/Commands/Build/MakeCriteria.php on lines 1..28

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

      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

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

          public function setRepositoryClass()
          {
              $name = ucwords($this->argument('name'));
              $regex = explode('/',$name);
              $modelName = $regex[count($regex) - 1];
      Severity: Major
      Found in src/Commands/MakeCriteria.php and 1 other location - About 3 hrs to fix
      src/Commands/MakeRepository.php on lines 73..88

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

      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

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

          public function setRepositoryClass()
          {
              $name = ucwords($this->argument('name'));
              $regex = explode('/',$name);
              $modelName = $regex[count($regex) - 1];
      Severity: Major
      Found in src/Commands/MakeRepository.php and 1 other location - About 3 hrs to fix
      src/Commands/MakeCriteria.php on lines 60..75

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

      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 buildCommand has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function buildCommand()
          {
              if($this->getConfig()) {
                  $this->setRepositoryClass();
                  $path = $this->getPath($this->config[$this->tag]);
      Severity: Minor
      Found in src/Commands/Build/MakeRepository.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 filterAttributes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function filterAttributes($model,$findSearchCriteria)
          {
              $filterKeys = app()->request->{$this->config['filter']};
      
              if($findSearchCriteria->count() >= 1)
      Severity: Minor
      Found in src/Repositories/Criteria/AdvancedSearchCriteria.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 filterAttributes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function filterAttributes($model,$findSearchCriteria)
          {
              $filterKeys = app()->request->{$this->config['filter']};
      
              if($findSearchCriteria->count() >= 1)
      Severity: Minor
      Found in src/Repositories/Criteria/AdvancedSearchCriteria.php - About 1 hr to fix

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

            public function handle()
            {
                if($this->getConfig())
                {
                    $this->setRepositoryClass();
        Severity: Minor
        Found in src/Commands/MakeRepository.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

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

            public function getConfig()
            {
                if(!file_exists(base_path()."/config/repositories.php"))
                {
                    $this->error("Can not found config/repositories. Have you published provider yet ?");
        Severity: Minor
        Found in src/Commands/MakeRepository.php and 1 other location - About 40 mins to fix
        src/Commands/MakeCriteria.php on lines 46..59

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

        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 getConfig()
            {
                if(!file_exists(base_path()."/config/repositories.php"))
                {
                    $this->error("Can not found config/repositories. Have you published provider yet ?");
        Severity: Minor
        Found in src/Commands/MakeCriteria.php and 1 other location - About 40 mins to fix
        src/Commands/MakeRepository.php on lines 59..72

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

        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 apply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function apply($model,RepositoryInterface $repository)
            {   
                $search = config('repositories.parameters.search');
        
                if($this->request->get($search))
        Severity: Minor
        Found in src/Repositories/Criteria/AdvancedSearchCriteria.php - About 35 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