Showing 70 of 199 total issues

Function exports has 106 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(environment) {
  const ENV = {

    modulePrefix: 'pix-live',
    environment: environment,
Severity: Major
Found in live/config/environment.js - About 4 hrs to fix

    Function _formatResult has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    function _formatResult(validations, deactivations) {
    
      if (deactivationsService.isDefault(deactivations)) {
        if (validations.t1t2t3Ratio <= 0.25) {
          return AnswerStatus.OK;
    Severity: Minor
    Found in api/lib/domain/services/solution-service-qroc.js - 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 _goodAnswer has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    function _goodAnswer(allValidations, deactivations) {
      const bestAnswerSoFar = _.minBy(allValidations, (oneValidation) => oneValidation.t1t2t3Ratio);
      if (deactivationsService.isDefault(deactivations)) {
        return bestAnswerSoFar.t1t2t3Ratio <= 0.25 ? bestAnswerSoFar : null;
      }
    Severity: Minor
    Found in api/lib/domain/services/solution-service-qrocm-dep.js - 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

    Function register has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.register = function(server, options, next) {
    
      server.route([
    
        {
    Severity: Major
    Found in api/lib/application/assessments/index.js - About 2 hrs to fix

      Function exports has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = (function() {
      
        const config = {
          rootPath: path.normalize(__dirname + '/..'),
      
      
      Severity: Major
      Found in api/lib/settings.js - About 2 hrs to fix

        Function register has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.register = function(server, options, next) {
        
          server.route([
            {
              method: 'POST',
        Severity: Major
        Found in api/lib/application/users/index.js - About 2 hrs to fix

          Assessment has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Assessment {
            constructor(course, answers) {
              this.course = course;
              this.answers = answers;
            }
          Severity: Minor
          Found in api/lib/cat/assessment.js - About 2 hrs to fix

            File assessment-service.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            const courseRepository = require('../../infrastructure/repositories/course-repository');
            const certificationCourseRepository = require('../../infrastructure/repositories/certification-course-repository');
            const answerRepository = require('../../infrastructure/repositories/answer-repository');
            const assessmentRepository = require('../../infrastructure/repositories/assessment-repository');
            const certificationChallengeRepository = require('../../infrastructure/repositories/certification-challenge-repository');
            Severity: Minor
            Found in api/lib/domain/services/assessment-service.js - About 2 hrs to fix

              Function _formatResult has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function _formatResult(validations, deactivations) {
              
                if (deactivationsService.isDefault(deactivations)) {
                  if (validations.t1t2t3Ratio <= 0.25) {
                    return AnswerStatus.OK;
              Severity: Minor
              Found in api/lib/domain/services/solution-service-qroc.js - About 1 hr to fix

                Function register has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.register = function(server, options, next) {
                
                  server.route([
                    {
                      method: 'GET',
                Severity: Minor
                Found in api/lib/application/courses/index.js - About 1 hr to fix

                  Function evaluateFromAssessmentId has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function evaluateFromAssessmentId(assessmentId) {
                  
                    let assessment;
                  
                    return assessmentRepository.get(assessmentId)
                  Severity: Minor
                  Found in api/lib/domain/services/assessment-result-service.js - About 1 hr to fix

                    Function getCertificationResult has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      getCertificationResult(certificationCourseId) {
                        let assessment = {};
                        let assessmentLastResult;
                        let certification = {};
                        return assessmentRepository
                    Severity: Minor
                    Found in api/lib/domain/services/certification-service.js - About 1 hr to fix

                      Function fetchAssessment has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      async function fetchAssessment(assessmentId) {
                      
                        const [assessmentPix, answers] = await Promise.all([
                          assessmentRepository.get(assessmentId),
                          answerRepository.findByAssessment(assessmentId)
                      Severity: Minor
                      Found in api/lib/domain/services/assessment-service.js - About 1 hr to fix

                        Function register has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        exports.register = function(server, options, next) {
                        
                          server.route([
                            {
                              method: 'POST',
                        Severity: Minor
                        Found in api/lib/application/answers/index.js - About 1 hr to fix

                          Function getProfileToCertify has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            getProfileToCertify(userId, limitDate) {
                              let coursesFromAdaptativeCourses;
                              let userLastAssessments;
                              return courseRepository.getAdaptiveCourses()
                                .then((courses) => {
                          Severity: Minor
                          Found in api/lib/domain/services/user-service.js - About 1 hr to fix

                            Function getRevalidationStatistics has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              getRevalidationStatistics(oldAnswers, newAnswers) {
                            
                                const oldAnswersResult = _.map(oldAnswers, (o) => {
                                  return { id: o.id, result: o.attributes.result };
                                });
                            Severity: Minor
                            Found in api/lib/domain/services/challenge-service.js - About 1 hr to fix

                              Function register has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              exports.register = (server, options, next) => {
                                server.route([
                                  {
                                    method: 'POST',
                                    path: '/api/organizations',
                              Severity: Minor
                              Found in api/lib/application/organizations/index.js - About 1 hr to fix

                                Function getCompetenceMarks has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function getCompetenceMarks(assessment) {
                                
                                  if(this.isPlacementAssessment(assessment)) {
                                    let competenceOfMark;
                                    return courseRepository.get(assessment.courseId)
                                Severity: Minor
                                Found in api/lib/domain/services/assessment-service.js - About 1 hr to fix

                                  Function getSkills has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  async function getSkills(assessment) {
                                    if (assessment === null) {
                                      return Promise.reject(new NotFoundError('Unable to getSkills without assessment'));
                                    }
                                    let skillsReport = {
                                  Severity: Minor
                                  Found in api/lib/domain/services/assessment-service.js - About 1 hr to fix

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

                                    exports.register = function(server, options, next) {
                                    
                                      server.route([
                                        {
                                          method: 'GET',
                                    Severity: Minor
                                    Found in api/lib/application/certificationCourses/index.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language