CodeQL 文档

字符串文字中缺少空格

ID: java/missing-space-in-concatenation
Kind: problem
Security severity: 
Severity: recommendation
Precision: very-high
Tags:
   - readability
Query suites:
   - java-security-and-quality.qls

单击以在 CodeQL 存储库中查看查询

将一个长字符串文字拆分为多行通常有助于提高可读性,但这也会让人很难注意到字符串连接处是否缺少空格。

建议

检查字符串文字以查看它是否具有预期文本。特别是,在换行符附近查找缺少的空格。

示例

以下示例显示了一个拆分为两行的文本文字,并且在换行符处省略了两个单词之间的空格字符。

String s = "This text is" +
  "missing a space.";

参考

  • ©GitHub, Inc.
  • 条款
  • 隐私