Function ngOnChanges
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Wontfix
ngOnChanges(changesObj) {
if (changesObj.isMeridiem) {
if (changesObj.isMeridiem.currentValue) {
this.hourFormat = 'hh';
this.noonRelativity = this.start.format('a');
- Read upRead up
- Create a ticketCreate a ticket
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
In the class "TimePickerComponent", the directive input property "inputHours" should not be renamed.
However, you should use an alias when the directive name is also an input property, and the directive name
doesn't describe the property. In this last case, you can disable this rule with tslint:disable-next-line:no-input-rename
. Invalid
@Input('hours') inputHours: number;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-input-rename
Disallows renaming directive inputs by providing a string to the decorator.
See more at https://angular.io/styleguide#style-05-13.
Rationale
Two names for the same property (one private, one public) is inherently confusing.
Notes
- TypeScript Only
Config
Not configurable.
For more information see this page.
@Outputs should not be renamed Invalid
@Output('minutesChange') inputMinutesChange = new EventEmitter<number>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-output-rename
Disallows renaming directive outputs by providing a string to the decorator.
See more at https://angular.io/styleguide#style-05-13.
Rationale
Two names for the same property (one private, one public) is inherently confusing.
Notes
- TypeScript Only
Config
Not configurable.
For more information see this page.
In the class "TimePickerComponent", the directive input property "inputMinutes" should not be renamed.
However, you should use an alias when the directive name is also an input property, and the directive name
doesn't describe the property. In this last case, you can disable this rule with tslint:disable-next-line:no-input-rename
. Invalid
@Input('minutes') inputMinutes: number;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-input-rename
Disallows renaming directive inputs by providing a string to the decorator.
See more at https://angular.io/styleguide#style-05-13.
Rationale
Two names for the same property (one private, one public) is inherently confusing.
Notes
- TypeScript Only
Config
Not configurable.
For more information see this page.
@Outputs should not be renamed Invalid
@Output('hoursChange') inputHoursChange = new EventEmitter<number>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-output-rename
Disallows renaming directive outputs by providing a string to the decorator.
See more at https://angular.io/styleguide#style-05-13.
Rationale
Two names for the same property (one private, one public) is inherently confusing.
Notes
- TypeScript Only
Config
Not configurable.
For more information see this page.