False positive: Cyclic import in Python
- Langage dominant
- CodeQL
- Étoiles
- 10.1k
- Forks
- 2.1k
- Merge moyen
- 2 j 15 h
- PR mergées (30 j)
- 141
Description
**Description of the false positive**
CodeQL falsely detects a cyclic import in a Pull request.
* There is an existing cyclic import in the code which is mitigated with an import inside of a function.
> toolopts imports global variables from systeminfo inside of `_register_options()`
> systeminfo imports toolopts
* The pull request includes switching the python modules that the identifiers are being defined in and reversing the imports so that only one module has to import the other
> toolopts now implements the global variables
> toolopts no longer imports systeminfo at all
> systeminfo now imports the global variables from toolopts
**Code samples or links to source code**
* Site of the additional import: https://github.com/oamg/convert2rhel/pull/820/files#diff-1e030442df599479d1af356a7eaa61a744973513548846a1a885b8eaca6f489cR28
* Site of the removal of import: https://github.com/oamg/convert2rhel/pull/820/files#diff-a7331917babf0a1504893963baab7ad842640877734e5dbeb39ebf97ec584565L130
**URL to the alert on GitHub code scanning (optional)**
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Start with the linked convert2rhel pull request and compare the import changes in toolopts and systeminfo, especially systeminfo's import and _register_options(). Reproduce the CodeQL cyclic-import alert against the revised arrangement and confirm that the existing mitigated cycle is no longer reported.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- security
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 25/100