vijos/openvj

View on GitHub

Showing 103 of 103 total issues

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

    public function testGetNoSSLTrueVisitHttpsFromBrowser()
    {
        foreach ($this->ua_https as $ua) {
            $request = $this->getRequest($ua, true, ['nossl' => 'on']);
            $response = new Response();
Severity: Major
Found in src/Test/EventListener/HttpsRedirectionServiceTest.php and 1 other location - About 5 hrs to fix
src/Test/EventListener/HttpsRedirectionServiceTest.php on lines 152..171

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

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 testGetNoSSLTrueVisitHttpFromBrowser()
    {
        foreach ($this->ua_https as $ua) {
            $request = $this->getRequest($ua, false, ['nossl' => 'on']);
            $response = new Response();
Severity: Major
Found in src/Test/EventListener/HttpsRedirectionServiceTest.php and 1 other location - About 5 hrs to fix
src/Test/EventListener/HttpsRedirectionServiceTest.php on lines 173..192

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

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 CommentUtil.php has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This file is part of openvj project.
 *
 * Copyright 2013-2015 openvj dev team.
Severity: Minor
Found in src/Comment/CommentUtil.php - About 5 hrs to fix

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

        public function testCheckPasswordCredentialUserNotExist()
        {
            $throw = false;
            try {
                Application::get('user_credential')->checkPasswordCredential('test', '', true);
    Severity: Major
    Found in src/Test/User/UserCredentialTest.php and 1 other location - About 4 hrs to fix
    src/Test/User/UserCredentialTest.php on lines 102..122

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

    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 testCheckPasswordCredentialWrongPassword()
        {
            $throw = false;
            try {
                Application::get('user_credential')->checkPasswordCredential('Test_user', 'test_wrong_password', true);
    Severity: Major
    Found in src/Test/User/UserCredentialTest.php and 1 other location - About 4 hrs to fix
    src/Test/User/UserCredentialTest.php on lines 81..100

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

    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 3 locations. Consider refactoring.
    Open

        public function testEnforceHttpsTrueFromSpider()
        {
            $request = new Request(['id' => '100'], [], [], [], [], [
                'PHP_SELF' => '/app.php',
                'REQUEST_METHOD' => 'GET',
    Severity: Major
    Found in src/Test/EventListener/VJRedirectionServiceTest.php and 2 other locations - About 4 hrs to fix
    src/Test/EventListener/VJRedirectionServiceTest.php on lines 23..40
    src/Test/EventListener/VJRedirectionServiceTest.php on lines 60..76

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

    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 3 locations. Consider refactoring.
    Open

        public function testEnforceHttpsTrueFromBrowser()
        {
            // enforce_https = true
            $request = new Request(['id' => '100'], [], [], [], [], [
                'PHP_SELF' => '/app.php',
    Severity: Major
    Found in src/Test/EventListener/VJRedirectionServiceTest.php and 2 other locations - About 4 hrs to fix
    src/Test/EventListener/VJRedirectionServiceTest.php on lines 42..58
    src/Test/EventListener/VJRedirectionServiceTest.php on lines 60..76

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

    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 3 locations. Consider refactoring.
    Open

        public function testEnforceHttpsFalse()
        {
            $request = new Request(['id' => '100'], [], [], [], [], [
                'PHP_SELF' => '/app.php',
                'REQUEST_METHOD' => 'GET',
    Severity: Major
    Found in src/Test/EventListener/VJRedirectionServiceTest.php and 2 other locations - About 4 hrs to fix
    src/Test/EventListener/VJRedirectionServiceTest.php on lines 23..40
    src/Test/EventListener/VJRedirectionServiceTest.php on lines 42..58

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

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

        public function contains($text, $cacheKey, callable $miss)
        {
            $value = $this->redis->hget($this->prefix, $cacheKey);
            if ($value === false) {
                // Haven't found data in the cache, we need to build the tree
    Severity: Minor
    Found in src/Security/KeywordFilter.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

    Method execute has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $helper = $this->getHelper('question');
    
            // ask fields
    Severity: Major
    Found in tools/CertificateGenerateCommand.php - About 3 hrs to fix

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

      <?php
      /**
       * This file is part of openvj project.
       *
       * Copyright 2013-2015 openvj dev team.
      Severity: Minor
      Found in src/Core/Application.php - About 3 hrs to fix

        Method createUser has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createUser($username, $password, $email)
            {
                if (!is_string($username)) {
                    throw new InvalidArgumentException('username', 'type_invalid');
                }
        Severity: Major
        Found in src/User/UserManager.php - About 3 hrs to fix

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

              public function testCookieNoSSLTrueVisitHttpFromBrowser()
              {
                  foreach ($this->ua_https as $ua) {
                      $request = $this->getRequest($ua, false, [], ['nossl' => 'on']);
                      $response = new Response();
          Severity: Major
          Found in src/Test/EventListener/HttpsRedirectionServiceTest.php and 1 other location - About 3 hrs to fix
          src/Test/EventListener/HttpsRedirectionServiceTest.php on lines 209..222

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

          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 testCookieNoSSLTrueVisitHttpsFromBrowser()
              {
                  foreach ($this->ua_https as $ua) {
                      $request = $this->getRequest($ua, true, [], ['nossl' => 'on']);
                      $response = new Response();
          Severity: Major
          Found in src/Test/EventListener/HttpsRedirectionServiceTest.php and 1 other location - About 3 hrs to fix
          src/Test/EventListener/HttpsRedirectionServiceTest.php on lines 194..207

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

          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 3 locations. Consider refactoring.
          Open

              gulp.src('./bower_components/twig.js/twig.js')
                  .pipe(logger())
                  .pipe(plumber())
                  .pipe(sourcemaps.init())
                  .pipe(uglify())
          Severity: Major
          Found in web/gulpfile.js and 2 other locations - About 2 hrs to fix
          web/gulpfile.js on lines 176..182
          web/gulpfile.js on lines 184..190

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

          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 3 locations. Consider refactoring.
          Open

              gulp.src('./bower_components/marked/lib/marked.js')
                  .pipe(logger())
                  .pipe(plumber())
                  .pipe(sourcemaps.init())
                  .pipe(uglify())
          Severity: Major
          Found in web/gulpfile.js and 2 other locations - About 2 hrs to fix
          web/gulpfile.js on lines 176..182
          web/gulpfile.js on lines 192..198

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

          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 3 locations. Consider refactoring.
          Open

              gulp.src('./bower_components/google-code-prettify/src/*.js')
                  .pipe(logger())
                  .pipe(plumber())
                  .pipe(sourcemaps.init())
                  .pipe(uglify())
          Severity: Major
          Found in web/gulpfile.js and 2 other locations - About 2 hrs to fix
          web/gulpfile.js on lines 184..190
          web/gulpfile.js on lines 192..198

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

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

              private static function initService()
              {
                  $services = self::$resources['service'];
                  foreach ($services as $service_name => $service_config) {
                      self::set($service_name, function () use ($service_config) {
          Severity: Minor
          Found in src/Core/Application.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

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

              return gulp.src('./src/*.coffee')
                  .pipe(logger())
                  .pipe(plumber())
                  .pipe(sourcemaps.init())
                  .pipe(coffee({bare: true}).on('error', gutil.log))
          Severity: Major
          Found in web/gulpfile.js and 1 other location - About 2 hrs to fix
          web/gulpfile.js on lines 203..208

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

          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

              return gulp.src('./src/shared/**/*.coffee')
                  .pipe(logger())
                  .pipe(plumber())
                  .pipe(sourcemaps.init())
                  .pipe(coffee({bare: true}).on('error', gutil.log))
          Severity: Major
          Found in web/gulpfile.js and 1 other location - About 2 hrs to fix
          web/gulpfile.js on lines 215..220

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

          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