Recipe Name:
String.format return value being ignored
Description:
A call to String.format is being made without the return value being used
Level:
warning
Language:
  • java
Tags:
  • Java basic
  • quality
Documentation

The String value returned by String#format is not used, rendering the call useless.

Unlike the Formatter#format function, String#format does not have side-effects, instead, the return value needs to be used.

Recipe
id: scw:java:string-format-unused
version: 10
metadata:
  name: String.format return value being ignored
  shortDescription: A call to String.format is being made without the return value being used
  level: warning
  language: java
  enabled: true
  comment: ""
  descriptionFile: descriptions/String.format_return_value_being_ignored.html
  tags: Java basic;quality
search:
  methodcall:
    not:
      anyOf:
      - in:
          assignment: {}
      - in:
          argument: {}
      - in:
          return: {}
      - in:
          methodcall: {}
      - in:
          expression: {}
      - in:
          annotation: {}
    name: format
    type: String
availableFixes: []