imrefazekas/harcon

View on GitHub

Showing 85 of 85 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (self.config.bender && self.config.bender.enabled && self.config.bender.forced && self.config.bender.privileged.indexOf(self.name) === -1 ) {
        // division, event, parameters
        let _division = self.config.division
        let _event = 'FireBender.exec'
        let _params = [ division, event, params ]
Severity: Major
Found in lib/Firestarter.js and 1 other location - About 5 hrs to fix
lib/Firestarter.js on lines 268..277

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 137.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    if (self.config.bender && self.config.bender.enabled && self.config.bender.forced && self.config.bender.privileged.indexOf(self.name) === -1 ) {
        // division, event, parameters
        let _division = self.config.division
        let _event = 'FireBender.exec'
        let _callParams = [ division, event, callParams ]
Severity: Major
Found in lib/Firestarter.js and 1 other location - About 5 hrs to fix
lib/Firestarter.js on lines 305..314

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 137.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function exports has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (self) {
    return {
        _id: clerobee.generate(),
        firestarter: self,
        notifyTos: { },
Severity: Major
Found in lib/ext/Entity.js - About 4 hrs to fix

    File Inflicter.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    let Communication = require('../lib/Communication')
    let Barrel = require('../lib/Barrel')
    let Blower = require('../lib/Blower')
    let Firestormstarter = require('../lib/Firestormstarter')
    let Flamestarter = require('../lib/Flamestarter')
    Severity: Minor
    Found in lib/Inflicter.js - About 4 hrs to fix

      Function exports has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports = function (self) {
          return {
              _id: clerobee.generate(),
              firestarter: self,
              notifyTos: { },
      Severity: Minor
      Found in lib/ext/Entity.js - About 3 hrs 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 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      inflicter.init = async function () {
          let self = this
      
          self.logger.harconlog( null, 'Harcon initiating...', { }, 'info' )
      
      
      Severity: Major
      Found in lib/Inflicter.js - About 3 hrs to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        function isLast (array, value, defaultValue) {
            if ( array.length === 0 ) return false
        
            let element = array.pop()
            let found = Array.isArray(value) ? value.indexOf(element) > -1 : element === value
        Severity: Major
        Found in lib/Flamestarter.js and 1 other location - About 3 hrs to fix
        lib/Firestormstarter.js on lines 21..29

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                let requestFn = self.auditor ? function ( ...parameters ) {
                    return self.burst( extendComm(), Communication.MODE_REQUEST, parameters )
                } : function ( ...parameters ) {
                    let args = [ null, null, self.division ].concat( parameters )
                    return self.burst( extendComm(), Communication.MODE_REQUEST, args )
        Severity: Major
        Found in lib/Firestarter.js and 2 other locations - About 3 hrs to fix
        lib/Firestarter.js on lines 226..231
        lib/Firestarter.js on lines 232..237

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        function isLast (array, value, defaultValue) {
            if ( array.length === 0 ) return false
        
            let element = array.pop()
            let found = Array.isArray(value) ? value.indexOf(element) > -1 : element === value
        Severity: Major
        Found in lib/Firestormstarter.js and 1 other location - About 3 hrs to fix
        lib/Flamestarter.js on lines 9..17

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                let delegateFn = self.auditor ? function ( ...parameters ) {
                    return self.burst( extendComm(), Communication.MODE_DELEGATE, parameters )
                } : function ( ...parameters ) {
                    let args = [ null, null, self.division ].concat( parameters )
                    return self.burst( extendComm(), Communication.MODE_DELEGATE, args )
        Severity: Major
        Found in lib/Firestarter.js and 2 other locations - About 3 hrs to fix
        lib/Firestarter.js on lines 220..225
        lib/Firestarter.js on lines 226..231

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                let informFn = self.auditor ? function ( ...parameters ) {
                    return self.burst( extendComm(), Communication.MODE_INFORM, parameters )
                } : function ( ...parameters ) {
                    let args = [ null, null, self.division ].concat( parameters )
                    return self.burst( extendComm(), Communication.MODE_INFORM, args )
        Severity: Major
        Found in lib/Firestarter.js and 2 other locations - About 3 hrs to fix
        lib/Firestarter.js on lines 220..225
        lib/Firestarter.js on lines 232..237

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 96.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function purify has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        function purify ( obj, config, level ) {
            if (!obj) return obj
            if ( _.isDate(obj) || _.isBoolean(obj) || _.isNumber(obj) || _.isString(obj) || _.isRegExp(obj) )
                return obj
            if ( _.isFunction(obj) )
        Severity: Minor
        Found in lib/Inflicter.js - About 2 hrs 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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                request: self.auditor ? async function ( ...params ) {
                    return self.ignite( Communication.MODE_REQUEST, ...params )
                } : async function ( ...params ) {
                    let args = [ null, null, self.division ].concat( params )
                    return self.ignite( Communication.MODE_REQUEST, ...args )
        Severity: Major
        Found in lib/ext/Entity.js and 2 other locations - About 2 hrs to fix
        lib/ext/Entity.js on lines 53..58
        lib/ext/Entity.js on lines 59..64

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 90.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                inform: self.auditor ? async function ( ...params ) {
                    return self.ignite( Communication.MODE_INFORM, ...params )
                } : async function ( ...params ) {
                    let args = [ null, null, self.division ].concat( params )
                    return self.ignite( Communication.MODE_INFORM, ...args )
        Severity: Major
        Found in lib/ext/Entity.js and 2 other locations - About 2 hrs to fix
        lib/ext/Entity.js on lines 47..52
        lib/ext/Entity.js on lines 59..64

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 90.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                delegate: self.auditor ? async function ( ...params ) {
                    return self.ignite( Communication.MODE_DELEGATE, ...params )
                } : async function ( ...params ) {
                    let args = [ null, null, self.division ].concat( params )
                    return self.ignite( Communication.MODE_DELEGATE, ...args )
        Severity: Major
        Found in lib/ext/Entity.js and 2 other locations - About 2 hrs to fix
        lib/ext/Entity.js on lines 47..52
        lib/ext/Entity.js on lines 53..58

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 90.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function burn has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        firestarter.burn = async function ( comm ) {
            let self = this
            return new Promise( async (resolve, reject) => {
                if ( !self.concealed )
                    self.logger.harconlog(null, 'Burning', comm.shallow(), 'trace' )
        Severity: Minor
        Found in lib/Firestarter.js - About 2 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  setInterval ( fn, interval ) {
                      var self = this
                      let ref = setInterval( function () {
                          fn().catch( self.harconlog )
                      }, interval )
          Severity: Major
          Found in lib/ext/Entity.js and 1 other location - About 1 hr to fix
          lib/ext/Entity.js on lines 91..98

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 74.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                  setTimeout ( fn, timeout ) {
                      var self = this
                      let ref = setTimeout( function () {
                          fn().catch( self.harconlog )
                      }, timeout)
          Severity: Major
          Found in lib/ext/Entity.js and 1 other location - About 1 hr to fix
          lib/ext/Entity.js on lines 102..109

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 74.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              exec: async function ( division, event, parameters, terms ) {
                  let self = this
          
                  division = division || self.division
                  var divEvent = division + SEPARATOR + event
          Severity: Minor
          Found in lib/FireBender.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 newCommunication has 15 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          exports.newCommunication = function ( mode, originalId, flowId, externalId, sourceDivision, source, sourceNodeID, division, event, params, callback, responder, responderNodeID, error, response ) {
          Severity: Major
          Found in lib/Communication.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language