infoderm/healthone

View on GitHub

Showing 12 of 12 total issues

Function parseLines has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function* parseLines(lines, options) {
    let report = null;

    for (const [lineno, line] of enumerate(lines, 1)) {
        const parts = line.split(options.separator);
Severity: Minor
Found in src/parse.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 insertRecord has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function insertRecord(report, record) {
    let {kind} = report;

    if (record.reference !== report.reference) {
        throw new Error(
Severity: Minor
Found in src/insertRecord.js - About 1 hr to fix

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

    export default function parseRecord(parts, options) {
        let [descriptor, reference, ...rest] = parts;
        descriptor = descriptor.trim(); // To remove <feff> byte order mark
        reference = reference.trim(); // To remove leading and trailing spaces
        parts = [descriptor, reference, ...rest];
    Severity: Minor
    Found in src/parseRecord.js - About 1 hr to fix

      Function expandOptions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function expandOptions(options) {
          const copy = Object.assign({}, options);
          if (
              copy.trailing === undefined ||
              copy.trailing.constructor.prototype !== Object.prototype
      Severity: Minor
      Found in src/expandAndMergeOptions.js - About 1 hr to fix

        Function validateLineLength has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function validateLineLength(
            parts,
            kind,
            validLengths,
            trailingSlash,
        Severity: Minor
        Found in src/validateLineLength.js - About 1 hr to fix

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

          export default function validateLineLength(
              parts,
              kind,
              validLengths,
              trailingSlash,
          Severity: Minor
          Found in src/validateLineLength.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 parseA2 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function parseA2(parts, options) {
              validateLineLength(parts, 'A2', [6, 7], options.trailing.A2);
          
              validateRequiredField(parts, 'lastname', 3, options.required.lastname);
              validateRequiredField(parts, 'firstname', 4, options.required.firstname);
          Severity: Minor
          Found in src/parseA2.js - About 1 hr to fix

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

            function* parseLines(lines, options) {
                let report = null;
            
                for (const [lineno, line] of enumerate(lines, 1)) {
                    const parts = line.split(options.separator);
            Severity: Minor
            Found in src/parse.js - About 1 hr to fix

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

              export default function insertRecord(report, record) {
                  let {kind} = report;
              
                  if (record.reference !== report.reference) {
                      throw new Error(
              Severity: Minor
              Found in src/insertRecord.js - About 55 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Avoid too many return statements within this function.
              Open

                          return parseL5(parts, options);
              Severity: Major
              Found in src/parseRecord.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return parseL1(parts, options);
                Severity: Major
                Found in src/parseRecord.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return parseA5(parts, options);
                  Severity: Major
                  Found in src/parseRecord.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language