Showing 129 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)
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
Repository struct {
ID int `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
FullName string `json:"full_name"`
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 461.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
HeadRepository struct {
ID int `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
FullName string `json:"full_name"`
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 461.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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)
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"
- 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 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"
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")
}
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
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])
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (m *MicrosoftClient) xstsAuth(ctx context.Context, xblToken string) (*xblAuthResponse, error) {
body := fmt.Sprintf(`{
"Properties": {
"SandboxId": "RETAIL",
"UserTokens": ["%s"]
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 268.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
func (m *MicrosoftClient) xblAuth(ctx context.Context, token string) (*xblAuthResponse, error) {
body := fmt.Sprintf(`{
"Properties": {
"AuthMethod": "RPS",
"SiteName": "user.auth.xboxlive.com",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 268.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 {
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 != "*" {
- 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 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)
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])
- 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 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 {
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
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
- 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 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")
}
- 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 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