bbc/flashheart

View on GitHub

Showing 73 of 73 total issues

Function buildMemberNav has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function buildMemberNav(items, itemHeading, itemsSeen, linktoFn) {
    var nav = '';

    if (items && items.length) {
        var itemsNav = '';
Severity: Minor
Found in docconfig/template/publish.js - About 1 hr to fix

    Function defaultDoc has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        defaultDoc  : function ( schemaName ) {
            if ( sys.isEmpty( schemaName ) ) {
                schemaName = this._defaultSchemaName;
            }
            var newdoc = {};
    Severity: Minor
    Found in docconfig/template/fixtures/documents/schema.js - About 1 hr to fix

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

          const res = await req
            .headers(_.get(opts, 'headers'))
            .timeout(this.timeout)
            .query(_.get(opts, 'qs'))
            .asResponse();
      Severity: Major
      Found in src/httpTransport/client.ts and 1 other location - About 1 hr to fix
      src/httpTransport/client.ts on lines 68..72

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

      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

          const res = await req
            .headers(_.get(opts, 'headers'))
            .timeout(this.timeout)
            .query(_.get(opts, 'qs'))
            .asResponse();
      Severity: Major
      Found in src/httpTransport/client.ts and 1 other location - About 1 hr to fix
      src/httpTransport/client.ts on lines 49..53

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

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

                  set : function ( val ) {
                      async.waterfall( [
                          function ( done ) {
                              if ( sys.isFunction( options.validator ) ) {
                                  if ( options.validatorAsync ) {
      Severity: Minor
      Found in docconfig/template/fixtures/documents/binder.js - About 1 hr to fix

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

        function configureStatsEvents(params: StatsEventsOpts): void {
          const {
            client,
            namespace,
            statName,
        Severity: Minor
        Found in src/httpTransport/configuration.ts - About 1 hr to fix

          Function processExpressionObject has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function processExpressionObject( val, key ) {
              var operator;
              if ( sys.isObject( val ) ) {
                  var opKeys = Object.keys( val );
                  var op = opKeys[ 0 ];
          Severity: Minor
          Found in docconfig/template/fixtures/documents/probe.js - About 1 hr to fix

            Function buildNav has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function buildNav(members) {
                var nav = '<h2><a href="index.html">Home</a></h2>';
                var seen = {};
                var seenTutorials = {};
            
            
            Severity: Minor
            Found in docconfig/template/publish.js - About 1 hr to fix

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

                  $in        : function ( qu, value ) {
                      var operands;
              
                      operands = sys.flatten( qu.operands );
                      return sys.indexOf( operands, value ) > -1;
              Severity: Major
              Found in docconfig/template/fixtures/documents/probe.js and 1 other location - About 1 hr to fix
              docconfig/template/fixtures/documents/probe.js on lines 487..492

              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

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

                  $nin       : function ( qu, value ) {
                      var operands;
              
                      operands = sys.flatten( qu.operands );
                      return sys.indexOf( operands, value ) === -1;
              Severity: Major
              Found in docconfig/template/fixtures/documents/probe.js and 1 other location - About 1 hr to fix
              docconfig/template/fixtures/documents/probe.js on lines 471..476

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

                constructor(client: RestClient, params: ClientParams) {
                  const maxFailures = _.get(params, 'circuitbreaker.maxFailures', DEFAULT_MAX_FAILURES);
                  const resetTimeout = _.get(params, 'circuitbreaker.resetTimeout', DEFAULT_RESET_TIMEOUT);
              
                  const opts = {
              Severity: Minor
              Found in src/circuitBreaker/circuitBreaker.ts - About 1 hr to fix

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

                function execQuery( obj, qu, shortCircuit, stopOnFirst ) {
                    var arrayResults = [];
                    var keyResults = [];
                    sys.each( obj, function ( record, key ) {
                        var expr, result, test, _i, _len;
                Severity: Minor
                Found in docconfig/template/fixtures/documents/probe.js - About 1 hr to fix

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

                  function needsSignature(doclet) {
                      var needsSig = false;
                  
                      // function and class definitions always get a signature
                      if (doclet.kind === 'function' || doclet.kind === 'class') {
                  Severity: Minor
                  Found in docconfig/template/publish.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

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

                      events.on(`cache.${eventName}.stale`, () => {
                        client.increment(`${namespace}.${statName}.stale`, 1, 0.05);
                      });
                  Severity: Major
                  Found in src/httpTransport/configuration.ts and 4 other locations - About 50 mins to fix
                  src/httpTransport/configuration.ts on lines 70..72
                  src/httpTransport/configuration.ts on lines 73..75
                  src/httpTransport/configuration.ts on lines 85..87
                  src/httpTransport/configuration.ts on lines 88..90

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

                  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 5 locations. Consider refactoring.
                  Open

                      events.on(`cache.${eventName}.hit`, () => {
                        client.increment(`${namespace}.${statName}.hits`, 1, 0.05);
                      });
                  Severity: Major
                  Found in src/httpTransport/configuration.ts and 4 other locations - About 50 mins to fix
                  src/httpTransport/configuration.ts on lines 73..75
                  src/httpTransport/configuration.ts on lines 82..84
                  src/httpTransport/configuration.ts on lines 85..87
                  src/httpTransport/configuration.ts on lines 88..90

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

                  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 5 locations. Consider refactoring.
                  Open

                      events.on(`cache.${eventName}.revalidate`, () => {
                        client.increment(`${namespace}.${statName}.revalidate`, 1, 0.05);
                      });
                  Severity: Major
                  Found in src/httpTransport/configuration.ts and 4 other locations - About 50 mins to fix
                  src/httpTransport/configuration.ts on lines 70..72
                  src/httpTransport/configuration.ts on lines 73..75
                  src/httpTransport/configuration.ts on lines 82..84
                  src/httpTransport/configuration.ts on lines 85..87

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

                  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 5 locations. Consider refactoring.
                  Open

                      events.on(`cache.${eventName}.miss`, () => {
                        client.increment(`${namespace}.${statName}.misses`, 1, 0.05);
                      });
                  Severity: Major
                  Found in src/httpTransport/configuration.ts and 4 other locations - About 50 mins to fix
                  src/httpTransport/configuration.ts on lines 70..72
                  src/httpTransport/configuration.ts on lines 82..84
                  src/httpTransport/configuration.ts on lines 85..87
                  src/httpTransport/configuration.ts on lines 88..90

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

                  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 5 locations. Consider refactoring.
                  Open

                      events.on(`cache.${eventName}.revalidate.error`, () => {
                        client.increment(`${namespace}.${statName}.revalidate.error`, 1, 0.05);
                      });
                  Severity: Major
                  Found in src/httpTransport/configuration.ts and 4 other locations - About 50 mins to fix
                  src/httpTransport/configuration.ts on lines 70..72
                  src/httpTransport/configuration.ts on lines 73..75
                  src/httpTransport/configuration.ts on lines 82..84
                  src/httpTransport/configuration.ts on lines 88..90

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

                  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

                    async put(uri: string, body: string, opts?: RequestOptions): Promise<Response> {
                      return this.executor('put', ...arguments);
                    }
                  Severity: Major
                  Found in src/circuitBreaker/circuitBreaker.ts and 2 other locations - About 50 mins to fix
                  src/circuitBreaker/circuitBreaker.ts on lines 71..73
                  src/circuitBreaker/circuitBreaker.ts on lines 75..77

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

                  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

                    async patch(uri: string, body: string, opts?: RequestOptions): Promise<Response> {
                      return this.executor('patch', ...arguments);
                    }
                  Severity: Major
                  Found in src/circuitBreaker/circuitBreaker.ts and 2 other locations - About 50 mins to fix
                  src/circuitBreaker/circuitBreaker.ts on lines 75..77
                  src/circuitBreaker/circuitBreaker.ts on lines 79..81

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language