Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify language identification using dictionary mapping #898

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions floss/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,16 +548,14 @@ def main(argv=None) -> int:

# set language configurations
lang_id: Language
if args.language == Language.GO.value:
lang_id = Language.GO
elif args.language == Language.RUST.value:
lang_id = Language.RUST
elif args.language == Language.DOTNET.value:
lang_id = Language.DOTNET
elif args.language == "none":
lang_id = Language.UNKNOWN
else:
lang_id = identify_language(sample, static_strings)
lang_id_mapping = {
Language.GO.value: Language.GO,
Language.RUST.value: Language.RUST,
Language.DOTNET.value: Language.DOTNET,
"none": Language.UNKNOWN,
}

lang_id = lang_id_mapping.get(args.language, identify_language(sample, static_strings))

if lang_id == Language.GO:
if analysis.enable_tight_strings or analysis.enable_stack_strings or analysis.enable_decoded_strings:
Expand Down