iranianpep/code-jetter

View on GitHub

Showing 1,173 of 1,173 total issues

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.affix')
      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 2008..2017

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

Method testGetFieldsValues has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function testGetFieldsValues()
    {
        $utility = new InputUtility();

        $requiredRule = new ValidatorRule('required');
Severity: Major
Found in tests/InputUtilityTest.php - About 3 hrs to fix

    Function authorizeRoute has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        public function authorizeRoute($accessRole, $rootNamespace, $component, $controller, $redirect = true)
        {
            $roles = Registry::getConfigClass()->get('roles');
            $redirections = Registry::getConfigClass()->get('redirections');
    
    
    Severity: Minor
    Found in core/Router.php - About 3 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

    File BaseMapperTest.php has 328 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace CodeJetter\tests;
    
    use CodeJetter\components\geolocation\mappers\StateMapper;
    Severity: Minor
    Found in tests/BaseMapperTest.php - About 3 hrs to fix

      Function update has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function update(
              array $criteria,
              array $inputs,
              array $fieldsValues,
              $limit = 0,
      Severity: Minor
      Found in components/user/mappers/MemberUserMapper.php - About 3 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 getAllLoggedIn has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAllLoggedIn(array $whiteList = null)
          {
              if (!isset($_SESSION['loggedIn']) || empty($_SESSION['loggedIn']) || !is_array($_SESSION['loggedIn'])) {
                  return false;
              }
      Severity: Minor
      Found in components/user/services/UserAuthentication.php - About 3 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 batchBindValues has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function batchBindValues(
              \PDOStatement $statement,
              array $criteria,
              $start = 0,
              $limit = 0,
      Severity: Minor
      Found in core/database/QueryMaker.php - About 3 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

      File UserMapper.php has 314 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace CodeJetter\components\user\mappers;
      
      use CodeJetter\components\user\models\User;
      Severity: Minor
      Found in components/user/mappers/UserMapper.php - About 3 hrs to fix

        File Routes.Template.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace CodeJetter;
        
        class RoutesTemplate
        Severity: Minor
        Found in Routes.Template.php - About 3 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.alert')
          
          
          Severity: Major
          Found in public/scripts/bootstrap.js and 1 other location - About 3 hrs to fix
          public/scripts/bootstrap.js on lines 874..882

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

          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.dropdown')
          
          
          Severity: Major
          Found in public/scripts/bootstrap.js and 1 other location - About 3 hrs to fix
          public/scripts/bootstrap.js on lines 142..150

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

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

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

            Method testValidateMoney has 87 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method checkURL has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function checkURL($url, array $options = [])
                  {
                      if (empty($url)) {
                          throw new \Exception('URL is empty');
                      }
              Severity: Major
              Found in core/utility/HTTPUtility.php - About 3 hrs to fix

                The class AdminUserController has 17 public methods. Consider refactoring AdminUserController to keep number of public methods under 10.
                Open

                class AdminUserController extends BaseController
                {
                    /**
                     * Generate login form.
                     *

                TooManyPublicMethods

                Since: 0.1

                A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                The class ValidatorTest has 13 public methods. Consider refactoring ValidatorTest to keep number of public methods under 10.
                Open

                class ValidatorTest extends \PHPUnit_Framework_TestCase
                {
                    public function testValidateEmail()
                    {
                        $app = App::getInstance();
                Severity: Minor
                Found in tests/ValidatorTest.php by phpmd

                TooManyPublicMethods

                Since: 0.1

                A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                The class HtmlUtility has an overall complexity of 66 which is very high. The configured complexity threshold is 50.
                Open

                class HtmlUtility
                {
                    /**
                     * HtmlUtility constructor.
                     */
                Severity: Minor
                Found in core/utility/HtmlUtility.php by phpmd

                The class MemberUserController has 17 public methods. Consider refactoring MemberUserController to keep number of public methods under 10.
                Open

                class MemberUserController extends BaseController
                {
                    /**
                     * Generate register form.
                     *

                TooManyPublicMethods

                Since: 0.1

                A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                The class BaseMapper has 13 public methods. Consider refactoring BaseMapper to keep number of public methods under 10.
                Open

                abstract class BaseMapper extends Base implements ICrud
                {
                    protected $database;
                    protected $table;
                    protected $modelName;
                Severity: Minor
                Found in core/BaseMapper.php by phpmd

                TooManyPublicMethods

                Since: 0.1

                A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

                By default it ignores methods starting with 'get' or 'set'.

                Example

                Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

                The class UserMapper has an overall complexity of 75 which is very high. The configured complexity threshold is 50.
                Open

                abstract class UserMapper extends BaseMapper
                {
                    /**
                     * @param      $email
                     * @param null $parentId
                Severity
                Category
                Status
                Source
                Language