Skip to content

Commit

Permalink
Reverted yielding only non-empty strings in order to stay consistent …
Browse files Browse the repository at this point in the history
…and not introduce unspecified rule-exceptions.
  • Loading branch information
adamstorek committed Jul 5, 2022
1 parent e4225c2 commit 71cb09a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions capa/features/extractors/ts/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def extract_language(engine: TreeSitterExtractorEngine) -> Iterator[Tuple[Featur
def extract_file_strings(engine: TreeSitterExtractorEngine) -> Iterator[Tuple[Feature, Address]]:
for global_node, _ in engine.get_global_statements():
for node, _ in engine.get_string_literals(global_node):
s = engine.get_range(node).strip('"')
if len(s) > 0:
yield String(engine.get_range(node).strip('"')), engine.get_address(node)
yield String(engine.get_range(node).strip('"')), engine.get_address(node)


def extract_file_integer_literals(engine: TreeSitterExtractorEngine) -> Iterator[Tuple[Feature, Address]]:
Expand Down Expand Up @@ -60,4 +58,5 @@ def extract_features(engine: TreeSitterExtractorEngine) -> Iterator[Tuple[Featur
extract_file_integer_literals,
extract_file_strings,
extract_language,
extract_namespaces,
)
File renamed without changes.

0 comments on commit 71cb09a

Please sign in to comment.