iranianpep/code-jetter

View on GitHub

Showing 1,173 of 1,173 total issues

Method testRegexMatch has 135 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testRegexMatch()
    {
        $app = App::getInstance();
        $app->init('dev');

Severity: Major
Found in tests/RouterTest.php - About 5 hrs to fix

    Validator has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Validator
    {
        /**
         * @var array
         */
    Severity: Minor
    Found in core/security/Validator.php - About 5 hrs to fix

      Method testGetAccessRole has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testGetAccessRole()
          {
              $app = App::getInstance();
              $app->init('dev');
      
      
      Severity: Major
      Found in tests/RouterTest.php - About 5 hrs to fix

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

            public function insertOne(array $fieldsValues)
            {
                // generate the query
                $query = (new QueryMaker($this->getTable()))->insertQuery($fieldsValues);
        
        
        Severity: Major
        Found in core/BaseMapper.php and 1 other location - About 5 hrs to fix
        core/BaseMapper.php on lines 469..497

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

        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 batchInsert(array $fieldsValuesCollection)
            {
                // generate the query
                $query = (new QueryMaker($this->getTable()))->batchInsertQuery($fieldsValuesCollection);
        
        
        Severity: Major
        Found in core/BaseMapper.php and 1 other location - About 5 hrs to fix
        core/BaseMapper.php on lines 432..460

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

        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

        File QueryMaker.php has 380 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace CodeJetter\core\database;
        
        use CodeJetter\core\utility\MysqlUtility;
        Severity: Minor
        Found in core/database/QueryMaker.php - About 5 hrs to fix

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

            function Plugin(option) {
              return this.each(function () {
                var $this   = $(this)
                var data    = $this.data('bs.tooltip')
                var options = typeof option == 'object' && option
          Severity: Major
          Found in public/scripts/bootstrap.js and 1 other location - About 5 hrs to fix
          public/scripts/bootstrap.js on lines 1845..1855

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

          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

            function Plugin(option) {
              return this.each(function () {
                var $this   = $(this)
                var data    = $this.data('bs.popover')
                var options = typeof option == 'object' && option
          Severity: Major
          Found in public/scripts/bootstrap.js and 1 other location - About 5 hrs to fix
          public/scripts/bootstrap.js on lines 1736..1746

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

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

              public function testGenerateDropDownList()
              {
                  $utility = new HtmlUtility();
          
                  $ios = [
          Severity: Major
          Found in tests/HtmlUtilityTest.php - About 5 hrs to fix

            Function getFieldsValues has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getFieldsValues(array $inputs, array $definedInputs, $case, array $columnsWhitelist = [])
                {
                    $fieldsValues = [];
                    if (!empty($definedInputs)) {
                        foreach ($definedInputs as $definedInput) {
            Severity: Minor
            Found in core/utility/InputUtility.php - About 4 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

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

                public function resetPasswordForm()
                {
                    $inputs = $this->getURLParameters();
                    $output = (new MemberUser())->checkTokenIsValidByEmail($inputs['email'], $inputs['token']);
            
            
            Severity: Major
            Found in components/user/controllers/MemberUserController.php and 1 other location - About 4 hrs to fix
            components/user/controllers/AdminUserController.php on lines 579..604

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

            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 resetPasswordForm()
                {
                    $inputs = $this->getURLParameters();
                    $output = (new AdminUser())->checkTokenIsValidByEmail($inputs['email'], $inputs['token']);
            
            
            Severity: Major
            Found in components/user/controllers/AdminUserController.php and 1 other location - About 4 hrs to fix
            components/user/controllers/MemberUserController.php on lines 343..368

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

            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

            BaseMapper has 36 functions (exceeds 20 allowed). Consider refactoring.
            Open

            abstract class BaseMapper extends Base implements ICrud
            {
                protected $database;
                protected $table;
                protected $modelName;
            Severity: Minor
            Found in core/BaseMapper.php - About 4 hrs to fix

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

                  public function safeDeleteMember()
                  {
                      $inputs = (new Request('POST'))->getInputs();
              
                      if (!empty($inputs['id'])) {
              Severity: Major
              Found in components/user/controllers/AdminUserController.php and 1 other location - About 4 hrs to fix
              components/user/controllers/MemberGroupController.php on lines 150..179

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

              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 safeDeleteGroup()
                  {
                      $inputs = (new Request('POST'))->getInputs();
              
                      if (!empty($inputs['id'])) {
              Severity: Major
              Found in components/user/controllers/MemberGroupController.php and 1 other location - About 4 hrs to fix
              components/user/controllers/AdminUserController.php on lines 211..242

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

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

                  public function update(
                      array $criteria,
                      array $inputs,
                      array $fieldsValues,
                      $limit = 0,
              Severity: Minor
              Found in components/user/mappers/UserMapper.php - About 4 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 testPluralToSingular has 114 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testPluralToSingular()
                  {
                      $utility = new StringUtility();
              
                      $inputOutputs = [
              Severity: Major
              Found in tests/StringUtilityTest.php - About 4 hrs to fix

                Method testSingularToPlural has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function testSingularToPlural()
                    {
                        $utility = new StringUtility();
                
                        $inputOutputs = [
                Severity: Major
                Found in tests/StringUtilityTest.php - About 4 hrs to fix

                  Function bindCriteria has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function bindCriteria(\PDOStatement $statement, array $criteria)
                      {
                          // bind criteria values
                          if (!empty($criteria)) {
                              $counter = 0;
                  Severity: Minor
                  Found in core/database/QueryMaker.php - About 4 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

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

                    function Plugin(option) {
                      return this.each(function () {
                        var $this   = $(this)
                        var data    = $this.data('bs.scrollspy')
                        var options = typeof option == 'object' && option
                  Severity: Major
                  Found in public/scripts/bootstrap.js and 1 other location - About 4 hrs to fix
                  public/scripts/bootstrap.js on lines 2320..2329

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language