-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Static analysis tool for String.format #87166
Copy link
Copy link
Open
Labels
:Core/Infra/LoggingLog management and logging utilitiesLog management and logging utilities:Delivery/ToolingDeveloper tooliing and automationDeveloper tooliing and automation>enhancementTeam:Core/InfraMeta label for core/infra teamMeta label for core/infra teamTeam:DeliveryMeta label for Delivery teamMeta label for Delivery team
Metadata
Metadata
Assignees
Labels
:Core/Infra/LoggingLog management and logging utilitiesLog management and logging utilities:Delivery/ToolingDeveloper tooliing and automationDeveloper tooliing and automation>enhancementTeam:Core/InfraMeta label for core/infra teamMeta label for core/infra teamTeam:DeliveryMeta label for Delivery teamMeta label for Delivery team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Description
String.format can throw RuntimeException when a format has more place holders than provided arguments. If more arguments is provided, it silently return a result.
When a String.format is used in logging, more importantly in delayed execution for instance
it will not fail when tested without logging level set to trace.
ES should use a static analysis to find out usages of String.format like this (and the Strings.format which is a utility in core)
Sonarqube has a rule for this, maybe it could be adopted?
https://rules.sonarsource.com/java/RSPEC-2275