Showing 59 of 111 total issues
Function likeClickCallback
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function likeClickCallback(e) {
e.preventDefault();
e.stopPropagation();
var $this = $(this),
makeID = $this.data('make-id'),
Function resultsCallback
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function resultsCallback(err, data, total) {
var oldMakes = searchResults.querySelectorAll('.make');
var showingString = total ? ('Showing pg. ' + lastQuery.page + ' of ' + total) : 'No';
if (oldMakes.length) {
searchMasonry.remove(oldMakes);
Function apply
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
apply: function (req, res, next) {
var evidence = [req.body.evidence];
var applicationSlug = req.body.applicationSlug;
if (req.body.city) {
Function exports
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function () {
var make = require('../lib/makeapi').authenticated;
return {
like: function (req, res) {
var id = req.body.makeID,
Function exports
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function () {
var make = require('../lib/makeapi').authenticated;
return {
report: function (req, res) {
var id = req.body.makeID,
Function initTracking
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function initTracking() {
if (!session.mouseTrackingActive) {
session.mouseTrackingActive = true;
// grab the current viewport dimensions on load
Function positionTipOnCursor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function positionTipOnCursor() {
// to support having fixed tooltips on the same page as cursor tooltips,
// where both instances are referencing the same tooltip element, we
// need to keep track of the mouse position constantly, but we should
// only set the tip location if a fixed tip is not currently open, a tip
Function claim
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
claim: function (req, res, next) {
var codeQuery = {
system: env.get('BADGES_SYSTEM'),
badge: req.params.badge,
claimCode: req.body.claimcode
Function sendSMS
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function sendSMS() {
sendSmsButton.attr('disabled', true);
var phoneNumber = phoneNumberInput.intlTelInput('getNumber', window.intlTelInputUtils.numberFormat.INTERNATIONAL);
analytics.event('Click Send SMS Link for Beta App', {
Function issue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
issue: function (req, res, next) {
var apiFunction;
var query = {
system: env.get('BADGES_SYSTEM'),
badge: req.params.badge,
Function sortByPriority
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
makeClient.sortByPriority = function (prefix, data) {
var sortedData = [],
duplicates = [],
priorityIndex,
regex = new RegExp('^' + prefix + '(\\d+)$');
Avoid deeply nested control flow statements. Open
Open
if (!isMouseOver(tipElement)) {
isDesynced = true;
}
Consider simplifying this complex logical expression. Open
Open
if (config.supportLang.indexOf(item) !== -1 &&
$scope.listLang.indexOf(item) !== 1 && $scope.listLang.length < 1 &&
item.match(/^[a-z]{2}/) && config.lang.match(/^[a-z]{2}/) &&
item.match(/^[a-z]{2}/)[0] !== config.lang.match(/^[a-z]{2}/)[0]) {
$scope.listLang.push(item);
Function computePlacementCoords
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
function computePlacementCoords(element, placement, tipWidth, tipHeight, offset) {
Avoid too many return
statements within this function. Open
Open
return next();
Avoid too many return
statements within this function. Open
Open
return next(errorHandlers.forbidden());
Avoid too many return
statements within this function. Open
Open
return true;
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function () {
var make = require('../lib/makeapi').authenticated;
return {
like: function (req, res) {
var id = req.body.makeID,
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function () {
var make = require('../lib/makeapi').authenticated;
return {
report: function (req, res) {
var id = req.body.makeID,
- 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"