Chocobozzz/PeerTube

View on GitHub
client/src/assets/player/shared/settings/settings-menu-item.ts

Summary

Maintainability
B
5 hrs
Test Coverage

Function update has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
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') {
Severity: Minor
Found in client/src/assets/player/shared/settings/settings-menu-item.ts - About 2 hrs to fix

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

  constructor (player: videojs.Player, options?: SettingsMenuItemOptions) {
    super(player, options)

    this.settingsButton = options.menuButton
    this.dialog = this.settingsButton.dialog
Severity: Minor
Found in client/src/assets/player/shared/settings/settings-menu-item.ts - About 1 hr to fix

    Function update has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    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') {
    Severity: Minor
    Found in client/src/assets/player/shared/settings/settings-menu-item.ts - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status