-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Description
Consider a code snippet like this:
# sobelow_skip ["DOS.StringToAtom"] (atoms are a fixed set of table names in the DB schema)
defp get_table_sizes() do
…
end
The explanation given at the end of the sobelow_skip line will cause parsing to silently fail for the whole file when --skip is used. This is a insidious failure, since it will seem like the comment is working but we're also now ignoring any other findings in the file.
This is because of a regex that runs during parsing to convert these comment lines to @sobelow module attribute statements. The regex replaces the first part of the line but not any trailing content, which becomes garbage at the end of the attribute statement.
I see two ways to fix the regex:
- Don't match if
sobelow_skipis followed by other content. So we fail to skip the finding but the failure is visible to the user. - Match the whole line and delete any trailing content. This seems the more reasonable way to go, and I've opened a PR (Issue #168: trailing content on an
sobelow_ignoreline silently breaks parsing #169).
Metadata
Metadata
Assignees
Labels
No labels