fix: Prevent TypeError in GcovPlugin when scanning node_modules#726
Open
sentry[bot] wants to merge 1 commit into
Open
fix: Prevent TypeError in GcovPlugin when scanning node_modules#726sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses a
TypeError: 'bool' object is not subscriptablethat occurred during the 'Upload Coverage' step, specifically within the GcovPlugin.Root Cause:
The GcovPlugin's
run_preparation()method unconditionally callssearch_files()to locate.gcnofiles across the entire project tree. Even when the--disable-searchflag was used (which only affects theCoverageFileFinder), the GcovPlugin would still traverse large directories likenode_modules. When processing extremely deeply nested paths withinnode_modules, accessingpath.namein Python 3.9.5'spathlibmodule could lead to the describedTypeError.Solution:
GcovPlugin.__init__to includenode_modules,.git, andvendorin its defaultfolders_to_ignorelist. This prevents the plugin from traversing these directories, which are known not to contain.gcnofiles, thus avoiding the problematic path structures.path.nameAccess: Added atry/except TypeErrorblock aroundpath.nameaccess within the_is_includedhelper function infolder_searcher.py. This ensures that if aTypeErroris still encountered due to an unexpected path structure (e.g., apathlibbug with deeply nested paths in a frozen environment), the specific file is skipped with a warning instead of crashing the entire upload process.Fixes CLI-F7