VSVverkeerskunde/gvq-api

View on GitHub

Showing 1,426 of 1,426 total issues

Method generateQuestions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function generateQuestions(Language $language, Year $year, ?string $firstQuestionId): Questions
    {
        $pickedQuestions = [];
        $firstQuestion = null;

Severity: Minor
Found in src/Quiz/Service/QuizService.php - About 1 hr to fix

    Method configure has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function configure(): void
        {
            $this
                ->setName('gvq:replay')
                ->setDescription('Replay all current events.')
    Severity: Minor
    Found in src/Command/ReplayCommand.php - About 1 hr to fix

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

                  if (
                      !$quiz->getChannel()->equals(new QuizChannel(QuizChannel::CUP)) &&
                      !$quiz->getChannel()->equals(new QuizChannel(QuizChannel::LEAGUE))
                  ) {
                      // All unique participations for quiz (not cup or league) and language.
      Severity: Major
      Found in src/Statistics/Projectors/UniqueParticipantProjector.php and 1 other location - About 1 hr to fix
      src/Statistics/Projectors/UniqueParticipantProjector.php on lines 113..129

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

      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

                      if (
                          !$quiz->getChannel()->equals(new QuizChannel(QuizChannel::CUP)) &&
                          !$quiz->getChannel()->equals(new QuizChannel(QuizChannel::LEAGUE))
                      ) {
                          // All unique participations for quiz (not cup or league) and language.
      Severity: Major
      Found in src/Statistics/Projectors/UniqueParticipantProjector.php and 1 other location - About 1 hr to fix
      src/Statistics/Projectors/UniqueParticipantProjector.php on lines 68..84

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

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

          public function requestPassword(Request $request): Response
          {
              $form = $this->createRequestPasswordForm();
              $form->handleRequest($request);
      
      
      Severity: Minor
      Found in src/Account/Controllers/AccountViewController.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 _fnColumnTypes has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function _fnColumnTypes ( settings )
          {
              var columns = settings.aoColumns;
              var data = settings.aoData;
              var types = DataTable.ext.type.detect;
      Severity: Minor
      Found in public/js/jquery.dataTables.js - About 1 hr to fix

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

              _proto.hide = function hide(callback) {
                var _this2 = this;
        
                var tip = this.getTipElement();
                var hideEvent = $$$1.Event(this.constructor.Event.HIDE);
        Severity: Minor
        Found in public/js/bootstrap.js - About 1 hr to fix

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

                      this.data = s ? $.grep(this.data, function (item, i) {
                          for (var j = 0; j < that.header.fields.length; j++) {
          
                              if (!that.header.searchables[j]) {
                                  continue;
          Severity: Minor
          Found in public/js/bootstrap-table.js - About 1 hr to fix

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

                BootstrapTable.prototype.resetView = function (params) {
                    var padding = 0;
            
                    if (params && params.height) {
                        this.options.height = params.height;
            Severity: Minor
            Found in public/js/bootstrap-table.js - About 1 hr to fix

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

                  var objectKeys = function () {
                      // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
                      if (!Object.keys) {
                          Object.keys = (function() {
                              var hasOwnProperty = Object.prototype.hasOwnProperty,
              Severity: Minor
              Found in public/js/bootstrap-table.js - About 1 hr to fix

                Method buildForm has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function buildForm(FormBuilderInterface $builder, array $options)
                    {
                        $this->translator = $options['translator'];
                
                        $builder
                Severity: Minor
                Found in src/Account/Forms/PasswordFormType.php - About 1 hr to fix

                  Method __construct has 11 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          string $id,
                          int $year,
                          string $language,
                          string $channel,
                          ContestParticipantEmbeddable $contestParticipant,
                  Severity: Major
                  Found in src/Contest/Repositories/Entities/ContestParticipationEntity.php - About 1 hr to fix

                    Method __construct has 11 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            UuidInterface $id,
                            Year $year,
                            Language $language,
                            QuizChannel $channel,
                            ContestParticipant $contestParticipant,
                    Severity: Major
                    Found in src/Contest/Models/ContestParticipation.php - About 1 hr to fix

                      Function handlers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          handlers: function( event, handlers ) {
                              var i, handleObj, sel, matchedHandlers, matchedSelectors,
                                  handlerQueue = [],
                                  delegateCount = handlers.delegateCount,
                                  cur = event.target;
                      Severity: Minor
                      Found in public/js/jquery.js - About 1 hr to fix

                        Function setOffset has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            setOffset: function( elem, options, i ) {
                                var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
                                    position = jQuery.css( elem, "position" ),
                                    curElem = jQuery( elem ),
                                    props = {};
                        Severity: Minor
                        Found in public/js/jquery.js - About 1 hr to fix

                          Function show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                _proto.show = function show(relatedTarget) {
                                  var _this = this;
                          
                                  if (this._isTransitioning || this._isShown) {
                                    return;
                          Severity: Minor
                          Found in public/js/bootstrap.js - About 1 hr to fix

                            Function jqueryui has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        jqueryui: function ( settings, cell, column, classes ) {
                                            $('<div/>')
                                                .addClass( classes.sSortJUIWrapper )
                                                .append( cell.contents() )
                                                .append( $('<span/>')
                            Severity: Minor
                            Found in public/js/jquery.dataTables.js - About 1 hr to fix

                              Method denormalize has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function denormalize($data, $class, $format = null, array $context = array()): Company
                                  {
                                      $translatedAliases = array_map(
                                          function (array $translatedAlias) use ($format) {
                                              return $this->translatedAliasDenormalizer->denormalize(
                              Severity: Minor
                              Found in src/Company/Serializers/CompanyDenormalizer.php - About 1 hr to fix

                                Method report has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function report(): Response
                                    {
                                        if ($this->canViewReport()) {
                                            $correctNlQuestions = $this->reportService->getCorrectQuestions(
                                                new Language(Language::NL)
                                Severity: Minor
                                Found in src/Report/Controllers/ReportViewController.php - About 1 hr to fix

                                  Function controller has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          controller: function (quizId, score, totalQuestions) {
                                            setViewValue('score', score);
                                            setViewValue('totalQuestions', totalQuestions);
                                  
                                            function checkEmail () {
                                  Severity: Minor
                                  Found in public/js/quiz.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language