enclose-io/compiler

View on GitHub
current/lib/querystring.js

Summary

Maintainability
F
3 wks
Test Coverage

Function parse has a Cognitive Complexity of 124 (exceeds 5 allowed). Consider refactoring.
Open

function parse(qs, sep, eq, options) {
  const obj = ObjectCreate(null);

  if (typeof qs !== 'string' || qs.length === 0) {
    return obj;
Severity: Minor
Found in current/lib/querystring.js - About 2 days 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 stringify has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

function stringify(obj, sep, eq, options) {
  sep = sep || '&';
  eq = eq || '=';

  let encode = QueryString.escape;
Severity: Minor
Found in current/lib/querystring.js - About 4 hrs 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 parse has 115 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function parse(qs, sep, eq, options) {
  const obj = ObjectCreate(null);

  if (typeof qs !== 'string' || qs.length === 0) {
    return obj;
Severity: Major
Found in current/lib/querystring.js - About 4 hrs to fix

    File querystring.js has 316 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright Joyent, Inc. and other Node contributors.
    //
    // Permission is hereby granted, free of charge, to any person obtaining a
    // copy of this software and associated documentation files (the
    // "Software"), to deal in the Software without restriction, including
    Severity: Minor
    Found in current/lib/querystring.js - About 3 hrs to fix

      Function unescapeBuffer has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      function unescapeBuffer(s, decodeSpaces) {
        const out = Buffer.allocUnsafe(s.length);
        let index = 0;
        let outIndex = 0;
        let currentChar;
      Severity: Minor
      Found in current/lib/querystring.js - About 2 hrs 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 stringify has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function stringify(obj, sep, eq, options) {
        sep = sep || '&';
        eq = eq || '=';
      
        let encode = QueryString.escape;
      Severity: Minor
      Found in current/lib/querystring.js - About 1 hr to fix

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

        function unescapeBuffer(s, decodeSpaces) {
          const out = Buffer.allocUnsafe(s.length);
          let index = 0;
          let outIndex = 0;
          let currentChar;
        Severity: Minor
        Found in current/lib/querystring.js - About 1 hr to fix

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

          function encodeStringified(v, encode) {
            if (typeof v === 'string')
              return (v.length ? encode(v) : '');
            if (typeof v === 'number' && isFinite(v)) {
              // Values >= 1e21 automatically switch to scientific notation which requires
          Severity: Minor
          Found in current/lib/querystring.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 addKeyVal has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) {
          Severity: Minor
          Found in current/lib/querystring.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    if (code === 37/* % */) {
                      encodeCheck = 1;
                    } else if (encodeCheck > 0) {
                      if (isHexTable[code] === 1) {
                        if (++encodeCheck === 3)
            Severity: Major
            Found in current/lib/querystring.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if (lastPos < i)
                          key += qs.slice(lastPos, i);
              Severity: Major
              Found in current/lib/querystring.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                          if (j)
                            fields += sep;
                Severity: Major
                Found in current/lib/querystring.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                            if (lastPos < end) {
                              // Treat the substring as part of the key instead of the value
                              key += qs.slice(lastPos, end);
                            } else if (key.length === 0) {
                              // We saw an empty substring between separators
                  Severity: Major
                  Found in current/lib/querystring.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              if (++eqIdx === eqLen) {
                                // Key/value separator match!
                                const end = i - eqIdx + 1;
                                if (lastPos < end)
                                  key += qs.slice(lastPos, end);
                    Severity: Major
                    Found in current/lib/querystring.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                              } else if (lastPos < end) {
                                value += qs.slice(lastPos, end);
                              }
                      Severity: Major
                      Found in current/lib/querystring.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                  if (!keyEncoded) {
                                    // Try to match an (valid) encoded byte once to minimize unnecessary
                                    // calls to string decoding functions
                                    if (code === 37/* % */) {
                                      encodeCheck = 1;
                        Severity: Major
                        Found in current/lib/querystring.js - About 45 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return obj;
                          Severity: Major
                          Found in current/lib/querystring.js - About 30 mins to fix

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

                            function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) {
                              if (key.length > 0 && keyEncoded)
                                key = decodeStr(key, decode);
                              if (value.length > 0 && valEncoded)
                                value = decodeStr(value, decode);
                            Severity: Minor
                            Found in current/lib/querystring.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

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

                            function parse(qs, sep, eq, options) {
                              const obj = ObjectCreate(null);
                            
                              if (typeof qs !== 'string' || qs.length === 0) {
                                return obj;
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 6 days to fix
                            lts/lib/querystring.js on lines 261..411

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

                            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 unhexTable = [
                              -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 - 15
                              -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 16 - 31
                              -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 32 - 47
                              +0, +1, +2, +3, +4, +5, +6, +7, +8, +9, -1, -1, -1, -1, -1, -1, // 48 - 63
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 4 days to fix
                            lts/lib/querystring.js on lines 55..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 774.

                            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

                            function unescapeBuffer(s, decodeSpaces) {
                              const out = Buffer.allocUnsafe(s.length);
                              let index = 0;
                              let outIndex = 0;
                              let currentChar;
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 2 days to fix
                            lts/lib/querystring.js on lines 74..114

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

                            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

                            function stringify(obj, sep, eq, options) {
                              sep = sep || '&';
                              eq = eq || '=';
                            
                              let encode = QueryString.escape;
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 1 day to fix
                            lts/lib/querystring.js on lines 185..227

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

                            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 noEscape = [
                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31
                              0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, // 32 - 47
                              1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 6 hrs to fix
                            lts/lib/querystring.js on lines 132..141

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

                            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

                            function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) {
                              if (key.length > 0 && keyEncoded)
                                key = decodeStr(key, decode);
                              if (value.length > 0 && valEncoded)
                                value = decodeStr(value, decode);
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 6 hrs to fix
                            lts/lib/querystring.js on lines 240..258

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

                            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

                            function encodeStringified(v, encode) {
                              if (typeof v === 'string')
                                return (v.length ? encode(v) : '');
                              if (typeof v === 'number' && isFinite(v)) {
                                // Values >= 1e21 automatically switch to scientific notation which requires
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 3 hrs to fix
                            lts/lib/querystring.js on lines 166..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 112.

                            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

                            function charCodes(str) {
                              if (str.length === 0) return [];
                              if (str.length === 1) return [str.charCodeAt(0)];
                              const ret = new Array(str.length);
                              for (let i = 0; i < str.length; ++i)
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 3 hrs to fix
                            lts/lib/querystring.js on lines 229..236

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

                            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

                            function stringifyPrimitive(v) {
                              if (typeof v === 'string')
                                return v;
                              if (typeof v === 'number' && isFinite(v))
                                return '' + v;
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 1 hr to fix
                            lts/lib/querystring.js on lines 155..163

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

                            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

                            function qsEscape(str) {
                              if (typeof str !== 'string') {
                                if (typeof str === 'object')
                                  str = String(str);
                                else
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 1 hr to fix
                            lts/lib/querystring.js on lines 144..153

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

                            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

                            function qsUnescape(s, decodeSpaces) {
                              try {
                                return decodeURIComponent(s);
                              } catch {
                                return QueryString.unescapeBuffer(s, decodeSpaces).toString();
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 1 hr to fix
                            lts/lib/querystring.js on lines 117..123

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

                            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 QueryString = module.exports = {
                              unescapeBuffer,
                              // `unescape()` is a JS global, so we need to use a different local name
                              unescape: qsUnescape,
                            
                            
                            Severity: Major
                            Found in current/lib/querystring.js and 1 other location - About 1 hr to fix
                            lts/lib/querystring.js on lines 40..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 55.

                            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

                            function decodeStr(s, decoder) {
                              try {
                                return decoder(s);
                              } catch {
                                return QueryString.unescape(s, true);
                            Severity: Minor
                            Found in current/lib/querystring.js and 1 other location - About 30 mins to fix
                            lts/lib/querystring.js on lines 417..423

                            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

                            There are no issues that match your filters.

                            Category
                            Status