gtg icon indicating copy to clipboard operation
gtg copied to clipboard

Fix an inappropriate test expression to remove a logical short circuit

Open munahaf opened this issue 1 year ago • 6 comments

In file: main_window.py, the comparison of Collection length creates a logical short circuit. I suggested that the Collection length comparison should be done without creating a logical short circuit.

Sponsorship and Support:

This work is done by the security researchers from OpenRefactory and is supported by the Open Source Security Foundation (OpenSSF): Project Alpha-Omega. Alpha-Omega is a project partnering with open source software project maintainers to systematically find new, as-yet-undiscovered vulnerabilities in open source code - and get them fixed – to improve global software supply chain security.

The bug is found by running the Intelligent Code Repair (iCR) tool by OpenRefactory and then manually triaging the results.

munahaf avatar Sep 18 '23 10:09 munahaf

The change itself looks good to me (I doubt that len() here will return a negative value, and untested), but the commit message is a bit too generic. Could it be a bit more specific? Like "Remove tautology regarding selected tags filter" or something.

Neui avatar Sep 18 '23 17:09 Neui

@munahaf Could you use git rebase -i onto the latest version of our master branch, to reword your commit message as per the feedback above?

nekohayo avatar Feb 26 '24 18:02 nekohayo

@sqatx might be interested in this too.

nekohayo avatar Feb 26 '24 18:02 nekohayo

Related:

  • #992
  • #999

nekohayo avatar Feb 29 '24 15:02 nekohayo

Agree with @Neui , len() never returns a negative unless you implement the dunder method yourself and call it manually like tags.__len__()

diegogangl avatar Feb 29 '24 23:02 diegogangl

Changed the commit message per suggestion.

munahaf avatar Mar 01 '24 16:03 munahaf

@munahaf, sorry for pushing here and un-drafting. I'm trying to get things in faster :) Thanks for the work!

diegogangl avatar Apr 26 '24 15:04 diegogangl