Showing 371 of 463 total issues
Function $get
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.$get = function() {
return {
id: 'en-us',
NUMBER_FORMATS: {
Function dateFilter
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function dateFilter($locale) {
var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
function jsonStringToDate(string){
Function $Browser
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
angular.mock.$Browser = function() {
var self = this;
this.isMock = true;
self.$$url = "http://server/";
- 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 data
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data: function( key, value ) {
var attrs, name,
elem = this[ 0 ],
i = 0,
data = null;
Function collectDirectives
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function collectDirectives(node, directives, attrs, maxPriority) {
var nodeType = node.nodeType,
attrsMap = attrs.$attr,
match,
className;
Function defer
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var defer = function() {
var pending = [],
value, deferred;
deferred = {
Function numberInputType
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
textInputType(scope, element, attr, ctrl, $sniffer, $browser);
ctrl.$parsers.push(function(value) {
var empty = isEmpty(value);
Consider simplifying this complex logical expression. Open
Open
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
Consider simplifying this complex logical expression. Open
Open
if (match) {
// parse months, days, hours, minutes, seconds, and milliseconds
// provide default values if necessary
// parse the UTC offset component
var year = Number(match[1]),
Function remove
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, origCount, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
Function readTemplate
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function readTemplate(exception, page) {
var headers, lines, lastSection, lastLevel, navigation;
if (exception) {
console.log(exception);
} else {
Function updateHar
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$scope.updateHar = function(newData) {
// Reset data
var data = {};
data.lastOnLoad = 0;
Function setupModuleLoader
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function setupModuleLoader(window) {
function ensure(obj, name, factory) {
return obj[name] || (obj[name] = factory());
}
Function buildFragment
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buildFragment: function( elems, context, scripts, selection ) {
var elem, tmp, tag, wrap, contains, j,
i = 0,
l = elems.length,
fragment = context.createDocumentFragment(),
Function tokenizeFormatString
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
String.tokenizeFormatString = function(format, formatters)
{
var tokens = [];
var substitutionIndex = 0;
Function orderByFilter
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function orderByFilter($parse){
return function(array, sortPredicate, reverseOrder) {
if (!isArray(array)) return array;
if (!sortPredicate) return array;
sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];
Function format
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
String.format = function(format, substitutions, formatters, initialValue, append)
{
if (!format || !substitutions || !substitutions.length)
return { formattedResult: append(initialValue, format), unusedSubstitutions: substitutions };
Function extractComments
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function extractComments(source) {
var index = 0, length = source.length, results = [], symbol, position, original;
while (index < length) {
symbol = source[index];
switch (symbol) {
Function $interpolate
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function $interpolate(text, mustHaveExpression) {
var startIndex,
endIndex,
index = 0,
parts = [],
Function send
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
send: function( headers, complete ) {
var i, id,
xhr = options.xhr();
xhr.open( options.type, options.url, options.async, options.username, options.password );
// Apply custom fields if provided