67P/hyperchannel

View on GitHub
app/services/coms.js

Summary

Maintainability
A
25 mins
Test Coverage

File coms.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
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';
Severity: Minor
Found in app/services/coms.js - About 3 hrs to fix

    ComsService has 29 functions (exceeds 20 allowed). Consider refactoring.
    Wontfix

    export default class ComsService extends Service {
    
      // Utils
      @service logger;
      // Data storage
    Severity: Minor
    Found in app/services/coms.js - About 3 hrs to fix

      Function handleSockethubMessage has 43 lines of code (exceeds 30 allowed). Consider refactoring.
      Wontfix

        handleSockethubMessage (message) {
          this.log(`${message.context}_message`, 'SH message', message);
      
          if (message.actor.type === 'service') {
            this.log(`${message.context}_message`, 'skipping service message');
      Severity: Minor
      Found in app/services/coms.js - About 1 hr to fix

        Function instantiateAccountsAndChannels has 37 lines of code (exceeds 30 allowed). Consider refactoring.
        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');
        Severity: Minor
        Found in app/services/coms.js - About 1 hr to fix

          Function handleSockethubMessage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Wontfix

            handleSockethubMessage (message) {
              this.log(`${message.context}_message`, 'SH message', message);
          
              if (message.actor.type === 'service') {
                this.log(`${message.context}_message`, 'skipping service message');
          Severity: Minor
          Found in app/services/coms.js - About 1 hr 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 loadArchiveMessages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            async loadArchiveMessages (channel, dateStr, options = {}) {
              options.minMessages = options.minMessages || 10;
              options.maxDays = options.maxDays || 5;
          
              let messagesCount = 0;
          Severity: Minor
          Found in app/services/coms.js - About 25 mins 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

          There are no issues that match your filters.

          Category
          Status