bbyars/mountebank

View on GitHub

Showing 386 of 386 total issues

Avoid too many return statements within this function.
Open

            return Promise.reject(exceptions.ValidationError('unrecognized response type',
                { source: helpers.clone(responseConfig) }));
Severity: Major
Found in src/models/responseResolver.js - About 30 mins to fix

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

            lockAcquireDuration: new prometheus.Histogram({
                name: 'mb_lock_acquire_duration_seconds',
                help: 'Time it takes to acquire a file lock',
                buckets: [0.1, 0.2, 0.5, 1, 3, 5, 10, 30],
                labelNames: ['caller']
    Severity: Minor
    Found in src/models/filesystemBackedImpostersRepository.js and 1 other location - About 30 mins to fix
    src/models/responseResolver.js on lines 18..23

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

    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

    Avoid too many return statements within this function.
    Open

            return 'this month';
    Severity: Major
    Found in src/util/date.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return '';
      Severity: Major
      Found in src/util/date.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return this.inMemory();
        Severity: Major
        Found in src/models/impostersRepository.js - About 30 mins to fix

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

              proxyDuration: new prometheus.Histogram({
                  name: 'mb_proxy_duration_seconds',
                  help: 'Time it takes to get the response from the downstream service',
                  buckets: [0.1, 0.2, 0.5, 1, 3, 5, 10, 30],
                  labelNames: ['imposter']
          Severity: Minor
          Found in src/models/responseResolver.js and 1 other location - About 30 mins to fix
          src/models/filesystemBackedImpostersRepository.js on lines 95..100

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

          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

          marked Regular Expression Denial of Service
          Open

              "marked": {
                "version": "4.1.1",
                "resolved": "https://registry.npmjs.org/marked/-/marked-4.1.1.tgz",
                "integrity": "sha512-0cNMnTcUJPxbA6uWmCmjWz4NJRe/0Xfk2NhXCUHjew9qJzFN20krFnsUe7QynwqOwa5m1fZ4UDg0ycKFVC0ccw==",
                "dev": true
          Severity: Minor
          Found in package-lock.json by nodesecurity

          Regular Expression Denial of Service

          Overview:

          The marked module is vulnerable to a regular expression denial of service. Based on the information published in the public issue, 1k characters can block for around 6 seconds.

          Recommendation:

          Consider another markdown parser until the issue can be addressed.

          marked Regular Expression Denial of Service
          Open

              "marked": {
                "version": "4.1.1",
                "resolved": "https://registry.npmjs.org/marked/-/marked-4.1.1.tgz",
                "integrity": "sha512-0cNMnTcUJPxbA6uWmCmjWz4NJRe/0Xfk2NhXCUHjew9qJzFN20krFnsUe7QynwqOwa5m1fZ4UDg0ycKFVC0ccw==",
                "dev": true
          Severity: Minor
          Found in package-lock.json by nodesecurity

          Regular Expression Denial of Service

          Overview:

          The marked module is vulnerable to a regular expression denial of service. Based on the information published in the public issue, 1k characters can block for around 6 seconds.

          Recommendation:

          Consider another markdown parser until the issue can be addressed.

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

          function parseLogConfiguration (args) {
              // Not defaulted in yargs so we can test yargs value without defaulting interfering.
              // This is needed for backwards compatibility with older CLI options.
              const defaultConfig = {
                  level: 'info',
          Severity: Minor
          Found in src/cli/cli.js - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

          function create (logfile) {
              function getLogEntries () {
                  if (!logfile || !fs.existsSync(logfile)) {
                      return [{ level: 'error', message: 'No logfile' }];
                  }
          Severity: Minor
          Found in src/controllers/logsController.js - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

          function rawArgvIndexFor (key) {
              // Use raw process.argv to ensure user actually passed the parameter, bypassing
              // yargs defaulting. Also check alias.
              let index = process.argv.indexOf(`--${key}`);
              if (index < 0) {
          Severity: Minor
          Found in src/cli/cli.js - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Rule doesn't have all its properties in alphabetical order.
          Open

          body {

          Rule doesn't have all its properties in alphabetical order.
          Open

          header p {

          Using width with padding-left can sometimes make elements larger than you expect.
          Open

              padding-left: 1em;

          Don't use IDs in selectors.
          Open

          #sidenav {

          Rule doesn't have all its properties in alphabetical order.
          Open

          footer nav {

          Rule doesn't have all its properties in alphabetical order.
          Open

          nav.horizontal a:link, a:visited {

          Using width with padding can sometimes make elements larger than you expect.
          Open

              padding: 4px;

          Rule doesn't have all its properties in alphabetical order.
          Open

          nav.vertical p {

          Rule doesn't have all its properties in alphabetical order.
          Open

          #sidenav {
          Severity
          Category
          Status
          Source
          Language