Skip to content

Commit

Permalink
Resolve invalid escape sequence '\.' warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoSagadin committed Jul 5, 2024
1 parent 3dadcb1 commit bcb8804
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/east/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def cli(ctx, echo):
\b
\n\nWant to learn what each command does?
Run [bold]east \[command] --help[/] to show documentation for that command.
Run [bold]east \\[command] --help[/] to show documentation for that command.
\b
\n\nNote that commands are split into two groups:
Expand Down
2 changes: 1 addition & 1 deletion src/east/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def dir_find(root, west_board):
files = os.listdir(board_dir)

# Find all files with west board name, no matter the version
pattern = f"^{west_board}_[0-9]?[0-9]?_[0-9]?[0-9]?_[0-9]?[0-9]?\.conf"
pattern = rf"^{west_board}_[0-9]?[0-9]?_[0-9]?[0-9]?_[0-9]?[0-9]?\.conf"
matches = [file for file in files if re.match(pattern, file)]

# Extract hardware versions and put them into format expected by the west.
Expand Down
7 changes: 4 additions & 3 deletions src/east/workspace_commands/codechecker_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ def var_never_read_before_disabled_macro_found(files, diag):
"unused variable '(.*)'",
]

var = None
for desc_regex in desc_regexes:
hit = re.search(desc_regex, diag["description"])
if hit:
# Extracted variable name
var = hit.group(1)
break

if not hit:
if not var:
return False

# A hit was found, locate the file where the diagnostic was found
Expand All @@ -154,8 +155,8 @@ def var_never_read_before_disabled_macro_found(files, diag):
# If you hit a line where variable is passed to __ASSERT* or LOG_* macro,
# then this is a false positive, and should be removed
patterns = [
f".*__ASSERT.*\(.*{var}.*,.*",
f".*LOG_.*\(.*,.*{var}.*",
rf".*__ASSERT.*\(.*{var}.*,.*",
rf".*LOG_.*\(.*,.*{var}.*",
]

for pattern in patterns:
Expand Down

0 comments on commit bcb8804

Please sign in to comment.