You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The module_root variable is assigned a Path for custom paths but remains a string in other branches, which may lead to unexpected type errors. Consider unifying the type across all cases.
The custom path is used directly and may remain relative; you may need to call .resolve() or validate its absolute form to avoid issues with relative paths.
Normalize the custom path and ensure it points to an existing directory before proceeding. Use expanduser() and resolve() to handle tilde or relative inputs and then check is_dir(), calling apologize_and_exit() on failure.
-module_root = Path(custom_module_root_answer["path"])+module_root = Path(custom_module_root_answer["path"]).expanduser().resolve()+if not module_root.is_dir():+ apologize_and_exit(f"Provided module root '{module_root}' is not a directory.")
Suggestion importance[1-10]: 8
__
Why: Using expanduser() and resolve() then checking is_dir() prevents invalid or non-existent paths at runtime, improving the robustness of module root selection.
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
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.
PR Type
Bug fix
Description
Use user-provided path directly for module root
Remove automatic prepending of current directory
Exit if no custom path provided
Changes walkthrough 📝
cmd_init.py
Direct use of custom module pathcodeflash/cli_cmds/cmd_init.py
module_rootassignment for custom inputPath(curdir)concatenation