VSVverkeerskunde/gvq-api

View on GitHub

Showing 1,426 of 1,426 total issues

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

        context._timeout = setTimeout(function () {
          if (context._hoverState === HoverState.SHOW) {
            context.show();
          }
        }, context.config.delay.show);
Severity: Major
Found in public/js/bootstrap.js and 1 other location - About 1 hr to fix
public/js/bootstrap.js on lines 2963..2967

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

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

        else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
                  mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
        {
            /* If there is a . in the source string then the data source is in a
             * nested object so we loop over the data for each level to get the next
Severity: Major
Found in public/js/jquery.dataTables.js and 1 other location - About 1 hr to fix
public/js/jquery.dataTables.js on lines 2713..2800

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

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

        else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
                  mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
        {
            /* Like the get, we need to get data from a nested object */
            var setData = function (data, val, src) {
Severity: Major
Found in public/js/jquery.dataTables.js and 1 other location - About 1 hr to fix
public/js/jquery.dataTables.js on lines 2598..2680

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

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

        context._timeout = setTimeout(function () {
          if (context._hoverState === HoverState.OUT) {
            context.hide();
          }
        }, context.config.delay.hide);
Severity: Major
Found in public/js/bootstrap.js and 1 other location - About 1 hr to fix
public/js/bootstrap.js on lines 2931..2935

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

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

Consider simplifying this complex logical expression.
Open

        if ( ie67 || ! userInputs && ! scrollX && ! scrollY &&
             columnCount == _fnVisbleColumns( oSettings ) &&
             columnCount == headerCells.length
        ) {
            for ( i=0 ; i<columnCount ; i++ ) {
Severity: Critical
Found in public/js/jquery.dataTables.js - About 1 hr to fix

    Function showHide has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function showHide( elements, show ) {
        var display, elem,
            values = [],
            index = 0,
            length = elements.length;
    Severity: Minor
    Found in public/js/jquery.js - About 1 hr to fix

      Function _dataApiKeydownHandler has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
              // If not input/textarea:
              //  - And not a key in REGEXP_KEYDOWN => not a dropdown command
              // If input/textarea:
              //  - If space key => not a dropdown command
      Severity: Minor
      Found in public/js/bootstrap.js - About 1 hr to fix

        Function toggle has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              _proto.toggle = function toggle() {
                var triggerChangeEvent = true;
                var addAriaPressed = true;
                var rootElement = $$$1(this._element).closest(Selector.DATA_TOGGLE)[0];
        
        
        Severity: Minor
        Found in public/js/bootstrap.js - About 1 hr to fix

          Function expandAllRows has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              BootstrapTable.prototype.expandAllRows = function (isSubTable) {
                  if (isSubTable) {
                      var $tr = this.$body.find(sprintf('> tr[data-index="%s"]', 0)),
                          that = this,
                          detailIcon = null,
          Severity: Minor
          Found in public/js/bootstrap-table.js - About 1 hr to fix

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

                  _proto.hide = function hide() {
                    var _this2 = this;
            
                    if (this._isTransitioning || !$$$1(this._element).hasClass(ClassName.SHOW)) {
                      return;
            Severity: Minor
            Found in public/js/bootstrap.js - About 1 hr to fix

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

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

                Method newQuestionFromData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function newQuestionFromData(
                        UuidFactoryInterface $uuidFactory,
                        NotEmptyString $imageFileName,
                        array $data
                    ): Question {
                Severity: Minor
                Found in src/Question/Forms/QuestionFormType.php - About 1 hr to fix

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

                        Dropdown._clearMenus = function _clearMenus(event) {
                          if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
                            return;
                          }
                  
                  
                  Severity: Minor
                  Found in public/js/bootstrap.js - About 1 hr to fix

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

                        var setFieldIndex = function (columns) {
                            var i, j, k,
                                totalCol = 0,
                                flag = [];
                    
                    
                    Severity: Minor
                    Found in public/js/bootstrap-table.js - About 1 hr to fix

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

                          public function denormalize($data, $class, $format = null, array $context = []): Question
                          {
                              $category = $this->categoryDenormalizer->denormalize(
                                  $data['category'],
                                  Category::class,
                      Severity: Minor
                      Found in src/Question/Serializers/QuestionDenormalizer.php - About 1 hr to fix

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

                                controller: function (quizId, score, totalQuestions) {
                                  setViewValue('score', score);
                                  setViewValue('totalQuestions', totalQuestions);
                        
                                  view.find('button.gvq-play-again').on('click', function () {
                        Severity: Minor
                        Found in public/js/quiz.js - About 1 hr to fix

                          Method requestPassword has 32 lines of code (exceeds 25 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

                            Function validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function validate($value, Constraint $constraint): void
                                {
                                    if ($constraint instanceof CompanyIsUnique) {
                                        $company = $this->companyRepository->getByName(new NotEmptyString($value));
                                        $raiseError = false;
                            Severity: Minor
                            Found in src/Account/Constraints/CompanyIsUniqueValidator.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 validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function validate($value, Constraint $constraint): void
                                {
                                    if ($constraint instanceof AliasIsUnique) {
                                        $company = $this->companyRepository->getByAlias(new Alias($value));
                                        $raiseError = false;
                            Severity: Minor
                            Found in src/Account/Constraints/AliasIsUniqueValidator.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

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

                                    Year $year,
                                    UserRepository $userRepository,
                                    CompanyRepository $companyRepository,
                                    DashboardService $dashboardService,
                                    StatisticsService $statisticsService,
                            Severity: Major
                            Found in src/Dashboard/Controllers/DashboardViewController.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language