enclose-io/compiler

View on GitHub
current/lib/internal/url.js

Summary

Maintainability
F
2 mos
Test Coverage

File url.js has 1203 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const {
  Array,
  Number,
Severity: Major
Found in current/lib/internal/url.js - About 3 days to fix

    Function parseParams has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    function parseParams(qs) {
      const out = [];
      let pairStart = 0;
      let lastPos = 0;
      let seenSep = false;
    Severity: Minor
    Found in current/lib/internal/url.js - About 7 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 constructor has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

      constructor(init = undefined) {
        if (init === null || init === undefined) {
          this[searchParams] = [];
        } else if (typeof init === 'object' || typeof init === 'function') {
          const method = init[SymbolIterator];
    Severity: Minor
    Found in current/lib/internal/url.js - About 6 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 sort has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

      sort() {
        const a = this[searchParams];
        const len = a.length;
    
        if (len <= 2) {
    Severity: Minor
    Found in current/lib/internal/url.js - About 3 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 format has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        value: function format(options) {
          if (options && typeof options !== 'object')
            throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
          options = {
            fragment: true,
    Severity: Minor
    Found in current/lib/internal/url.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 parseParams has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function parseParams(qs) {
      const out = [];
      let pairStart = 0;
      let lastPos = 0;
      let seenSep = false;
    Severity: Major
    Found in current/lib/internal/url.js - About 2 hrs to fix

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

        constructor(init = undefined) {
          if (init === null || init === undefined) {
            this[searchParams] = [];
          } else if (typeof init === 'object' || typeof init === 'function') {
            const method = init[SymbolIterator];
      Severity: Minor
      Found in current/lib/internal/url.js - About 1 hr to fix

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

            value: function format(options) {
              if (options && typeof options !== 'object')
                throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
              options = {
                fragment: true,
        Severity: Minor
        Found in current/lib/internal/url.js - About 1 hr to fix

          Function getPathFromURLWin32 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function getPathFromURLWin32(url) {
            const hostname = url.hostname;
            let pathname = url.pathname;
            for (let n = 0; n < pathname.length; n++) {
              if (pathname[n] === '%') {
          Severity: Minor
          Found in current/lib/internal/url.js - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function sort has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            sort() {
              const a = this[searchParams];
              const len = a.length;
          
              if (len <= 2) {
          Severity: Minor
          Found in current/lib/internal/url.js - About 1 hr to fix

            Function inspect.custom has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              [inspect.custom](recurseTimes, ctx) {
                if (this == null || this[context] == null || this[context].target == null)
                  throw new ERR_INVALID_THIS('URLSearchParamsIterator');
            
                if (typeof recurseTimes === 'number' && recurseTimes < 0)
            Severity: Minor
            Found in current/lib/internal/url.js - About 1 hr to fix

              Function next has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                next() {
                  if (!this ||
                      ObjectGetPrototypeOf(this) !== URLSearchParamsIteratorPrototype) {
                    throw new ERR_INVALID_THIS('URLSearchParamsIterator');
                  }
              Severity: Minor
              Found in current/lib/internal/url.js - About 1 hr to fix

                Function set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  set(name, value) {
                    if (!this || !this[searchParams] || this[searchParams][searchParams]) {
                      throw new ERR_INVALID_THIS('URLSearchParams');
                    }
                    if (arguments.length < 2) {
                Severity: Minor
                Found in current/lib/internal/url.js - About 1 hr to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function onParsePathComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function onParsePathComplete(flags, protocol, username, password,
                                             host, port, path, query, fragment) {
                Severity: Major
                Found in current/lib/internal/url.js - About 1 hr to fix

                  Function onParseHostnameComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function onParseHostnameComplete(flags, protocol, username, password,
                                                   host, port, path, query, fragment) {
                  Severity: Major
                  Found in current/lib/internal/url.js - About 1 hr to fix

                    Function onParseComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function onParseComplete(flags, protocol, username, password,
                                             host, port, path, query, fragment) {
                    Severity: Major
                    Found in current/lib/internal/url.js - About 1 hr to fix

                      Function onParseHashComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function onParseHashComplete(flags, protocol, username, password,
                                                   host, port, path, query, fragment) {
                      Severity: Major
                      Found in current/lib/internal/url.js - About 1 hr to fix

                        Function onParseSearchComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function onParseSearchComplete(flags, protocol, username, password,
                                                       host, port, path, query, fragment) {
                        Severity: Major
                        Found in current/lib/internal/url.js - About 1 hr to fix

                          Function onParseProtocolComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function onParseProtocolComplete(flags, protocol, username, password,
                                                           host, port, path, query, fragment) {
                          Severity: Major
                          Found in current/lib/internal/url.js - About 1 hr to fix

                            Function constructUrl has 9 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function constructUrl(flags, protocol, username, password,
                                                  host, port, path, query, fragment) {
                            Severity: Major
                            Found in current/lib/internal/url.js - About 1 hr to fix

                              Function onParsePortComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function onParsePortComplete(flags, protocol, username, password,
                                                           host, port, path, query, fragment) {
                              Severity: Major
                              Found in current/lib/internal/url.js - About 1 hr to fix

                                Function onParseHostComplete has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function onParseHostComplete(flags, protocol, username, password,
                                                             host, port, path, query, fragment) {
                                Severity: Major
                                Found in current/lib/internal/url.js - About 1 hr to fix

                                  Function set has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    set(name, value) {
                                      if (!this || !this[searchParams] || this[searchParams][searchParams]) {
                                        throw new ERR_INVALID_THIS('URLSearchParams');
                                      }
                                      if (arguments.length < 2) {
                                  Severity: Minor
                                  Found in current/lib/internal/url.js - About 1 hr to fix

                                    Function inspect.custom has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      [inspect.custom](recurseTimes, ctx) {
                                        if (this == null || this[context] == null || this[context].target == null)
                                          throw new ERR_INVALID_THIS('URLSearchParamsIterator');
                                    
                                        if (typeof recurseTimes === 'number' && recurseTimes < 0)
                                    Severity: Minor
                                    Found in current/lib/internal/url.js - About 1 hr to fix

                                    Cognitive Complexity

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

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

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

                                    Further reading

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

                                      [inspect.custom](depth, opts) {
                                        if (this == null ||
                                            ObjectGetPrototypeOf(this[context]) !== URLContext.prototype) {
                                          throw new ERR_INVALID_THIS('URL');
                                        }
                                    Severity: Minor
                                    Found in current/lib/internal/url.js - About 1 hr to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                              if (isHexTable[code] === 1) {
                                                if (++encodeCheck === 3) {
                                                  querystring = require('querystring');
                                                  encoded = true;
                                                }
                                      Severity: Major
                                      Found in current/lib/internal/url.js - About 45 mins to fix

                                        Function pathToFileURL has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function pathToFileURL(filepath) {
                                          let resolved = path.resolve(filepath);
                                          // path.resolve strips trailing slashes so we must add them back
                                          const filePathLast = filepath.charCodeAt(filepath.length - 1);
                                          if ((filePathLast === CHAR_FORWARD_SLASH ||
                                        Severity: Minor
                                        Found in current/lib/internal/url.js - About 45 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 merge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function merge(out, start, mid, end, lBuffer, rBuffer) {
                                          const sizeLeft = mid - start;
                                          const sizeRight = end - mid;
                                          let l, r, o;
                                        
                                        
                                        Severity: Minor
                                        Found in current/lib/internal/url.js - About 45 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 getPathFromURLPosix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        function getPathFromURLPosix(url) {
                                          if (url.hostname !== '') {
                                            throw new ERR_INVALID_FILE_URL_HOST(platform);
                                          }
                                          const pathname = url.pathname;
                                        Severity: Minor
                                        Found in current/lib/internal/url.js - About 45 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 merge has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                        function merge(out, start, mid, end, lBuffer, rBuffer) {
                                        Severity: Minor
                                        Found in current/lib/internal/url.js - About 45 mins to fix

                                          Function inspect.custom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            [inspect.custom](recurseTimes, ctx) {
                                              if (!this || !this[searchParams] || this[searchParams][searchParams]) {
                                                throw new ERR_INVALID_THIS('URLSearchParams');
                                              }
                                          
                                          
                                          Severity: Minor
                                          Found in current/lib/internal/url.js - About 35 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 set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              set(search) {
                                                const ctx = this[context];
                                                search = toUSVString(search);
                                                if (search === '') {
                                                  ctx.query = null;
                                          Severity: Minor
                                          Found in current/lib/internal/url.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                              get() {
                                                // Refs: https://url.spec.whatwg.org/#concept-url-origin
                                                const ctx = this[context];
                                                switch (ctx.scheme) {
                                                  case 'blob:':
                                          Severity: Minor
                                          Found in current/lib/internal/url.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            delete(name) {
                                              if (!this || !this[searchParams] || this[searchParams][searchParams]) {
                                                throw new ERR_INVALID_THIS('URLSearchParams');
                                              }
                                              if (arguments.length < 1) {
                                          Severity: Minor
                                          Found in current/lib/internal/url.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

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

                                          ObjectDefineProperties(URL.prototype, {
                                            [kFormat]: {
                                              enumerable: false,
                                              configurable: false,
                                              // eslint-disable-next-line func-name-matching
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 wk to fix
                                          lts/lib/internal/url.js on lines 390..694

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

                                          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

                                          defineIDLClass(URLSearchParams.prototype, 'URLSearchParams', {
                                            append(name, value) {
                                              if (!this || !this[searchParams] || this[searchParams][searchParams]) {
                                                throw new ERR_INVALID_THIS('URLSearchParams');
                                              }
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 wk to fix
                                          lts/lib/internal/url.js on lines 917..1150

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

                                          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

                                          class URLSearchParams {
                                            // URL Standard says the default value is '', but as undefined and '' have
                                            // the same result, undefined is used to prevent unnecessary parsing.
                                            // Default parameter is necessary to keep URLSearchParams.length === 0 in
                                            // accordance with Web IDL spec.
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 5 days to fix
                                          lts/lib/internal/url.js on lines 135..234

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

                                          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

                                          defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {
                                            next() {
                                              if (!this ||
                                                  ObjectGetPrototypeOf(this) !== URLSearchParamsIteratorPrototype) {
                                                throw new ERR_INVALID_THIS('URLSearchParamsIterator');
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 3 days to fix
                                          lts/lib/internal/url.js on lines 1173..1249

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

                                          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 parseParams(qs) {
                                            const out = [];
                                            let pairStart = 0;
                                            let lastPos = 0;
                                            let seenSep = false;
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 3 days to fix
                                          lts/lib/internal/url.js on lines 721..817

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

                                          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 merge(out, start, mid, end, lBuffer, rBuffer) {
                                            const sizeLeft = mid - start;
                                            const sizeRight = end - mid;
                                            let l, r, o;
                                          
                                          
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 day to fix
                                          lts/lib/internal/url.js on lines 889..915

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

                                          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 getPathFromURLWin32(url) {
                                            const hostname = url.hostname;
                                            let pathname = url.pathname;
                                            for (let n = 0; n < pathname.length; n++) {
                                              if (pathname[n] === '%') {
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 day to fix
                                          lts/lib/internal/url.js on lines 1293..1326

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

                                          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 pathToFileURL(filepath) {
                                            let resolved = path.resolve(filepath);
                                            // path.resolve strips trailing slashes so we must add them back
                                            const filePathLast = filepath.charCodeAt(filepath.length - 1);
                                            if ((filePathLast === CHAR_FORWARD_SLASH ||
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 day to fix
                                          lts/lib/internal/url.js on lines 1372..1394

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

                                          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 urlToOptions(url) {
                                            const options = {
                                              protocol: url.protocol,
                                              hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ?
                                                url.hostname.slice(1, -1) :
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 day to fix
                                          lts/lib/internal/url.js on lines 1270..1289

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

                                          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 constructUrl(flags, protocol, username, password,
                                                                host, port, path, query, fragment) {
                                            const ctx = new URLContext();
                                            ctx.flags = flags;
                                            ctx.scheme = protocol;
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 day to fix
                                          lts/lib/internal/url.js on lines 1407..1427

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

                                          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 onParseComplete(flags, protocol, username, password,
                                                                   host, port, path, query, fragment) {
                                            const ctx = this[context];
                                            ctx.flags = flags;
                                            ctx.scheme = protocol;
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 day to fix
                                          lts/lib/internal/url.js on lines 236..253

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

                                          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 serializeParams(array) {
                                            const len = array.length;
                                            if (len === 0)
                                              return '';
                                          
                                          
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 7 hrs to fix
                                          lts/lib/internal/url.js on lines 841..857

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

                                          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 noEscape = [
                                          /*
                                            0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
                                          */
                                            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00 - 0x0F
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 6 hrs to fix
                                          lts/lib/internal/url.js on lines 821..833

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

                                          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 defineIDLClass(proto, classStr, obj) {
                                            // https://heycam.github.io/webidl/#dfn-class-string
                                            ObjectDefineProperty(proto, SymbolToStringTag, {
                                              writable: false,
                                              enumerable: false,
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 5 hrs to fix
                                          lts/lib/internal/url.js on lines 860..886

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

                                          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 getPathFromURLPosix(url) {
                                            if (url.hostname !== '') {
                                              throw new ERR_INVALID_FILE_URL_HOST(platform);
                                            }
                                            const pathname = url.pathname;
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 5 hrs to fix
                                          lts/lib/internal/url.js on lines 1328..1344

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

                                          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 onParsePathComplete(flags, protocol, username, password,
                                                                       host, port, path, query, fragment) {
                                            const ctx = this[context];
                                            if ((flags & URL_FLAGS_HAS_PATH) !== 0) {
                                              ctx.path = path;
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 5 hrs to fix
                                          lts/lib/internal/url.js on lines 295..311

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

                                          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 {
                                            domainToASCII: _domainToASCII,
                                            domainToUnicode: _domainToUnicode,
                                            encodeAuth,
                                            toUSVString: _toUSVString,
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 4 hrs to fix
                                          lts/lib/internal/url.js on lines 57..80

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

                                          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

                                          class URLContext {
                                            constructor() {
                                              this.flags = 0;
                                              this.scheme = ':';
                                              this.username = '';
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 4 hrs to fix
                                          lts/lib/internal/url.js on lines 121..133

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

                                          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 fileURLToPath(path) {
                                            if (typeof path === 'string')
                                              path = new URL(path);
                                            else if (!isURLInstance(path))
                                              throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 3 hrs to fix
                                          lts/lib/internal/url.js on lines 1346..1354

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

                                          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 update(url, params) {
                                            if (!url)
                                              return;
                                          
                                            const ctx = url[context];
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 3 hrs to fix
                                          lts/lib/internal/url.js on lines 696..709

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

                                          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

                                            constructor(input, base) {
                                              // toUSVString is not needed.
                                              input = `${input}`;
                                              let base_context;
                                              if (base !== undefined) {
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 3 hrs to fix
                                          lts/lib/internal/url.js on lines 324..334

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

                                          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 onParseProtocolComplete(flags, protocol, username, password,
                                                                           host, port, path, query, fragment) {
                                            const ctx = this[context];
                                            if ((flags & URL_FLAGS_SPECIAL) !== 0) {
                                              ctx.flags |= URL_FLAGS_SPECIAL;
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 2 hrs to fix
                                          lts/lib/internal/url.js on lines 259..269

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

                                          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 onParseHostnameComplete(flags, protocol, username, password,
                                                                           host, port, path, query, fragment) {
                                            const ctx = this[context];
                                            if ((flags & URL_FLAGS_HAS_HOST) !== 0) {
                                              ctx.host = host;
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 2 hrs to fix
                                          lts/lib/internal/url.js on lines 271..281

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

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

                                          module.exports = {
                                            toUSVString,
                                            fileURLToPath,
                                            pathToFileURL,
                                            toPathIfFileURL,
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 5 other locations - About 2 hrs to fix
                                          current/lib/internal/stream_base_commons.js on lines 273..287
                                          current/lib/v8.js on lines 266..280
                                          lts/lib/internal/stream_base_commons.js on lines 266..280
                                          lts/lib/internal/url.js on lines 1430..1444
                                          lts/lib/v8.js on lines 277..291

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

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

                                          const {
                                            Array,
                                            Number,
                                            ObjectCreate,
                                            ObjectDefineProperties,
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 6 other locations - About 1 hr to fix
                                          current/lib/_tls_wrap.js on lines 59..73
                                          current/lib/internal/error_serdes.js on lines 4..18
                                          current/lib/perf_hooks.js on lines 31..46
                                          lts/lib/_tls_wrap.js on lines 56..70
                                          lts/lib/internal/url.js on lines 3..17
                                          lts/lib/perf_hooks.js on lines 31..46

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

                                          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 toUSVString(val) {
                                            const str = `${val}`;
                                            // As of V8 5.5, `str.search()` (and `unpairedSurrogateRe[@@search]()`) are
                                            // slower than `unpairedSurrogateRe.exec()`.
                                            const match = unpairedSurrogateRe.exec(str);
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 hr to fix
                                          lts/lib/internal/url.js on lines 97..105

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

                                          const {
                                            ERR_ARG_NOT_ITERABLE,
                                            ERR_INVALID_ARG_TYPE,
                                            ERR_INVALID_CALLBACK,
                                            ERR_INVALID_FILE_URL_HOST,
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 3 other locations - About 1 hr to fix
                                          current/lib/inspector.js on lines 10..21
                                          lts/lib/inspector.js on lines 10..21
                                          lts/lib/internal/url.js on lines 27..38

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

                                          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

                                            get [cannotHaveUsernamePasswordPort]() {
                                              const { host, scheme } = this[context];
                                              return ((host == null || host === '') ||
                                                      this[cannotBeBase] ||
                                                      scheme === 'file:');
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 hr to fix
                                          lts/lib/internal/url.js on lines 345..350

                                          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 onParseHostComplete(flags, protocol, username, password,
                                                                       host, port, path, query, fragment) {
                                            onParseHostnameComplete.apply(this, arguments);
                                            if (port !== null || ((flags & URL_FLAGS_IS_DEFAULT_SCHEME_PORT) !== 0))
                                              onParsePortComplete.apply(this, arguments);
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 hr to fix
                                          lts/lib/internal/url.js on lines 288..293

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

                                          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 serializeTupleOrigin(scheme, host, port) {
                                            return `${scheme}//${host}${port === null ? '' : `:${port}`}`;
                                          }
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 hr to fix
                                          lts/lib/internal/url.js on lines 111..113

                                          Duplicated Code

                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                          Tuning

                                          This issue has a mass of 59.

                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                          Refactorings

                                          Further Reading

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

                                              if (opts.showHidden) {
                                                obj.cannotBeBase = this[cannotBeBase];
                                                obj.special = this[special];
                                                obj[context] = this[context];
                                              }
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 hr to fix
                                          lts/lib/internal/url.js on lines 380..384

                                          Duplicated Code

                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                          Tuning

                                          This issue has a mass of 56.

                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                          Refactorings

                                          Further Reading

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

                                          function createSearchParamsIterator(target, kind) {
                                            const iterator = ObjectCreate(URLSearchParamsIteratorPrototype);
                                            iterator[context] = {
                                              target,
                                              kind,
                                          Severity: Major
                                          Found in current/lib/internal/url.js and 1 other location - About 1 hr to fix
                                          lts/lib/internal/url.js on lines 1160..1168

                                          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 domainToUnicode(domain) {
                                            if (arguments.length < 1)
                                              throw new ERR_MISSING_ARGS('domain');
                                          
                                            // toUSVString is not needed.
                                          Severity: Minor
                                          Found in current/lib/internal/url.js and 1 other location - About 50 mins to fix
                                          lts/lib/internal/url.js on lines 1259..1265

                                          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

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

                                          function initSearchParams(url, init) {
                                            if (!init) {
                                              url[searchParams] = [];
                                              return;
                                            }
                                          Severity: Minor
                                          Found in current/lib/internal/url.js and 1 other location - About 45 mins to fix
                                          lts/lib/internal/url.js on lines 711..717

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

                                          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 domainToASCII(domain) {
                                            if (arguments.length < 1)
                                              throw new ERR_MISSING_ARGS('domain');
                                          
                                            // toUSVString is not needed.
                                          Severity: Minor
                                          Found in current/lib/internal/url.js and 1 other location - About 40 mins to fix
                                          lts/lib/internal/url.js on lines 1251..1257

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

                                          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