Showing 272 of 791 total issues
Function configFromISO
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function configFromISO(config: DateParsingConfig): DateParsingConfig {
if (!isString(config._i)) {
return config;
}
- 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 convertDuration
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function convertDuration(input: any, key: string): Partial<DateObject> {
// checks for null or undefined
if (input == null) {
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 processRelativeTime
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processRelativeTime(number: number, withoutSuffix: boolean, key: string, isFuture: boolean): string {
var result = number + ' ';
switch (key) {
case 's':
return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
Function relativeTime
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export function relativeTime(posNegDuration: Duration, withoutSuffix: boolean, locale: Locale): string {
const duration = createDuration(posNegDuration).abs();
const seconds = round(duration.as('s'));
const minutes = round(duration.as('m'));
const hours = round(duration.as('h'));
- 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 configFromStringAndFormat
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export function configFromStringAndFormat(config: DateParsingConfig): DateParsingConfig {
// TODO: Move this to another part of the creation flow to prevent circular deps
if (config._f === ISO_8601) {
return configFromISO(config);
}
- 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
Consider simplifying this complex logical expression. Open
if (config._isValid == null) {
const flags = getParsingFlags(config);
const parsedParts = Array.prototype.some.call(flags.parsedDateParts, function (i: number) {
return i != null;
});
Function timepickerControls
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function timepickerControls(
value: Date,
state: TimepickerComponentState
): TimepickerControls {
const hoursPerDayHalf = 12;
- 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 configFromArray
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export function configFromArray(config: DateParsingConfig): DateParsingConfig {
const input = [];
let i;
let date;
let currentDate;
- 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 timepicker.component.ts
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* tslint:disable:no-forward-ref max-file-line-count */
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Function timepickerReducer
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function timepickerReducer(state = initialState, action: Action) {
switch (action.type) {
case TimepickerActions.WRITE_VALUE: {
return Object.assign({}, state, { value: action.payload });
}
File component-loader.class.ts
has 278 lines of code (exceeds 250 allowed). Consider refactoring. Open
// tslint:disable:max-file-line-count
// todo: add delay support
// todo: merge events onShow, onShown, etc...
// todo: add global positioning configuration?
import {
Consider simplifying this complex logical expression. Open
if (a && getParsingFlags(config).overflow === -2) {
// todo: fix this sh*t
overflow =
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
Function handleWeekStrictParse
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleWeekStrictParse(weekdayName: string, format: string, strict: boolean): number {
let ii;
const llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) {
this._weekdaysParse = [];
Function flagDaysCalendar
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function flagDaysCalendar(
formattedMonth: DaysCalendarViewModel,
options: FlagDaysCalendarOptions
): DaysCalendarViewModel {
formattedMonth.weeks.forEach((week: WeekViewModel, weekIndex: number) => {
File bs-datepicker.reducer.ts
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
// tslint:disable:max-file-line-count
import { BsDatepickerState, initialDatepickerState } from './bs-datepicker.state';
import { Action } from '../../mini-ngrx/index';
import { BsDatepickerActions } from './bs-datepicker.actions';
import { calcDaysCalendar } from '../engine/calc-days-calendar';
TimepickerComponent
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'timepicker',
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [TIMEPICKER_CONTROL_VALUE_ACCESSOR, TimepickerStore],
templateUrl: './timepicker.component.html',
TypeaheadContainerComponent
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'typeahead-container',
// tslint:disable-next-line
templateUrl: './typeahead-container.component.html',
host: {
Function handleMonthStrictParse
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private handleMonthStrictParse(monthName: string, format: string, strict?: boolean) {
const llc = monthName.toLocaleLowerCase();
let i;
let ii;
let mom;
- 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 bsDatepickerReducer
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export function bsDatepickerReducer(state = initialDatepickerState,
action: Action): BsDatepickerState {
switch (action.type) {
case BsDatepickerActions.CALCULATE: {
return calculateReducer(state);
- 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 dayOfYearFromWeekInfo
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function dayOfYearFromWeekInfo(config: DateParsingConfig): DateParsingConfig {
let w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
w = config._w;
if (w.GG != null || w.W != null || w.E != null) {
- 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"