Showing 70 of 199 total issues
Function exports
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(environment) {
const ENV = {
modulePrefix: 'pix-live',
environment: environment,
Function _formatResult
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
function _formatResult(validations, deactivations) {
if (deactivationsService.isDefault(deactivations)) {
if (validations.t1t2t3Ratio <= 0.25) {
return AnswerStatus.OK;
- Read upRead up
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
Open
function _goodAnswer(allValidations, deactivations) {
const bestAnswerSoFar = _.minBy(allValidations, (oneValidation) => oneValidation.t1t2t3Ratio);
if (deactivationsService.isDefault(deactivations)) {
return bestAnswerSoFar.t1t2t3Ratio <= 0.25 ? bestAnswerSoFar : null;
}
- Read upRead up
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
Open
exports.register = function(server, options, next) {
server.route([
{
Function exports
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (function() {
const config = {
rootPath: path.normalize(__dirname + '/..'),
Function register
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.register = function(server, options, next) {
server.route([
{
method: 'POST',
Assessment
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Assessment {
constructor(course, answers) {
this.course = course;
this.answers = answers;
}
File assessment-service.js
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
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');
Function _formatResult
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _formatResult(validations, deactivations) {
if (deactivationsService.isDefault(deactivations)) {
if (validations.t1t2t3Ratio <= 0.25) {
return AnswerStatus.OK;
Function register
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.register = function(server, options, next) {
server.route([
{
method: 'GET',
Function evaluateFromAssessmentId
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function evaluateFromAssessmentId(assessmentId) {
let assessment;
return assessmentRepository.get(assessmentId)
Function getCertificationResult
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getCertificationResult(certificationCourseId) {
let assessment = {};
let assessmentLastResult;
let certification = {};
return assessmentRepository
Function fetchAssessment
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function fetchAssessment(assessmentId) {
const [assessmentPix, answers] = await Promise.all([
assessmentRepository.get(assessmentId),
answerRepository.findByAssessment(assessmentId)
Function register
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.register = function(server, options, next) {
server.route([
{
method: 'POST',
Function getProfileToCertify
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getProfileToCertify(userId, limitDate) {
let coursesFromAdaptativeCourses;
let userLastAssessments;
return courseRepository.getAdaptiveCourses()
.then((courses) => {
Function getRevalidationStatistics
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getRevalidationStatistics(oldAnswers, newAnswers) {
const oldAnswersResult = _.map(oldAnswers, (o) => {
return { id: o.id, result: o.attributes.result };
});
Function register
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.register = (server, options, next) => {
server.route([
{
method: 'POST',
path: '/api/organizations',
Function getCompetenceMarks
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getCompetenceMarks(assessment) {
if(this.isPlacementAssessment(assessment)) {
let competenceOfMark;
return courseRepository.get(assessment.courseId)
Function getSkills
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function getSkills(assessment) {
if (assessment === null) {
return Promise.reject(new NotFoundError('Unable to getSkills without assessment'));
}
let skillsReport = {
Function register
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.register = function(server, options, next) {
server.route([
{
method: 'GET',