addon/hifi-connections/native-audio.js
Sound
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
let Sound = BaseSound.extend({
setup() {
let audio = this.requestControl();
audio.src = this.get('url');
File native-audio.js
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { A } from '@ember/array';
import { run } from '@ember/runloop';
import Mixin from '@ember/object/mixin';
import BaseSound from './base';
import Ember from 'ember';
Function _handleAudioEvent
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_handleAudioEvent(eventName, e) {
if (!this.urlsAreEqual(e.target.src, this.get('url')) && e.target.src !== '') {
// This event is not for us if our srcs aren't equal
// but if the target src is empty it means we've been stopped and in
Function restoreState
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
restoreState() {
let sharedElement = this.audioElement();
let internalElement = this.get('_audioElement');
if (this.get('sharedAudioAccess') && internalElement) {
- 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"