CodeQL documentation

Explicit export is not defined

ID: py/undefined-export
Kind: problem
Security severity: 
Severity: error
Precision: high
Tags:
   - quality
   - reliability
   - correctness
Query suites:
   - python-security-and-quality.qls

Click to see the query in the CodeQL repository

When a module is imported using import *, all attributes listed in __all__ are imported. If __all__ includes attributes that are not defined in the module then an exception is triggered. This usually indicates a typographic error in the attributes in __all__ or in the name of the object.

Recommendation

Correct any typographic errors, either in the name of the object or in the string in __all__. If there are no typographic errors, either delete the name from __all__ or add the object to the module.

Example

In the example, the function name spam has been misspelled in the __all__ list. This will result in spamm being highlighted as an undefined export. Correcting the spelling will fix the defect.

__all__ = ['spamm', 'troll', 'paywall']

def spam(): return 'Spam'
def troll(): return 'Troll'
def paywall(): return 'Pay wall'

References

  • © GitHub, Inc.
  • Terms
  • Privacy
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy