minepkg/minepkg

View on GitHub

Showing 106 of 129 total issues

Method publishRunner.RunE has a Cognitive Complexity of 62 (exceeds 20 allowed). Consider refactoring.
Open

func (p *publishRunner) RunE(cmd *cobra.Command, args []string) error {
    apiClient := root.MinepkgAPI
    nonInteractive := viper.GetBool("nonInteractive")

    tasks := logger.NewTask(3)
Severity: Minor
Found in cmd/publish.go - About 7 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

Method publishRunner.RunE has 182 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (p *publishRunner) RunE(cmd *cobra.Command, args []string) error {
    apiClient := root.MinepkgAPI
    nonInteractive := viper.GetBool("nonInteractive")

    tasks := logger.NewTask(3)
Severity: Major
Found in cmd/publish.go - About 6 hrs to fix

    Method launchRunner.RunE has a Cognitive Complexity of 53 (exceeds 20 allowed). Consider refactoring.
    Open

    func (l *launchRunner) RunE(cmd *cobra.Command, args []string) error {
        var err error
    
        vanillaManifest.Requirements.Minecraft = "*"
        vanillaManifest.Requirements.MinepkgCompanion = "none"
    Severity: Minor
    Found in cmd/launch.go - 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

    Method launchRunner.RunE has 151 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (l *launchRunner) RunE(cmd *cobra.Command, args []string) error {
        var err error
    
        vanillaManifest.Requirements.Minecraft = "*"
        vanillaManifest.Requirements.MinepkgCompanion = "none"
    Severity: Major
    Found in cmd/launch.go - About 5 hrs to fix

      Method initRunner.RunE has 141 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (i *initRunner) RunE(cmd *cobra.Command, args []string) error {
          if _, err := ioutil.ReadFile("./minepkg.toml"); err == nil && !i.force {
              return fmt.Errorf("this directory already contains a minepkg.toml. Use --force to overwrite it")
          }
      
      
      Severity: Major
      Found in cmd/initCmd/initCmd.go - About 4 hrs to fix

        Method Instance.BuildLaunchCmd has 132 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (i *Instance) BuildLaunchCmd(opts *LaunchOptions) (*exec.Cmd, error) {
            // this file tells us how to construct the start command
            launchManifest := opts.LaunchManifest
            var err error
        
        
        Severity: Major
        Found in internals/instances/launch.go - About 4 hrs to fix

          Method tryRunner.RunE has 121 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (t *tryRunner) RunE(cmd *cobra.Command, args []string) error {
              apiClient := root.MinepkgAPI
              nonInteractive := viper.GetBool("nonInteractive")
          
              tempDir, err := ioutil.TempDir("", args[0])
          Severity: Major
          Found in cmd/try.go - About 3 hrs to fix

            Method TheThing.Launch has 106 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (t *TheThing) Launch(man *manifest.Manifest) error {
                connection := t.Connection
                t.State.Status = StatusStarting
            
                if root.authProvider == nil {
            Severity: Major
            Found in cmd/proto-handler.go - About 3 hrs to fix

              Method MinepkgClient.FindRelease has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
              Open

              func (m *MinepkgClient) FindRelease(ctx context.Context, project string, reqs *RequirementQuery) (*Release, error) {
                  p := Project{client: m, Name: project}
              
                  var wantedMCSemver *semver.Version
                  if reqs.Minecraft != "*" {
              Severity: Minor
              Found in internals/api/find-release.go - 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

              Method installRunner.installFromMinepkg has 99 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (i *installRunner) installFromMinepkg(mods []string) error {
                  instance := i.instance
                  apiClient := root.MinepkgAPI
              
                  task := logger.NewTask(3)
              Severity: Major
              Found in cmd/install-minepkg.go - About 2 hrs to fix

                Method tryRunner.RunE has a Cognitive Complexity of 36 (exceeds 20 allowed). Consider refactoring.
                Open

                func (t *tryRunner) RunE(cmd *cobra.Command, args []string) error {
                    apiClient := root.MinepkgAPI
                    nonInteractive := viper.GetBool("nonInteractive")
                
                    tempDir, err := ioutil.TempDir("", args[0])
                Severity: Minor
                Found in cmd/try.go - 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

                Method bumpRunner.RunE has 95 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (b *bumpRunner) RunE(cmd *cobra.Command, args []string) error {
                
                    instance, err := instances.NewFromWd()
                
                    if err != nil {
                Severity: Major
                Found in cmd/bump/bump.go - About 2 hrs to fix

                  Method unpublishRunner.RunE has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (p *unpublishRunner) RunE(cmd *cobra.Command, args []string) error {
                      apiClient := root.MinepkgAPI
                      // nonInteractive := viper.GetBool("nonInteractive")
                  
                      var mID *pkgid.ID
                  Severity: Major
                  Found in cmd/unpublish.go - About 2 hrs to fix

                    Method Instance.BuildLaunchCmd has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func (i *Instance) BuildLaunchCmd(opts *LaunchOptions) (*exec.Cmd, error) {
                        // this file tells us how to construct the start command
                        launchManifest := opts.LaunchManifest
                        var err error
                    
                    
                    Severity: Minor
                    Found in internals/instances/launch.go - 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 dependenciesInSync has a Cognitive Complexity of 32 (exceeds 20 allowed). Consider refactoring.
                    Open

                    func dependenciesInSync(lock *manifest.Lockfile, mani *manifest.Manifest) (bool, error) {
                        if mani == nil {
                            return false, fmt.Errorf("manifest is nil")
                        }
                    
                    
                    Severity: Minor
                    Found in internals/instances/synced.go - 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

                    Method Connection.ListenForHandshake has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (c *Connection) ListenForHandshake(ctx context.Context) error {
                        dataChannelOpen := make(chan struct{})
                    
                        server := http.Server{Addr: "localhost:20876"}
                        c.httpServer = &server
                    Severity: Major
                    Found in internals/remote/handshake.go - About 2 hrs to fix

                      Function protoLaunch has 78 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func protoLaunch(pack string) {
                          log.Println("Launching via protocol: " + pack)
                          // connect to web client
                          connection := remote.New()
                          log.Println("Wait for handshake")
                      Severity: Major
                      Found in cmd/proto-handler.go - About 2 hrs to fix

                        Method Reader.ExtractModpack has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (p *Reader) ExtractModpack(dest string) error {
                            zipReader := p.zipReader
                        
                            skipPrefixes := []string{}
                            createdDirs := make(map[string]interface{})
                        Severity: Minor
                        Found in internals/pack/pack.go - 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

                        Method installRunner.installFromMinepkg has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (i *installRunner) installFromMinepkg(mods []string) error {
                            instance := i.instance
                            apiClient := root.MinepkgAPI
                        
                            task := logger.NewTask(3)
                        Severity: Minor
                        Found in cmd/install-minepkg.go - 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

                        Method Instance.LinkDependencies has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (i *Instance) LinkDependencies() error {
                            files, err := ioutil.ReadDir(i.ModsDir())
                            if err != nil {
                                if os.IsNotExist(err) {
                                    if err := os.MkdirAll(i.ModsDir(), os.ModePerm); err != nil {
                        Severity: Minor
                        Found in internals/instances/dependencies.go - 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

                        Severity
                        Category
                        Status
                        Source
                        Language