app/services/coms.js
File coms.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Wontfix
Wontfix
import Service, { inject as service } from '@ember/service';
import { isPresent, isEmpty } from '@ember/utils';
import { A } from '@ember/array';
import { tracked } from '@glimmer/tracking';
import IrcAccount from 'hyperchannel/models/account/irc';
ComsService
has 29 functions (exceeds 20 allowed). Consider refactoring. Wontfix
Wontfix
export default class ComsService extends Service {
// Utils
@service logger;
// Data storage
Function handleSockethubMessage
has 43 lines of code (exceeds 30 allowed). Consider refactoring. Wontfix
Wontfix
handleSockethubMessage (message) {
this.log(`${message.context}_message`, 'SH message', message);
if (message.actor.type === 'service') {
this.log(`${message.context}_message`, 'skipping service message');
Function instantiateAccountsAndChannels
has 37 lines of code (exceeds 30 allowed). Consider refactoring. Wontfix
Wontfix
async instantiateAccountsAndChannels () {
return new Promise((resolve, reject) => {
this.storage.rs.kosmos.accounts.getIds().then(accountIds => {
if (isEmpty(accountIds)) {
console.debug('No accounts found in RS');
Function handleSockethubMessage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Wontfix
Wontfix
handleSockethubMessage (message) {
this.log(`${message.context}_message`, 'SH message', message);
if (message.actor.type === 'service') {
this.log(`${message.context}_message`, 'skipping service message');
- 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 loadArchiveMessages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
async loadArchiveMessages (channel, dateStr, options = {}) {
options.minMessages = options.minMessages || 10;
options.maxDays = options.maxDays || 5;
let messagesCount = 0;
- 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"