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

About using/notusing 'assert' in the code #228

Closed
dpizetta opened this issue Mar 19, 2020 · 2 comments · Fixed by #233
Closed

About using/notusing 'assert' in the code #228

dpizetta opened this issue Mar 19, 2020 · 2 comments · Fixed by #233
Labels
Milestone

Comments

@dpizetta
Copy link
Collaborator

@goanpeca what is your opinion about these messages and orientations?

From here: https://travis-ci.org/github/ColinDuquesnoy/QDarkStyleSheet/jobs/664411481?utm_medium=notification&utm_source=github_status

Explanation here: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

Also, the var file_colors are defined internally to the loop.

Run started:2020-03-19 14:19:11.618937
Test results:
>> Issue: [B101:assert_used] Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
   Severity: Low   Confidence: High
   Location: qdarkstyle/utils/images.py:69
   More Info: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
68	
69	    assert file_colors
70	
71	    return file_colors
--------------------------------------------------
Code scanned:
	Total lines of code: 11852
	Total lines skipped (#nosec): 0
Run metrics:
	Total issues (by severity):
		Undefined: 0.0
		Low: 1.0
		Medium: 0.0
		High: 0.0
	Total issues (by confidence):
		Undefined: 0.0
		Low: 0.0
		Medium: 0.0
		High: 1.0
Files skipped (0):
ERROR: InvocationError for command /home/travis/build/ColinDuquesnoy/QDarkStyleSheet/.tox/py38-safety/bin/bandit --recursive qdarkstyle (exited with code 1)
___________________________________ summary ____________________________________
ERROR:   py38-safety: commands failed
The command "tox" exited with 1.
@dpizetta dpizetta modified the milestones: 2.8.1, 2.9 Mar 19, 2020
@goanpeca
Copy link
Collaborator

@dpizetta yes indeed we should not use asserts for these things as they are removed when compiling optimized code. So we should use proper checks and raise exceptions as needed if something is not complying with these checks.

@dpizetta
Copy link
Collaborator Author

Could you make those changes? TKs

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

Successfully merging a pull request may close this issue.

2 participants