Eluinhost/TeamspeakAuth

View on GitHub

Showing 19 of 19 total issues

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

<?php

namespace PublicUHC\Bundle\TeamspeakAuthBundle\Entity;

use Doctrine\ORM\EntityRepository;
src/PublicUHC/Bundle/TeamspeakAuthBundle/Entity/MinecraftAccountRepository.php on lines 1..48

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

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 PublicUHC\Bundle\TeamspeakAuthBundle\Entity;

use Doctrine\ORM\EntityRepository;
src/PublicUHC/Bundle/TeamspeakAuthBundle/Entity/TeamspeakAccountRepository.php on lines 1..38

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

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

module.exports = function(grunt) {

    grunt.loadNpmTasks("grunt-bower-install-simple");
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
Severity: Major
Found in Gruntfile.js - About 4 hrs to fix

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

        public function apiV1CheckTeamspeakAccountAction($uuids, $type, $limit, $offset)
        {
            if ($limit > 50)
                throw new BadRequestHttpException('Only 50 accounts may be fetched per request');
    
    
    src/PublicUHC/Bundle/TeamspeakAuthBundle/Controller/MinecraftAccountController.php on lines 52..78

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

    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 apiV1CheckMinecraftAccountAction($uuids, $type, $limit, $offset)
        {
            if ($limit > 50)
                throw new BadRequestHttpException('Only 50 accounts may be fetched per request');
    
    
    src/PublicUHC/Bundle/TeamspeakAuthBundle/Controller/TeamspeakAccountController.php on lines 50..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 173.

    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

    DefaultTeamspeakHelper has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class DefaultTeamspeakHelper implements TeamspeakHelper {
    
        private $server;
        private $entityManager;
        private $groupID;

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

                              function(error) {
                                  //check for errors
                                  if(typeof error.data.message != 'undefined' && error.data.message.length > 0 ) {
                                      $scope.addError(error.data.message);
                                  } else {
      src/PublicUHC/Bundle/TeamspeakAuthBundle/Resources/public/js/app.js on lines 204..211

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

      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

                              function(error) {
                                  //check for errors
                                  if(typeof error.data.message != 'undefined' && error.data.message.length > 0 ) {
                                      $scope.addError(error.data.message);
                                  } else {
      src/PublicUHC/Bundle/TeamspeakAuthBundle/Resources/public/js/app.js on lines 134..141

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

      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 PublicUHC\Bundle\TeamspeakAuthBundle\Entity;
      
      use Doctrine\ORM\Mapping as ORM;
      src/PublicUHC/Bundle/TeamspeakAuthBundle/Entity/MinecraftCode.php on lines 1..67

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

      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 PublicUHC\Bundle\TeamspeakAuthBundle\Entity;
      
      use Doctrine\ORM\Mapping as ORM;
      src/PublicUHC/Bundle/TeamspeakAuthBundle/Entity/TeamspeakCode.php on lines 1..67

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

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

                  link: function($scope, $element, attr) {
                      //setup errors
                      $scope.errors = [];
                      $scope.addError = function(msg) {
                          $scope.errors.push({msg: msg, type: 'alert round'});
      Severity: Minor
      Found in src/PublicUHC/Bundle/TeamspeakAuthBundle/Resources/public/js/app.js - About 1 hr to fix

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

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $output->writeln("<info>Starting server on port {$this->server->getPort()}... You can stop the server with Ctrl+C.</info>");
                $this->logger->info('Starting auth server on port '.$this->server->getPort());
        
        

          Function link has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      link: function($scope, $element, attr) { //called after DOM ready
          
                          //setup errors
                          $scope.errors = [];
                          $scope.addError = function(msg) {
          Severity: Minor
          Found in src/PublicUHC/Bundle/TeamspeakAuthBundle/Resources/public/js/app.js - About 1 hr to fix

            Method verifyClient has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function verifyClient(TeamspeakAccount $tsAccount, MinecraftAccount $mcAccount) {
                    //unauthenticate any accounts with the same MC name but not the same UUID
                    $mcqb = $this->entityManager->createQueryBuilder();
                    $mcqb->select('mcAccount')
                        ->from('PublicUHCTeamspeakAuthBundle:MinecraftAccount', 'mcAccount')

              Function verifyCodes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              $scope.verifyCodes = function() {
                                  if($scope.teamspeakCode == null || $scope.teamspeakCode.length == 0) {
                                      $scope.addError('Must supply the provided Teamspeak code');
                                      return;
                                  }
              Severity: Minor
              Found in src/PublicUHC/Bundle/TeamspeakAuthBundle/Resources/public/js/app.js - About 1 hr to fix

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

                    private function checkTeamspeakCodeValid($ts_uuid, $ts_code)
                    {
                        /** @var TeamspeakCodeRepository $tsCodeRepo */
                        $tsCodeRepo = $this->getDoctrine()->getManager()->getRepository('PublicUHCTeamspeakAuthBundle:TeamspeakCode');
                
                
                src/PublicUHC/Bundle/TeamspeakAuthBundle/Controller/AuthenticationController.php on lines 107..124

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

                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

                    private function checkMinecraftCodeValid($mc_uuid, $mc_code)
                    {
                        /** @var MinecraftCodeRepository $mcCodeRepo */
                        $mcCodeRepo = $this->getDoctrine()->getManager()->getRepository('PublicUHCTeamspeakAuthBundle:MinecraftCode');
                
                
                src/PublicUHC/Bundle/TeamspeakAuthBundle/Controller/AuthenticationController.php on lines 131..148

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

                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 __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct(AuthServer $server,
                                                EntityManager $em,
                                                LoopInterface $loop,
                                                $keepAlive,
                                                $description,
                Severity: Major
                Found in src/PublicUHC/Bundle/TeamspeakAuthBundle/Command/ServerStartCommand.php - About 50 mins to fix

                  Function filterOnlineOnly has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function filterOnlineOnly($accountArray)
                      {
                          /** @var TeamspeakHelper $teamspeak_helper */
                          $teamspeak_helper = $this->get('teamspeak_helper');
                  
                  

                  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