mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-28 22:08:12 +09:00
Fix quality issues (#1856)
* Add .deepsource.toml * Remove unnecessary comparison with bool * Remove unnecessary use of slice * Replace multiple `append`s with one * Remove unnecessary wrapping of function call * Fix check for empty string * Simplify error creation with `fmt.Errorf` * Fix defers before error check Signed-off-by: sourya_deepsource <sourya@deepsource.io> * Remove untrappable `os.Kill` signal Signed-off-by: sourya_deepsource <sourya@deepsource.io> * Remove empty else branch Signed-off-by: sourya_deepsource <sourya@deepsource.io> * Add missing error check Signed-off-by: sourya_deepsource <sourya@deepsource.io> * Merge variable declaration and assignment Signed-off-by: sourya_deepsource <sourya@deepsource.io> * Remove unnecessary `nil` check Signed-off-by: sourya_deepsource <sourya@deepsource.io> * Revert changes to generated files Signed-off-by: sourya_deepsource <sourya@deepsource.io> * Remove .deepsource.toml Signed-off-by: sourya_deepsource <sourya@deepsource.io> Co-authored-by: DeepSource Bot <bot@deepsource.io> Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
@@ -14,9 +14,9 @@ import (
|
||||
func (i *InfoBuf) LoadHistory() {
|
||||
if config.GetGlobalOption("savehistory").(bool) {
|
||||
file, err := os.Open(filepath.Join(config.ConfigDir, "buffers", "history"))
|
||||
defer file.Close()
|
||||
var decodedMap map[string][]string
|
||||
if err == nil {
|
||||
defer file.Close()
|
||||
decoder := gob.NewDecoder(file)
|
||||
err = decoder.Decode(&decodedMap)
|
||||
|
||||
@@ -48,8 +48,8 @@ func (i *InfoBuf) SaveHistory() {
|
||||
}
|
||||
|
||||
file, err := os.Create(filepath.Join(config.ConfigDir, "buffers", "history"))
|
||||
defer file.Close()
|
||||
if err == nil {
|
||||
defer file.Close()
|
||||
encoder := gob.NewEncoder(file)
|
||||
|
||||
err = encoder.Encode(i.History)
|
||||
|
||||
@@ -54,7 +54,7 @@ func (i *InfoBuf) Close() {
|
||||
func (i *InfoBuf) Message(msg ...interface{}) {
|
||||
// only display a new message if there isn't an active prompt
|
||||
// this is to prevent overwriting an existing prompt to the user
|
||||
if i.HasPrompt == false {
|
||||
if !i.HasPrompt {
|
||||
displayMessage := fmt.Sprint(msg...)
|
||||
// if there is no active prompt then style and display the message as normal
|
||||
i.Msg = displayMessage
|
||||
@@ -78,7 +78,7 @@ func (i *InfoBuf) ClearGutter() {
|
||||
func (i *InfoBuf) Error(msg ...interface{}) {
|
||||
// only display a new message if there isn't an active prompt
|
||||
// this is to prevent overwriting an existing prompt to the user
|
||||
if i.HasPrompt == false {
|
||||
if !i.HasPrompt {
|
||||
// if there is no active prompt then style and display the message as normal
|
||||
i.Msg = fmt.Sprint(msg...)
|
||||
i.HasMessage, i.HasError = false, true
|
||||
|
||||
Reference in New Issue
Block a user