MyAssetBoard/coinboard-webapp

View on GitHub

Showing 147 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

Line 17 exceeds the maximum line length of 80.
Open

            clearContext: false // leave Jasmine Spec Runner output visible in browser
Severity: Minor
Found in AngularCoinBoard/src/karma.conf.js by eslint

enforce a maximum line length (max-len)

Very long lines of code in any language can be difficult to read. In order to aid in readability and maintainability many coders have developed a convention to limit lines of code to X number of characters (traditionally 80 characters).

var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" }; // very long

Rule Details

This rule enforces a maximum line length to increase code readability and maintainability. The length of a line is defined as the number of Unicode characters in the line.

Options

This rule has a number or object option:

  • "code" (default 80) enforces a maximum line length
  • "tabWidth" (default 4) specifies the character width for tab characters
  • "comments" enforces a maximum line length for comments; defaults to value of code
  • "ignorePattern" ignores lines matching a regular expression; can only match a single line and need to be double escaped when written in YAML or JSON
  • "ignoreComments": true ignores all trailing comments and comments on their own line
  • "ignoreTrailingComments": true ignores only trailing comments
  • "ignoreUrls": true ignores lines that contain a URL
  • "ignoreStrings": true ignores lines that contain a double-quoted or single-quoted string
  • "ignoreTemplateLiterals": true ignores lines that contain a template literal
  • "ignoreRegExpLiterals": true ignores lines that contain a RegExp literal

code

Examples of incorrect code for this rule with the default { "code": 80 } option:

/*eslint max-len: ["error", 80]*/

var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" }, "difficult": "to read" };

Examples of correct code for this rule with the default { "code": 80 } option:

/*eslint max-len: ["error", 80]*/

var foo = {
  "bar": "This is a bar.",
  "baz": { "qux": "This is a qux" },
  "easier": "to read"
};

tabWidth

Examples of incorrect code for this rule with the default { "tabWidth": 4 } option:

/*eslint max-len: ["error", 80, 4]*/

\t  \t  var foo = { "bar": "This is a bar.", "baz": { "qux": "This is a qux" } };

Examples of correct code for this rule with the default { "tabWidth": 4 } option:

/*eslint max-len: ["error", 80, 4]*/

\t  \t  var foo = {
\t  \t  \t  \t  "bar": "This is a bar.",
\t  \t  \t  \t  "baz": { "qux": "This is a qux" }
\t  \t  };

comments

Examples of incorrect code for this rule with the { "comments": 65 } option:

/*eslint max-len: ["error", { "comments": 65 }]*/

/**
 * This is a comment that violates the maximum line length we have specified
**/

ignoreComments

Examples of correct code for this rule with the { "ignoreComments": true } option:

/*eslint max-len: ["error", { "ignoreComments": true }]*/

/**
 * This is a really really really really really really really really really long comment
**/

ignoreTrailingComments

Examples of correct code for this rule with the { "ignoreTrailingComments": true } option:

/*eslint max-len: ["error", { "ignoreTrailingComments": true }]*/

var foo = 'bar'; // This is a really really really really really really really long comment

ignoreUrls

Examples of correct code for this rule with the { "ignoreUrls": true } option:

/*eslint max-len: ["error", { "ignoreUrls": true }]*/

var url = 'https://www.example.com/really/really/really/really/really/really/really/long';

ignoreStrings

Examples of correct code for this rule with the { "ignoreStrings": true } option:

/*eslint max-len: ["error", { "ignoreStrings": true }]*/

var longString = 'this is a really really really really really long string!';

ignoreTemplateLiterals

Examples of correct code for this rule with the { "ignoreTemplateLiterals": true } option:

/*eslint max-len: ["error", { "ignoreTemplateLiterals": true }]*/

var longTemplateLiteral = `this is a really really really really really long template literal!`;

ignoreRegExpLiterals

Examples of correct code for this rule with the { "ignoreRegExpLiterals": true } option:

/*eslint max-len: ["error", { "ignoreRegExpLiterals": true }]*/

var longRegExpLiteral = /this is a really really really really really long regular expression!/;

ignorePattern

Examples of correct code for this rule with the { "ignorePattern": true } option:

/*eslint max-len: ["error", { "ignorePattern": "^\\s*var\\s.+=\\s*require\\s*\\(/" }]*/

var dep = require('really/really/really/really/really/really/really/really/long/module');

Related Rules

  • [complexity](complexity.md)
  • [max-depth](max-depth.md)
  • [max-nested-callbacks](max-nested-callbacks.md)
  • [max-params](max-params.md)
  • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

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

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

                  for (let l in tag) {
                      if (tag[l] && str.match(tag[l])) {
                          el['tg'] += tag[l] + ',';
                      }
                  }
      Severity: Major
      Found in coin_board/controllers/djunk/colors.js and 1 other location - About 1 hr to fix
      coin_board/controllers/djunk/colors.js on lines 61..65

      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 59.

      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

                  for (let l in tag) {
                      if (tag[l] && str.match(tag[l])) {
                          el['tg'] += tag[l] + ',';
                      }
                  }
      Severity: Major
      Found in coin_board/controllers/djunk/colors.js and 1 other location - About 1 hr to fix
      coin_board/controllers/djunk/colors.js on lines 123..127

      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 59.

      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 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

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

                    this.server = this.http.createServer((req, res) => {
                        let resp = {
                            status: 404,
                            error: '**Websocket connection only**',
                        };
            Severity: Major
            Found in coin_board/bin/our_websocket.js and 1 other location - About 1 hr to fix
            coin_board/bin/our_websocket.js on lines 50..57

            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 56.

            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

                        (req, res) => {
                            let resp = {
                                status: 404,
                                error: '**Websocket connection only**',
                            };
            Severity: Major
            Found in coin_board/bin/our_websocket.js and 1 other location - About 1 hr to fix
            coin_board/bin/our_websocket.js on lines 40..47

            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 56.

            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 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
                      Severity
                      Category
                      Status
                      Source
                      Language