TinyMan/node-jeanne

View on GitHub

Showing 15 of 17 total issues

Function exec has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        exec: async function (transcripts) {
            try {
                for (let name in commands) {
                    let command = commands[name]
                    if (!command.func) return
Severity: Minor
Found in lib/mumble/extensions/voice-command/voice-command.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 _transform has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    _transform(chunk, encoding, callback) {
        // return callback(null, chunk)
        this.retry = null
        const sampleAvailable = Math.min(this.input ? this.input.availSamples() : Number.MAX_VALUE, chunk.length / this.sampleByteLength)
        if (this.input && sampleAvailable > 0) {
Severity: Minor
Found in lib/mumble/audio/mixer.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 init has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init: stumble => {
        const player = stumble.space.get('youtube-player')
        player.on('play', v => stumble.execute("youtube::info::playing", v))
        player.on('add', v => stumble.execute("youtube::info::added", v))
        player.on('addnext', v => stumble.execute("youtube::info::next", v))
Severity: Minor
Found in lib/mumble/extensions/youtube/youtube.info.js - About 1 hr to fix

    Function exec has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            exec: async function (data) {
                try {
                    const links = utils.getLinks(data.message)
                    const givenId = parse(links.length > 0 ? links[0] : data.message)
                    const isId = /^UC[a-zA-Z0-9_-]{1,}$/.test(givenId)
    Severity: Minor
    Found in lib/mumble/extensions/youtube/youtube.suscription.js - About 1 hr to fix

      Function exec has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          exec: function (data) {
              const stumble = this
              const links = utils.getLinks(data.message)
              let link = ""
              if (links.length < 1) {
      Severity: Minor
      Found in lib/mumble/extensions/radio.js - About 1 hr to fix

        Function exec has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            exec: function (data) {
                const stumble = this
                const links = utils.getLinks(data.message)
                let link = ""
                if (links.length < 1) {
        Severity: Minor
        Found in lib/mumble/extensions/radio.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 init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            init: async stumble => {
                return new Error('Not implemented')
                try {
                    const phone = new sylvia()
                    stumble.space.set('phone', phone)
        Severity: Minor
        Found in lib/mumble/extensions/phone.js - About 1 hr to fix

          Function main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function main() {
              s.client.connection.on('error', e => {
                  logger.error(e)
                  logger.log(e.data)
              })
          Severity: Minor
          Found in lib/main.js - About 1 hr to fix

            Function info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                    exec: function info(data) {
                        const name = data.message || 'info';
                        const aliased = data.message && this.aliases.get(name);
                        const target = this.commands.get(aliased || name);
            
            
            Severity: Minor
            Found in lib/mumble/extension.js - About 45 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

            Function _read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                _read() {
                    this.retry = null
                    let samples = Number.MAX_VALUE
                    const keys = Object.keys(this.inputs)
                    const keyslenth = keys.length
            Severity: Minor
            Found in lib/mumble/audio/mixer.js - About 45 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

            Function _write has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                _write(chunk, encoding, cb) {
                    clearTimeout(this.timeout)
                    if (this.pending) {
                        this.acc.push(chunk)
                    } else {
            Severity: Minor
            Found in lib/model/speechstream.js - About 35 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

            Function convertISO8601ToObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function convertISO8601ToObject(input) {
                var reptms = /^PT(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?$/
                var hours = 0,
                    minutes = 0,
                    seconds = 0,
            Severity: Minor
            Found in lib/utils.js - About 35 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

            Function exec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                exec: function ({ filename, user }) {
                    const file = path.resolve(this.config.extensions.voice.folder, filename)
            
                    const player = this.space.get('player')
                    if (!player.playing) {
            Severity: Minor
            Found in lib/mumble/extensions/voice.js - About 35 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

            Function convertISO8601ToSring has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function convertISO8601ToSring(input) {
                const dur = convertISO8601ToObject(input)
                let str = ""
                if (dur.hours > 0) {
                    if (str.length > 0 && dur.hours < 10) str += "0"
            Severity: Minor
            Found in lib/utils.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

            Function exec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    exec: async function (data) {
                        try {
                            const links = utils.getLinks(data.message)
                            const givenId = parse(links.length > 0 ? links[0] : data.message)
                            const isId = /^UC[a-zA-Z0-9_-]{1,}$/.test(givenId)
            Severity: Minor
            Found in lib/mumble/extensions/youtube/youtube.suscription.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

            Severity
            Category
            Status
            Source
            Language