Function getDom
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
getDom() {
const wrapper = document.createElement('div');
if (!this.modal) {
return wrapper;
Function handleModals
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
handleModals(command, payload, sender) {
if (/CLOSE/g.test(command) && !/OPEN/g.test(command)) {
this.closeModal(false);
} else if (/CANCEL/g.test(command) && !/CONFIRM/g.test(command)) {
this.closeModal(false);
- 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 handleModals
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleModals(command, payload, sender) {
if (/CLOSE/g.test(command) && !/OPEN/g.test(command)) {
this.closeModal(false);
} else if (/CANCEL/g.test(command) && !/CONFIRM/g.test(command)) {
this.closeModal(false);
Function notificationReceived
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
notificationReceived(notification, payload, sender) {
if (notification === 'ALL_MODULES_STARTED') {
this.sendNotification('REGISTER_VOICE_MODULE', this.voice);
} else if (notification === `VOICE_${this.voice.mode}` && sender.name === 'MMM-voice') {
this.handleModals(payload);
- 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 toggleBlur
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
toggleBlur() {
const modules = document.querySelectorAll('.module');
for (let i = 0; i < modules.length; i += 1) {
if (!modules[i].classList.contains('MMM-Modal')) {
if (this.modal) {
- 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"