Showing 58 of 608 total issues
Function submitForm
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
$rootScope.submitForm = $scope.submitForm = function() {
if($scope.forms.myForm.$invalid){
$scope.goToInvalid();
return;
}
Function isAuthenticated
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next) {
if (req.isAuthenticated()) {
return next();
}
// Try authenticate with API KEY
- 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 link
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function(scope, element) {
$rootScope.chooseDefaultOption = scope.chooseDefaultOption = function(type) {
if(type === 'yes_no'){
scope.field.fieldValue = 'true';
Function Socket
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Socket($timeout, $window) {
var service = {
socket: null
};
Function update
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.update = function(req, res) {
var form = req.form;
var updatedForm = req.body.form;
if(form.form_fields === undefined){
Function setActiveField
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.setActiveField = $rootScope.setActiveField = function(field_id, field_index, animateScroll) {
if($scope.selected === null || (!field_id && field_index === null) ) {
return;
}
Function update
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
exports.update = function(req, res) {
var form = req.form;
var updatedForm = req.body.form;
if(form.form_fields === undefined){
- 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 SendVisitorData
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SendVisitorData(Socket, $state) {
// Create a controller method for sending visitor data
function send(form, lastActiveIndex, timeElapsed) {
Function openEditEndPageModal
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.openEditEndPageModal = function(){
$scope.editEndPageModal = $uibModal.open({
animation: true,
templateUrl: 'editEndPageModal.html',
windowClass: 'edit-modal-window',
Function openEditStartPageModal
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.openEditStartPageModal = function(){
$scope.editStartPageModal = $uibModal.open({
animation: true,
templateUrl: 'editStartPageModal.html',
windowClass: 'edit-modal-window',
Function addNewField
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.addNewField = function(fieldType){
// increment lastAddedID counter
$scope.addField.lastAddedID++;
var fieldTitle = fieldType;
Function onscroll
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
$window.onscroll = function(){
if(!NOSCROLL){
var scrollTop = $(window).scrollTop();
var elemBox = document.getElementsByClassName('activeField')[0].getBoundingClientRect();
Function DeviceStatistics
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.DeviceStatistics = (function(){
var newStatItem = function(){
return {
visits: 0,
responses: 0,
Function signup
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.signup = function(req, res) {
// For security measures we remove the roles from the req.body object
delete req.body.roles;
// Init Variables
Function getErrorMessage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
exports.getErrorMessage = function(err) {
var message = '';
if(!err) {
return '';
- 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 exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(app) {
// Form Routes
if(!config.subdomainsDisabled) {
app.route('/subdomain/:userSubdomain((?!api$)[A-Za-z0-9]+)/')
.get(core.form);
Function generateAPIKey
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.generateAPIKey = function(req, res) {
if (!req.isAuthenticated()){
return res.status(400).send({
message: 'User is not Authorized'
});
Function config_nev
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
var config_nev = function () {
nev.configure({
verifyMailOptions: {
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
var shouldBeSingleRun = false;
if(process.env.NODE_ENV === 'travis') shouldBeSingleRun = true;
config.set({
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function () {
// Use local strategy
passport.use(new LocalStrategy({
usernameField: 'username',
passwordField: 'password'