Skip to main content

Log in to comment and vote

Comments1

  • Stephen

    Team•

    Nov 11

    Hi! Great question. CodeScene analyses every file written in a supported language, and __init__.py is a normal Python module as far as the analysis is concerned. That’s deliberate, because these files often contain real code: package-level imports, re-exports, configuration and sometimes logic. They can also change often and be coupled to other modules, which is useful to see in the hotspot and change coupling views.

    If yours are mostly empty markers and don’t add value, you can exclude them:

    1. Open Project Configuration → Exclusions & Filters.

    2. Under Exclude content (by path), add the glob pattern **/__init__.py. The leading **/ makes it apply in every folder and repository.

    3. Save, and the files will be left out of the next analysis.

    You can’t use the extension-based “Exclude files” option here, because that would exclude every .py file.

    One thing to consider first: If any of your __init__.py files hold real logic, excluding them also removes that code from Code Health and hotspot results. In that case, a narrower pattern for specific folders may be a better fit.