patternweb/patternx

View on GitHub

Showing 8 of 8 total issues

Function generateDocumentation has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function generateDocumentation(
  fileNames: string[],
  options: ts.CompilerOptions
): void {
  let fullFileNames = fileNames.map(
Severity: Major
Found in tools/docgen.ts - About 5 hrs to fix

    Function generateDocumentation has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    function generateDocumentation(
      fileNames: string[],
      options: ts.CompilerOptions
    ): void {
      let fullFileNames = fileNames.map(
    Severity: Minor
    Found in tools/docgen.ts - About 5 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 buildNode has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function buildNode(name, state) {
      const result = state.searchResults.find(res => res.name === name);
      const width = 500;
      const height = 200;
      if (result) {
    Severity: Minor
    Found in src/search/search.js - About 1 hr to fix

      Function Search has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Search(render, state, data) {
        return h("div", [
          h("input#search", {
            hook: {
              insert: init(data, state, render),
      Severity: Minor
      Found in src/search/search.js - About 1 hr to fix

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

        function buildGraph(graphData) {
          const vGraph = graphData.processes.reduce(
            (obj, proc) => {
              obj.nodes[proc.name] = proc.component;
              const edges = Object.keys(proc.inputs || {})
        Severity: Minor
        Found in src/graph/index.js - About 1 hr to fix

          Function layout has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function layout(graphData) {
            const g = new dagre.graphlib.Graph();
            g.setGraph({
              rankdir: "LR",
              // align: "TB",
          Severity: Minor
          Found in src/graph/layout.js - About 1 hr to fix

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

              CallExpression(node, state) {
                // console.log(node.callee.name, node.arguments)
                const _process = {
                  component: node.callee.name,
                  name: `_${node.callee.name}0`
            Severity: Minor
            Found in src/code/parser.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 VariableDeclarator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              VariableDeclarator(node, state, cont) {
                if (t.isCallExpression(node.init)) {
                  const _process = {
                    component: node.init.callee.name,
                    name: node.id.name
            Severity: Minor
            Found in src/code/parser.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

            Severity
            Category
            Status
            Source
            Language