dsl-toolkit/dsl-toolkit

View on GitHub

Showing 12 of 40 total issues

Function extractCallbackData has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

function extractCallbackData () {
  let baseKindArguments = Array.from(arguments)
  const argumentsLastIndex = baseKindArguments.length >= 2 ? baseKindArguments.length - 1 : false
  const argumentsOneBeforeLastIndex = baseKindArguments.length >= 3 ? argumentsLastIndex - 1 : false
  let trueCaseFunction = false
Severity: Minor
Found in packages/dsl-framework/src/core/command-parser/extractCallbackData.js - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function exports has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (results, factories, services, parameters, composedStore) =>
  new Proxy(results, {
    get: (obj, prop) => {
      if(prop instanceof Promise){
        
Severity: Minor
Found in packages/demeter-di/src/proxy/containerProxyFactory.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 exports has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (notHiddenVariablesReaches) => (baseProxy, containerKindData, registeredKeys) => new Proxy(baseProxy,{
    get: (obj, prop) => {
      const hidden = prop?.startsWith('_')
      !hidden && (()=>notHiddenVariablesReaches[prop] = notHiddenVariablesReaches[prop] ?
      notHiddenVariablesReaches[prop] + 1 : 1)()
Severity: Minor
Found in packages/demeter-di/src/proxy/hidden-tags-proxy/index.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 exports has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = (baseObject, returnObject) => {
  return kind =>
    function () {
      const {
        baseKindArguments,
Severity: Minor
Found in packages/dsl-framework/src/core/command-parser/get-base-kind.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 update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

const update = async (dependencies) => {
  if (dependencies) {
    const currentBranch = require('./lib/get-current-branch')()
    const dependencyNames = Object.keys(dependencies)
    let allFine = true
Severity: Minor
Found in oldPackages/refresh-me/src/index.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 update has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const update = async (dependencies) => {
  if (dependencies) {
    const currentBranch = require('./lib/get-current-branch')()
    const dependencyNames = Object.keys(dependencies)
    let allFine = true
Severity: Minor
Found in oldPackages/refresh-me/src/index.js - About 1 hr to fix

    Function extractCallbackData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function extractCallbackData () {
      let baseKindArguments = Array.from(arguments)
      const argumentsLastIndex = baseKindArguments.length >= 2 ? baseKindArguments.length - 1 : false
      const argumentsOneBeforeLastIndex = baseKindArguments.length >= 3 ? argumentsLastIndex - 1 : false
      let trueCaseFunction = false

      Function get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          get: (obj, prop) => {
            const hidden = prop?.startsWith('_')
            !hidden && (()=>notHiddenVariablesReaches[prop] = notHiddenVariablesReaches[prop] ?
            notHiddenVariablesReaches[prop] + 1 : 1)()
            if (hidden) {
      Severity: Minor
      Found in packages/demeter-di/src/proxy/hidden-tags-proxy/index.js - About 1 hr to fix

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

            init: () => {
              const baseKind = getBaseKind(baseObject, returnObject)
        
              baseObject.has = baseKind('some')
              baseObject.get = baseKind('filter')
        Severity: Minor
        Found in packages/dsl-framework/src/core/command-parser/index.js - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                    return usedSoFar.map((usedKey) => allKeys.indexOf(usedKey) < 0 ? usedKey : false)
                      .filter((k) => k !== false)}}
          Severity: Major
          Found in packages/demeter-di/src/proxy/hidden-tags-proxy/index.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    if (!thisIsAFactory || !thisIsAService) return obj[prop]
            Severity: Major
            Found in packages/demeter-di/src/proxy/containerProxyFactory.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return obj[prop]}})
              Severity: Major
              Found in packages/demeter-di/src/proxy/hidden-tags-proxy/index.js - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language