Showing 272 of 791 total issues
ModalDirective
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
@Directive({
selector: '[bsModal]',
exportAs: 'bs-modal'
})
export class ModalDirective implements OnDestroy, OnInit {
Function configFromStringAndFormat
has 55 lines of code (exceeds 25 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);
}
PaginationComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'pagination',
templateUrl: './pagination.component.html',
providers: [PAGINATION_CONTROL_VALUE_ACCESSOR]
})
PagerComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'pager',
templateUrl: './pager.component.html',
providers: [PAGER_CONTROL_VALUE_ACCESSOR]
})
TooltipDirective
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Directive({
selector: '[tooltip], [tooltipHtml]',
exportAs: 'bs-tooltip'
})
export class TooltipDirective implements OnInit, OnDestroy {
CarouselComponent
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: 'carousel',
templateUrl: './carousel.component.html'
})
export class CarouselComponent implements OnDestroy {
TypeaheadDirective
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
@Directive({selector: '[typeahead]', exportAs: 'bs-typeahead'})
export class TypeaheadDirective implements OnInit, OnDestroy {
/** options source, can be Array of strings, objects or
* an Observable for external matching process
*/
Function weekdaysParse
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
weekdaysParse(weekdayName?: string, format?: string, strict?: boolean): number {
let i;
let regex;
if (this._weekdaysParseExact) {
- 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 pluralForm
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
const pluralForm = function (num: number): number {
return num === 0 ? 0 : num === 1 ? 1 : num === 2 ? 2 : num % 100 >= 3 && num % 100 <= 10 ? 3 : num % 100 >= 11 ? 4 : 5;
};
- 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 ngOnInit
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit(): void {
const self = this;
this.datePicker.stepDay = { months: 1 };
Function configFromISO
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function configFromISO(config: DateParsingConfig): DateParsingConfig {
if (!isString(config._i)) {
return config;
}
Function registerDatepickerSideEffects
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerDatepickerSideEffects(): BsDatepickerEffects {
this._subs.push(
this._store.select(state => state.view).subscribe(view => {
this._store.dispatch(this._actions.calculate());
})
Function translate
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function translate(num: number, withoutSuffix: boolean, key: string, isFuture: boolean): string {
const result = num + ' ';
switch (key) {
case 's': // a few seconds / in a few seconds / a few seconds ago
Function timepickerControls
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function timepickerControls(
value: Date,
state: TimepickerComponentState
): TimepickerControls {
const hoursPerDayHalf = 12;
Function convertDuration
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function convertDuration(input: any, key: string): Partial<DateObject> {
// checks for null or undefined
if (input == null) {
return {};
}
Function translate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function translate(num: number, withoutSuffix: boolean, key: string): string {
let result = num + ' ';
switch (key) {
case 'ss':
return result + (plural(num) ? 'sekundy' : 'sekund');
- 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 translate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function translate(num: number, withoutSuffix: boolean, key: string, isFuture: boolean) {
switch (key) {
case 's':
return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын';
case 'ss':
- 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 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function configFromArray(config: DateParsingConfig): DateParsingConfig {
const input = [];
let i;
let date;
let currentDate;
Function showElement
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected showElement(): void {
// todo: replace this with component loader usage
if (
!this._element.nativeElement.parentNode ||
this._element.nativeElement.parentNode.nodeType !== Node.ELEMENT_NODE
Function flagReducer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function flagReducer(state: BsDatepickerState,
action: Action): BsDatepickerState {
if (state.view.mode === 'day') {
const flaggedMonths = state.formattedMonths.map(
(formattedMonth, monthIndex) =>