Showing 64 of 226 total issues
File service.js
has 979 lines of code (exceeds 250 allowed). Consider refactoring. Open
var bedIndex = 0;
$.ajaxSetup({ cache: false })
$('#editBedModal').on('show.bs.modal', function() {
File service.js
has 855 lines of code (exceeds 250 allowed). Consider refactoring. Open
const mongoose = require('mongoose');
const googleMapsClient = require('@google/maps').createClient({
key: process.env.embed_maps_api,
Promise, // 'Promise' is the native constructor.
});
File service.js
has 799 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var bedIndex = 0;
Function findAmenityToUpdate
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
function findAmenityToUpdate(amenity, status) {
if (amenity === 'TV') {
return {
label: 'TV',
name: 'TV',
Function amenities
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
function amenities(service) {
const amen = [];
if (service.TV === 'on') {
amen.push({
Function showLocations
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.showLocations = (req, res) => {
const name = req.body.fName + ' ' + req.body.lName;
const longTerm = (req.params.lengthOfStay === 'long_term');
const type = (longTerm ? ['transitional'] : ['crisis']);
const age = parseInt(timeago().format(req.body.dob).split(' ')[0], 10);
File validation.js
has 327 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Checks if the #addReview form has data for all
* fields if it doesn't then an error message is shown
* to the user and the form does not submit to the server
*/
Function addPhoneToRequest
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.addPhoneToRequest = (req, res) => {
if (req.session.requestId) {
// Add phone number to request
Request.findOneAndUpdate(
{ _id: req.session.requestId },
Function addService
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.addService = (req, res, next) => {
if (!req.user) {
res.status(401).json({ message: 'You must be logged in to create a new service provider.' });
return;
}
Function findAmenityToUpdate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function findAmenityToUpdate(amenity, status) {
if (amenity === 'TV') {
return {
label: 'TV',
name: 'TV',
- 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
File validation.js
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
/**
* Checks if the #addReview form has data for all
* fields if it doesn't then an error message is shown
Function updateBeds
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.updateBeds = (req, res) => {
if (!req.user) {
res.status(401).json({ message: 'You are not authorised to view this page.' });
return;
}
Function createImages
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createImages(uri, logo, images) {
var isIE = false;
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
Function createImages
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createImages(uri, logo, images) {
var isIE = false;
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
Function register
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.register = (req, res, next) => {
if (!req.body.fName
|| !req.body.lName
|| !req.body.email
|| !req.body.pwd
Function amenities
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function amenities(service) {
const amen = [];
if (service.TV === 'on') {
amen.push({
- 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 updateRequests
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateRequests() {
$('#updateRequests > .form-group').html('');
$('#updateRequests > .form-group').hide();
$('#spinnerLoadRequests').show();
$.get('/service/dashboard/' + $('#uri').text() + '/requests/show', function(data) {
Function updateRequests
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateRequests() {
$('#updateRequests > .form-group').html('');
$('#updateRequests > .form-group').hide();
$('#spinnerLoadRequests').show();
$.get('/service/dashboard/' + $('#uri').text() + '/requests/show', function (data) {
Function createImages
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function createImages(uri, logo, images) {
var isIE = false;
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
- 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 addPagination
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addPagination(name, services) {
var numSegments = 1;
var numAdded = 0;
for (var i = 0; i < services.length; i++) {