Showing 106 of 129 total issues
Method joinRunner.RunE
has 77 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (j *joinRunner) RunE(cmd *cobra.Command, args []string) error {
var resolvedModpack *api.Release
ip := "127.0.0.1"
connectionString := strings.Split(args[0], ":")
Method selfupdateRunner.RunE
has 75 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *selfupdateRunner) RunE(cmd *cobra.Command, args []string) error {
toUpdate, err := os.Executable()
if err != nil {
return err
}
Method initRunner.emptyDirFinalization
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
func (i *initRunner) emptyDirFinalization(man *manifest.Manifest) error {
if man.Package.Type == manifest.TypeMod {
fmt.Println("\nThis directory is empty. Do you want to use a template?")
q := &promptui.Select{
Label: "Template",
- Read upRead up
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 unpublishRunner.RunE
has a Cognitive Complexity of 30 (exceeds 20 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
- Read upRead up
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 MinepkgClient.FindRelease
has 72 lines of code (exceeds 50 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 != "*" {
Method Launcher.HandleCrash
has 72 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (c *Launcher) HandleCrash() error {
// exit code was not 130 or 0, we output error info and submit a crash report
man := c.Instance.Manifest
platform := man.PlatformString()
Method Launcher.PrepareMinecraft
has 70 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (l *Launcher) PrepareMinecraft(ctx context.Context) error {
instance := l.Instance
mgr := downloadmgr.New()
fmt.Println(pipeText.Render(gchalk.Gray("Preparing Minecraft")))
Method MinepkgClient.OAuthLogin
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *MinepkgClient) OAuthLogin(c *OAuthLoginConfig) *oauth2.Token {
// ctx := context.Background()
conf := &oauth2.Config{
ClientID: "minepkg-cli",
Method initRunner.emptyDirFinalization
has 69 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (i *initRunner) emptyDirFinalization(man *manifest.Manifest) error {
if man.Package.Type == manifest.TypeMod {
fmt.Println("\nThis directory is empty. Do you want to use a template?")
q := &promptui.Select{
Label: "Template",
Function MergeManifests
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
func MergeManifests(source *LaunchManifest, manifests ...*LaunchManifest) {
for _, new := range manifests {
if new == nil {
panic("can't merge with nil manifest")
}
- Read upRead up
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 initConfig
has 66 lines of code (exceeds 50 allowed). Consider refactoring. Open
func initConfig() {
if viper.GetBool("noColor") {
gchalk.ForceLevel(gchalk.LevelNone)
}
Method MicrosoftClient.Oauth
has 64 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (m *MicrosoftClient) Oauth(ctx context.Context) error {
conf := m.Config
state := uniuri.New()
pkceVerifier := uniuri.NewLen(128)
Method Factory.getAssets
has 63 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (j *Factory) getAssets(ctx context.Context, opts *AdoptAssetRequest) ([]AdoptAsset, error) {
// set all the defaults
if opts.architecture == "" {
opts.architecture = archMap(runtime.GOARCH)
}
Method Instance.launchManifestArgs
has 62 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (i *Instance) launchManifestArgs(launchManifest *minecraft.LaunchManifest, opts *LaunchOptions, classPaths string, nativesDir string) ([]string, error) {
if launchManifest.MainClass == "" {
log.Println("[WARN] launchManifest.MainClass is empty")
}
Method Launcher.PrepareMinecraft
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (l *Launcher) PrepareMinecraft(ctx context.Context) error {
instance := l.Instance
mgr := downloadmgr.New()
fmt.Println(pipeText.Render(gchalk.Gray("Preparing Minecraft")))
- Read upRead up
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 DownloadManager.Start
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
func (d *DownloadManager) Start(ctx context.Context) error {
sem := make(chan int, 16)
cErr := make(chan error)
if d.queue == nil {
- Read upRead up
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 defaultManifest
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
func defaultManifest() *manifest.Manifest {
fabricMan := &fabric.Manifest{}
man := manifest.New()
err := utils.ReadJSONFile("./src/main/resources/fabric.mod.json", fabricMan)
Method bumpRunner.gitChecks
has 57 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *bumpRunner) gitChecks() error {
dirty, err := utils.SimpleGitExec("status --porcelain")
if err != nil {
return err
}
Method launchRunner.RunE
has 13 return statements (exceeds 4 allowed). Open
func (l *launchRunner) RunE(cmd *cobra.Command, args []string) error {
var err error
vanillaManifest.Requirements.Minecraft = "*"
vanillaManifest.Requirements.MinepkgCompanion = "none"
Method Rule.appliesFor
has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring. Open
func (r Rule) appliesFor(os string, arch string) bool {
if os == "darwin" {
os = "osx"
}
- Read upRead up
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"