XYOracleNetwork/app-xyo-nodejs

View on GitHub

Showing 8 of 8 total issues

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

  public async main() {
    commander.option('-i, --install', 'installs the plugins')
    commander.option('-r, --run', 'runs node')
    commander.option('-f, --fetch <string>', 'fetch from url')
    commander.parse(process.argv)
Severity: Minor
Found in src/index.ts - About 1 hr to fix

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

    async function main(argv) {
      const optionalArg = argv.length >= 3 ? argv[2] : undefined
    
      try {
        console.log(pidFolder)
    Severity: Minor
    Found in bin/stop-node.js - About 1 hr to fix

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

        private async resolveSinglePlugin(plugin: IXyoPluginWithConfig) {
          const pluginDependencies = plugin.plugin.getPluginDependencies()
          let hasAllDependencies = true
      
          // loop through all of the resolved dependencies, to see if it has the dependencies
      Severity: Minor
      Found in src/plugin-resolver.ts - About 1 hr to fix

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

        const installNpmRepository = (
          pathOfNpm: string,
          subPlugins: INpmRemoteSubPluginConfig[]
        ) => {
          const xyoPlugins: string[] =
        Severity: Minor
        Found in src/package-manager/index.ts - About 1 hr to fix

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

          async function main(argv) {
            const optionalArg = argv.length >= 3 ? argv[2] : undefined
          
            try {
              console.log(pidFolder)
          Severity: Minor
          Found in bin/stop-node.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

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

            private async resolveSinglePlugin(plugin: IXyoPluginWithConfig) {
              const pluginDependencies = plugin.plugin.getPluginDependencies()
              let hasAllDependencies = true
          
              // loop through all of the resolved dependencies, to see if it has the dependencies
          Severity: Minor
          Found in src/plugin-resolver.ts - 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

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

          const installNpmRepository = (
            pathOfNpm: string,
            subPlugins: INpmRemoteSubPluginConfig[]
          ) => {
            const xyoPlugins: string[] =
          Severity: Minor
          Found in src/package-manager/index.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

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

            public async resolve(plugins: IXyoPluginWithConfig[]) {
              // while we are still resolving plugins
              while (this.lastResolvedPluginCount !== this.resolvedPluginCount) {
                this.lastResolvedPluginCount = this.resolvedPluginCount
          
          
          Severity: Minor
          Found in src/plugin-resolver.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