client/src/assets/player/shared/settings/settings-menu-item.ts
Function update
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
update (event?: any) {
// Playback rate menu button doesn't get a vjs-selected class
// or sets options_['selected'] on the selected playback rate.
// Thus we get the submenu value based on the labelEl of playbackRateMenuButton
if (this.subMenu.name() === 'PlaybackRateMenuButton') {
- 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 constructor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor (player: videojs.Player, options?: SettingsMenuItemOptions) {
super(player, options)
this.settingsButton = options.menuButton
this.dialog = this.settingsButton.dialog
Function update
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
update (event?: any) {
// Playback rate menu button doesn't get a vjs-selected class
// or sets options_['selected'] on the selected playback rate.
// Thus we get the submenu value based on the labelEl of playbackRateMenuButton
if (this.subMenu.name() === 'PlaybackRateMenuButton') {