Showing 36 of 38 total issues
Function link
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: scope => {
if (!scope.progress) {
scope.progress = new HttpProgress()
}
if (!scope.clickBindThis) scope.clickBindThis = scope
Function BluebirdController
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const BluebirdController = angular => {
angular
.module('mwl.bluebird')
.run(['$q', '$state', ($q, $state) => {
$q.onPossiblyUnhandledRejection(error => {
Function list
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
list (endpoint, query, token, expectedContext) {
URIValueType(endpoint, ['GenericAPIService.list', 'endpoint:URIValue'])
MaybeJsonWebTokenType(token, ['GenericAPIService.get', 'token:?JsonWebToken'])
MaybeURIValueType(expectedContext, ['GenericAPIService.list', 'expectedContext:?URIValue'])
expectedContext = expectedContext || this.modelContext
Function handleEvent
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleEvent (name, eventCreatedAt, event) {
return Promise.map(this.items, (item) => {
if (
event[item.$context.toString()] &&
event[item.$context.toString()].$context.toString() === item.$context.toString() &&
Function create
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
create (endpoint, model, token, fetch) {
URIValueType(endpoint, ['GenericAPIService.create', 'endpoint:URIValue'])
MaybeJsonWebTokenType(token, ['GenericAPIService.create', 'token:?JsonWebToken'])
fetch = fetch !== false
Function BodyController
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function BodyController (app) {
app
.run(['$rootScope', ($rootScope) => {
const bodyClasses = {
state: [],
Function AdminUsersController
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function AdminUsersController (ClientStorageService, UserService) {
const self = this
self.paginatedList = false
self.p = new HttpProgress()
self.l = new HttpProgress()
- 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 MarkDownToHTMLDirective
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const MarkDownToHTMLDirective = ($location, $sanitize, $sce) => {
return {
restrict: 'A',
link: function (scope, element, attrs) {
scope.$watch('model', function (newValue) {
Function RegisterController
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function RegisterController (app) {
app
.config(['$stateProvider', ($stateProvider) => {
$stateProvider
.state('register', {
Function GenericController
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function GenericController (Model, callbacks, createRelation, genericService) {
callbacks = _defaults(callbacks,
{
success: () => {
logger.appNotice('No success handler defined for generic controller for' + Model.$context)
Function updateUserProperty
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.updateUserProperty = (property) => {
if (self.e.$active) {
return
}
if (self.userCopy[property] === self.user[property]) {
Function AdminUserController
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
export function AdminUserController ($rootScope, $timeout, $stateParams, IDService, ClientStorageService, UserService) {
Function AvatarUploadDirective
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const AvatarUploadDirective = (Upload, $timeout, imageService, ClientStorageService, TokenService) => ({
restrict: 'E',
scope: {
label: '=',
avatar: '=',
- 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 GoogleAnalyticsService
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function GoogleAnalyticsService ($rootScope, $window, $location) {
let lastPath
function track () {
let path = $location.path()
- 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 setErrorStates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const setErrorStates = (element, modelCtrl) => {
const parent = element.parents('.form-group')
if (modelCtrl.$valid) {
element.addClass('form-control-success')
element.removeClass('form-control-danger')
- 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
Avoid too many return
statements within this function. Open
return