apache / apache/infrastructure-boxer

assert should not be used to check external conditions

Open
#49 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
9
PR merge metrics
No merged PRs in 30d

Description

assert is not suitable for checking conditions that depend on external data, as it is not guaranteed to be evaluated.

There are several instance in the code where assert is used incorrectly, for example:

https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/oauthGeneric.py#L17

https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/repositories.py#L15-L16

https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/github.py#L39
https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/github.py#L84
https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/github.py#L95
https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/github.py#L106
https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/github.py#L118
https://github.com/apache/infrastructure-boxer/blob/1ce138ffef935b98f767dfe661b5d16365855b9a/server/plugins/github.py#L336

There are several others

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the assert usages in server/plugins/oauthGeneric.py, repositories.py, and github.py at the linked lines, then search the server/plugins directory for other instances. Confirm each assertion depends on external data; done means those checks remain enforced when Python assertions are disabled, with existing plugin behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.