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

check_return: Calling "Scan" without checking return value #12

Open
subpop opened this issue Feb 17, 2022 · 1 comment
Open

check_return: Calling "Scan" without checking return value #12

subpop opened this issue Feb 17, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@subpop
Copy link
Collaborator

subpop commented Feb 17, 2022

A covscan check found that scanner.Scan is not checked for a return value in main.

#   108|   							scanner := bufio.NewScanner(os.Stdin)
#   109|   							fmt.Print("Username: ")
#   110|-> 							_ = scanner.Scan()
#   111|   							username = strings.TrimSpace(scanner.Text())
#   112|   						}
@subpop subpop added the good first issue Good for newcomers label Feb 17, 2022
@subpop
Copy link
Collaborator Author

subpop commented Mar 22, 2022

More covscan errors:


1. rhc/rhc-0.2.1/main.go:224: suppressed_error: The error returned by the function "Fprintf(w, "%v\t%v\n", svc, err)" is not explicitly checked.
2. rhc/rhc-0.2.1/main.go:224: remediation: Explicitly check the return error.
#   222|   					fmt.Fprintln(w, "STEP\tERROR\t")
#   223|   					for svc, err := range errorMessages {
#   224|-> 						fmt.Fprintf(w, "%v\t%v\n", svc, err)
#   225|   					}
#   226|   					w.Flush()


1. rhc/rhc-0.2.1/main.go:222: suppressed_error: The error returned by the function "Fprintln(w, "STEP\tERROR\t")" is not explicitly checked.
2. rhc/rhc-0.2.1/main.go:222: remediation: Explicitly check the return error.
#   220|   					fmt.Printf("The following errors were encountered during disconnect:\n\n")
#   221|   					w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
#   222|-> 					fmt.Fprintln(w, "STEP\tERROR\t")
#   223|   					for svc, err := range errorMessages {
#   224|   						fmt.Fprintf(w, "%v\t%v\n", svc, err)



1. rhc/rhc-0.2.1/insights.go:22: suppressed_error: The error returned by the function "cmd.Run()" is not explicitly checked.
2. rhc/rhc-0.2.1/insights.go:22: remediation: Explicitly check the return error.
#    20|   	cmd := exec.Command("/usr/bin/insights-client", "--status")
#    21|   
#    22|-> 	_ = cmd.Run()
#    23|   
#    24|   	return cmd.ProcessState.Success()

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

No branches or pull requests

1 participant