brentlintner/synt

View on GitHub

Showing 14 of 25 total issues

Function print has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const print = (group, color) => {
    _.each(group, (results, sim) => {
        _.each(results, (result) => {
            const [src, cmp] = result;
            console.log("");
Severity: Minor
Found in lib/similar/print.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 print has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

const print = (
  group : synt.ParseResultGroup,
  color : boolean
) : void => {
  _.each(group, (results : synt.ParseResultMatchList, sim : string) => {
Severity: Minor
Found in src/similar/print.ts - 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 print has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const print = (group, color) => {
    _.each(group, (results, sim) => {
        _.each(results, (result) => {
            const [src, cmp] = result;
            console.log("");
Severity: Major
Found in lib/similar/print.js - About 2 hrs to fix

    Function print has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const print = (
      group : synt.ParseResultGroup,
      color : boolean
    ) : void => {
      _.each(group, (results : synt.ParseResultMatchList, sim : string) => {
    Severity: Minor
    Found in src/similar/print.ts - About 1 hr to fix

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

      const configure = () => {
        program
          .version(pkg.version)
          .command("analyze [paths...]")
          .alias("a")
      Severity: Minor
      Found in src/cli.ts - About 1 hr to fix

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

        const false_positive = (
          src : synt.ParseResult,
          cmp : synt.ParseResult,
          t_len : number
        ) => {
        Severity: Minor
        Found in src/similar.ts - About 1 hr to fix

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

          const false_positive = (src, cmp, t_len) => {
              const same_node = () => cmp.ast === src.ast;
              const size_is_too_different = () => {
                  const l1 = src.tokens.length;
                  const l2 = cmp.tokens.length;
          Severity: Minor
          Found in lib/similar.js - About 1 hr to fix

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

            const configure = () => {
                commander_1.program
                    .version(pkg.version)
                    .command("analyze [paths...]")
                    .alias("a")
            Severity: Minor
            Found in lib/cli.js - About 1 hr to fix

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

              const is_ts_ancestor = (src, cmp) => {
                  let match = false;
                  let last = src.ast;
                  while (true) {
                      const { parent } = last;
              Severity: Minor
              Found in lib/similar.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 false_positive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const false_positive = (
                src : synt.ParseResult,
                cmp : synt.ParseResult,
                t_len : number
              ) => {
              Severity: Minor
              Found in src/similar.ts - 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 false_positive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const false_positive = (src, cmp, t_len) => {
                  const same_node = () => cmp.ast === src.ast;
                  const size_is_too_different = () => {
                      const l1 = src.tokens.length;
                      const l2 = cmp.tokens.length;
              Severity: Minor
              Found in lib/similar.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 _tokenize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const _tokenize = (tokens) => (node) => {
                  if (is_a_base_node(node)) {
                      tokens.push(node.getText());
                  }
                  else if (is_a_passthrough_node(node)) {
              Severity: Minor
              Found in lib/similar/typescript.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 is_ts_ancestor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const is_ts_ancestor = (
                src : synt.TSParseResult,
                cmp : synt.TSParseResult
              ) : boolean => {
                let match = false
              Severity: Minor
              Found in src/similar.ts - 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 _tokenize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const _tokenize = (
                tokens : string[]
              ) => (
                node : ts.Node
              ) => {
              Severity: Minor
              Found in src/similar/typescript.ts - 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

              Severity
              Category
              Status
              Source
              Language