Simplified boolean comparisons

Just a bit easier to read, in my opinion.
This commit is contained in:
Christian Muehlhaeuser 2019-07-19 12:47:21 +02:00
parent 09296c0214
commit 04d4881512
No known key found for this signature in database
GPG Key ID: 3CF9FA45CA1EBB7E
6 changed files with 6 additions and 24 deletions

View File

@ -42,10 +42,7 @@ func (ci *Evaluator) LoadConfig(configFile string) error {
func (ci *Evaluator) isRuleEnabled(rule Rule) bool {
value := ci.Config.GetString(rule.Key())
if value == "disabled" {
return false
}
return true
return value != "disabled"
}
func (ci *Evaluator) Evaluate(analysis *image.AnalysisResult) bool {

View File

@ -62,10 +62,7 @@ func (controller *DetailsController) Setup(v *gocui.View, header *gocui.View) er
// IsVisible indicates if the details view pane is currently initialized.
func (controller *DetailsController) IsVisible() bool {
if controller == nil {
return false
}
return true
return controller != nil
}
// CursorDown moves the cursor down in the details pane (currently indicates nothing).

View File

@ -182,10 +182,7 @@ func (controller *FileTreeController) Setup(v *gocui.View, header *gocui.View) e
// IsVisible indicates if the file tree view pane is currently initialized
func (controller *FileTreeController) IsVisible() bool {
if controller == nil {
return false
}
return true
return controller != nil
}
// resetCursor moves the cursor back to the top of the buffer and translates to the top of the buffer.

View File

@ -86,10 +86,7 @@ func (vm *FileTreeViewModel) bufferIndexUpperBound() int {
// IsVisible indicates if the file tree view pane is currently initialized
func (vm *FileTreeViewModel) IsVisible() bool {
if vm == nil {
return false
}
return true
return vm != nil
}
// resetCursor moves the cursor back to the top of the buffer and translates to the top of the buffer.

View File

@ -135,10 +135,7 @@ func (controller *LayerController) height() uint {
// IsVisible indicates if the layer view pane is currently initialized.
func (controller *LayerController) IsVisible() bool {
if controller == nil {
return false
}
return true
return controller != nil
}
// PageDown moves to next page putting the cursor on top

View File

@ -40,10 +40,7 @@ func (controller *StatusController) Setup(v *gocui.View, header *gocui.View) err
// IsVisible indicates if the status view pane is currently initialized.
func (controller *StatusController) IsVisible() bool {
if controller == nil {
return false
}
return true
return controller != nil
}
// CursorDown moves the cursor down in the details pane (currently indicates nothing).