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
Calling .strip() on the result of config.get("benchmarks_root", "") can raise an error if the value in config is not a string (e.g., None). Consider casting to str or adding a type check before stripping.
The condition if benchmarks_root and benchmarks_root != "" is redundant because a non-empty string is truthy. You can simplify it to if benchmarks_root.
-benchmarks_root = config.get("benchmarks_root", "").strip()+benchmarks_root = str(config.get("benchmarks_root") or "").strip()
Suggestion importance[1-10]: 6
__
Why: Wrapping the config value with str(... or "") prevents AttributeError if a non-string is returned, adding useful type safety.
Low
General
Simplify string emptiness check
Simplify the conditional by relying on the truthiness of benchmarks_root. The and benchmarks_root != "" check is redundant since an empty string is already falsy.
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
config.getfor benchmarks_root retrievalStrip whitespace before checking benchmarks_root
Refine conditional to avoid empty string detection
Changes walkthrough 📝
cmd_init.py
Refine benchmarks_root presence checkcodeflash/cli_cmds/cmd_init.py
"benchmarks_root" in configwithconfig.get(...).strip()benchmarks_rootvariable assignmentifcheck to ensure non-empty string