han-feng/modular

View on GitHub

Showing 8 of 190 total issues

Function init has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

  private init() {
    if (this.inited) {
      // 防止初始化两次
      this.log(new LogInfo('E00', 'error'))
      return
Severity: Minor
Found in src/Modular.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 loadDepens has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  private loadDepens(
    module: ModuleConfig,
    modulesLoader: ModulesLoader,
    nameMapping: { [index: string]: ModuleConfig },
    cache: { [index: string]: ModuleConfig } = {}
Severity: Minor
Found in src/Modular.ts - 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 init has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private init() {
    if (this.inited) {
      // 防止初始化两次
      this.log(new LogInfo('E00', 'error'))
      return
Severity: Major
Found in src/Modular.ts - About 2 hrs to fix

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

      private loadDepens(
        module: ModuleConfig,
        modulesLoader: ModulesLoader,
        nameMapping: { [index: string]: ModuleConfig },
        cache: { [index: string]: ModuleConfig } = {}
    Severity: Minor
    Found in src/Modular.ts - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                  if (points[name].type === Type.Multiple && Array.isArray(ext[name])) {
                    points[name].addExtension(module.name, ...ext[name])
                  } else {
                    points[name].addExtension(module.name, ext[name])
                  }
      Severity: Major
      Found in src/Modular.ts - About 45 mins to fix

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

          private preprocess() {
            if (!this.processed) {
              let extension: any = null
              let extensions = this.extensions
              if (extensions && extensions.length && extensions.length > 0) {
        Severity: Minor
        Found in src/ExtensionPoint.ts - 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

        Avoid too many return statements within this function.
        Open

                  return false
        Severity: Major
        Found in src/Modular.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return true
          Severity: Major
          Found in src/Modular.ts - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language