symphonyoss/hubot-symphony

View on GitHub

Showing 122 of 122 total issues

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

  it('createDatafeed should generate a datafeed id', (done) => {
    symphony.createDatafeed()
      .then((response) => {
        assert.equal(nock.datafeedId, response.id);
        done();
Severity: Major
Found in test/symphony-test.js and 2 other locations - About 2 hrs to fix
test/symphony-test.js on lines 65..74
test/symphony-test.js on lines 107..116

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

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

  it('should connect to separate pod url', (done) => {
    symphony.whoAmI()
      .then((response) => {
        assert.equal(nock.botUserId, response.userId);
        done();
Severity: Major
Found in test/symphony-test.js and 2 other locations - About 2 hrs to fix
test/symphony-test.js on lines 107..116
test/symphony-test.js on lines 168..177

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

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

symphony.sessionAuth()
  .then((response) => {
    logger.info(`Session token: ${response.token}`);
  })
  .catch((err) => {
Severity: Major
Found in src/diagnostic.js and 1 other location - About 2 hrs to fix
src/diagnostic.js on lines 63..69

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

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

symphony.keyAuth()
  .then((response) => {
    logger.info(`Key manager token: ${response.token}`);
  })
  .catch((err) => {
Severity: Major
Found in src/diagnostic.js and 1 other location - About 2 hrs to fix
src/diagnostic.js on lines 56..62

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

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

File adapter.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 *    Copyright 2017 Jon Freedman
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
Severity: Minor
Found in src/adapter.js - About 2 hrs to fix

    Function constructor has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(robot: Robot, options: AdapterOptionsType) {
        super(robot);
        this.robot = robot;
    
        if (process.env.HUBOT_SYMPHONY_HOST === undefined || process.env.HUBOT_SYMPHONY_HOST === null) {
    Severity: Major
    Found in src/adapter.js - About 2 hrs to fix

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

          const botConnection = new Symphony({
            host: getEnv('SYMPHONY_HOST'),
            privateKey: getEnv('BOT_USER_KEY'),
            publicKey: getEnv('BOT_USER_CERT'),
            passphrase: getEnv('BOT_USER_PASSWORD'),
      Severity: Major
      Found in it/pingpong.js and 1 other location - About 1 hr to fix
      it/pingpong.js on lines 46..54

      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

          const userConnection = new Symphony({
            host: getEnv('SYMPHONY_HOST'),
            privateKey: getEnv('SENDER_USER_KEY'),
            publicKey: getEnv('SENDER_USER_CERT'),
            passphrase: getEnv('SENDER_USER_PASSWORD'),
      Severity: Major
      Found in it/pingpong.js and 1 other location - About 1 hr to fix
      it/pingpong.js on lines 37..45

      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

      Line 671 exceeds the maximum line length of 120.
      Open

        _httpRequest<T>(method: string, host: string, path: string, headers: HttpHeaderType, body: ?mixed, formData: ?mixed): Promise<T> {
      Severity: Minor
      Found in src/symphony.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/

      Line 703 exceeds the maximum line length of 120.
      Open

                logger.debug(`received ${res.statusCode} response from https://${host}${path}: ${JSON.stringify(data) || 'undefined'}`);
      Severity: Minor
      Found in src/symphony.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/

      Line 699 exceeds the maximum line length of 120.
      Open

                const err = `received ${res.statusCode} response from https://${host}${path}: ${JSON.stringify(data) || 'undefined'}`;
      Severity: Minor
      Found in src/symphony.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/

      Line 26 exceeds the maximum line length of 120.
      Open

      import type {EchoType, SymphonyMessageV2Type, SymphonyMessageV4Type, RoomInfoType, RoomInfoAlternateType} from '../src/symphony';
      Severity: Minor
      Found in test/nock-server.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/

      Line 692 exceeds the maximum line length of 120.
      Open

            logger.debug(`sending ${options.method} to https://${host}${path} [body: ${JSON.stringify(options.body) || 'undefined'}] [formData: ${JSON.stringify(options.formData) || 'undefined'}]`);
      Severity: Minor
      Found in src/symphony.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/

      Function run has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        run() {
          this.robot.logger.info('Initialising...');
      
          const getEnv = function(key: string, defaultVal: ?string): string {
            const value = process.env[key];
      Severity: Minor
      Found in src/adapter.js - About 1 hr to fix

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

            const keyAuthScope = nock(kmHost)
            /* eslint-enable no-unused-vars */
              .matchHeader('sessionToken', checkHeaderMissing)
              .matchHeader('keyManagerToken', checkHeaderMissing)
              .post('/keyauth/v1/authenticate')
        Severity: Major
        Found in test/nock-server.js and 1 other location - About 1 hr to fix
        test/nock-server.js on lines 168..176

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

        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

            const authScope = nock(sessionAuthHost)
            /* eslint-enable no-unused-vars */
              .matchHeader('sessionToken', checkHeaderMissing)
              .matchHeader('keyManagerToken', checkHeaderMissing)
              .post('/sessionauth/v1/authenticate')
        Severity: Major
        Found in test/nock-server.js and 1 other location - About 1 hr to fix
        test/nock-server.js on lines 179..187

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

        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 (user === undefined) {
                  logger.debug(`Creating userId ${id} = ${JSON.stringify(options)}`);
                  user = new User(id, options);
                  self.users.set(id, user);
                }
        Severity: Major
        Found in test/fakes.js and 1 other location - About 1 hr to fix
        test/fakes.js on lines 84..88

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

        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 (options && options.room && (!user.room || user.room !== options.room)) {
                  logger.debug(`Updating userId ${id} = ${JSON.stringify(options)}`);
                  user = new User(id, options);
                  self.users.set(id, user);
                }
        Severity: Major
        Found in test/fakes.js and 1 other location - About 1 hr to fix
        test/fakes.js on lines 79..83

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

        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 constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor() {
            super();
        
            // echo any errors
            this.on('error', function(err: Error) {
        Severity: Minor
        Found in test/fakes.js - About 1 hr to fix

          Function _httpRequest has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _httpRequest<T>(method: string, host: string, path: string, headers: HttpHeaderType, body: ?mixed, formData: ?mixed): Promise<T> {
              let self = this;
              return new Promise((resolve, reject) => {
                let options = {
                  baseUrl: `https://${host}`,
          Severity: Minor
          Found in src/symphony.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language