MyAssetBoard/coinboard-webapp

View on GitHub

Showing 18 of 147 total issues

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

DataJunk.prototype.flags = function (col, dt, res, ts) {
    for (let c in col.sets) {
        if (col.sets.hasOwnProperty('a')) {
            for (let d in col.sets[c]) {
                if (col.sets[c][d]) {
Severity: Minor
Found in coin_board/controllers/datajunk_methods.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

Consider simplifying this complex logical expression.
Open

    if (!req.body.name || !req.body.name.length ||
        !req.body.sourcegenre || !req.body.sourcetype ||
        !req.body.sourcename || !req.body.sourcereqpath ||
        !(req.session && req.session.userId)) {
        let err = new Error('All fields required.');
Severity: Critical
Found in coin_board/routes/datajunk/datajunk.js - About 1 hr to fix

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

        getparsed: function (dset, ts) {
            let rt = [];
            for (let el in dset) {
                if (dset[el]) {
                    for (let k in dset[el].feed) {
    Severity: Minor
    Found in coin_board/controllers/djunk/eatdiner.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 eat has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    DataJunk.prototype.eat = function (dset) {
        let ts = {
            nb: 0,
            val: 0,
        };
    Severity: Minor
    Found in coin_board/controllers/datajunk_methods.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 addsource has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    ScrapperSchemas.statics.addsource = (uinput, callback) => {
        let Sources = mongoose.model('Sources', SourcesSchema);
        let whatsource = 'Sources.' + uinput.sourcegenre + '.' + uinput.sourcetype;
        let newsource = {
            name: uinput.sourcename,
    Severity: Minor
    Found in coin_board/schemas/scrapper.js - About 1 hr to fix

      Function setpagecontent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function setpagecontent (req, pageparam, dbr) {
          return new Promise((resolve, reject) => {
              let res = {};
              for (let paths in roads) {
                  if (roads.hasOwnProperty(paths) && req.match(roads[paths].path)) {
      Severity: Minor
      Found in coin_board/routes/assets/assets.js - About 1 hr to fix

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

        CbWebsocket.prototype.startmeup = function () {
            let log = 'WEBSOCKET - server is listening on :\n';
            log += 'addr: [' + this.conf.myip + '], port ' + this.port;
            let _this = this;
        
        
        Severity: Minor
        Found in coin_board/bin/our_websocket.js - About 1 hr to fix

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

                  res: function (el) {
                      for (let x in this.bull.sets) {
                          if (this.bull.sets[x]) {
                              for (let y in this.bull.sets.x) {
                                  if (el.match(this.bull.sets.x[y])) {
          Severity: Minor
          Found in coin_board/controllers/djunk/colors.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 exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function (config) {
              config.set({
                  basePath: '../',
                  frameworks: ['jasmine', '@angular-devkit/build-angular'],
                  plugins: [
          Severity: Minor
          Found in AngularCoinBoard/src/karma.conf.js - About 1 hr to fix

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

                fields: function () {
                    return {
                        username: {
                            type: graphql.GraphQLString,
                        },
            Severity: Minor
            Found in coin_board/schemas/graph_user.js - About 1 hr to fix

              Function getsums has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              N26Api.prototype.getsums = function (tr, key) {
                  let sum = 0;
                  let min = 0;
                  let plus = 0;
                  let res = {
              Severity: Minor
              Found in coin_board/controllers/APIS/n26_api.js - About 55 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 addapi has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              UserSchema.statics.addapi = function (id,
                  apitype, apiid, apikey, apisecret, callback) {
              Severity: Minor
              Found in coin_board/schemas/user.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if (d.feed && d.dm) {
                                                    res.locals.news = d.feed;
                                                    res.locals.dms = d.dm;
                                                }
                Severity: Major
                Found in coin_board/routes/assets/assets.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if (col.check(obj)) {
                                          res[ts.val] = this.eatd.getres(obj, ts);
                                      }
                  Severity: Major
                  Found in coin_board/controllers/datajunk_methods.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (d.blocks) {
                                                        res.locals.routes = d.blocks;
                                                    }
                    Severity: Major
                    Found in coin_board/routes/assets/assets.js - About 45 mins to fix

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

                      CbBot.prototype.runcommands = function (cmd, ctx, who) {
                          let _this = this;
                          let exec = 0;
                          for (let el in this.cmds) {
                              if (this.cmds.hasOwnProperty(el) &&
                      Severity: Minor
                      Found in coin_board/bots/coinboardbot.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

                      Consider simplifying this complex logical expression.
                      Open

                          if (req.body.apitype && req.body.apiid && req.body.apikey &&
                              req.body.apisecret && req.session && req.session.userId) {
                              let dup = param.assets;
                              User.addapi(req.session.userId, req.body.apitype,
                                  req.body.apiid, req.body.apikey, req.body.apisecret,
                      Severity: Major
                      Found in coin_board/routes/assets/assets.js - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                            if (req.body.assettype && req.body.assetid && req.body.assetticker &&
                                req.body.assetqtt && req.session && req.session.userId) {
                                let dup = param.assets;
                                User.addasset(req.session.userId, req.body.assettype,
                                    req.body.assetid, req.body.assetticker, req.body.assetqtt,
                        Severity: Major
                        Found in coin_board/routes/assets/assets.js - About 40 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language