Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unreachable code #181

Open
matewolf opened this issue Aug 29, 2023 · 0 comments
Open

Unreachable code #181

matewolf opened this issue Aug 29, 2023 · 0 comments

Comments

@matewolf
Copy link

        c.basicAuth = (c.cmdConfig.GetString(options.ConfigKeyJiraUser) != "") &&
		(c.cmdConfig.GetString(options.ConfigKeyJiraPassword) != "")

	if c.basicAuth { //nolint:nestif // TODO(lint)
		log.Debug("Using HTTP Basic Authentication")

		jUser := c.cmdConfig.GetString(options.ConfigKeyJiraUser)
		if jUser == "" {
			return errJiraUsernameRequired
		}

		jPass := c.cmdConfig.GetString(options.ConfigKeyJiraPassword)
		if jPass == "" {
			fmt.Print("Enter your Jira password: ")
			bytePass, err := term.ReadPassword(syscall.Stdin)
			if err != nil {
				return errJiraPasswordRequired
			}
			fmt.Println()
			c.cmdConfig.Set(options.ConfigKeyJiraPassword, string(bytePass))
		}
	}

In the if statement's body jUser and jPass could not be empty string because of the condition of the statement. If we want to enable password input from the terminal, we need to change the condition. Otherwise, checks are unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant