lint/format-strings: Correctly exclude escaped percent symbols #14960

pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:bugfix_lint_fmtstr changing 1 files +2 −3
  1. luke-jr commented at 3:44 PM on December 14, 2018: member

    The current code fails to exclude correctly for patterns like "%%%X"

  2. lint/format-strings: Correctly exclude escaped percent symbols 57281199b8
  3. MarcoFalke requested review from practicalswift on Dec 14, 2018
  4. MarcoFalke added the label Tests on Dec 14, 2018
  5. practicalswift commented at 8:22 AM on December 15, 2018: contributor

    Concept ACK. Thanks for finding and fixing this. @luke-jr, could you add a doctest test that fails before the fix and passes after the fix?

  6. in test/lint/lint-format-strings.py:247 in 57281199b8
     240 | @@ -241,12 +241,11 @@ def count_format_specifiers(format_string):
     241 |      4
     242 |      """
     243 |      assert(type(format_string) is str)
     244 | +    format_string = format_string.replace('%%', 'X')
     245 |      n = 0
     246 |      in_specifier = False
     247 |      for i, char in enumerate(format_string):
    


    practicalswift commented at 5:35 PM on December 16, 2018:

    i becomes unused after this change. Remove enumerate(...) :-)

    for char in format_string:

  7. laanwj commented at 2:15 PM on December 18, 2018: member

    utACK, but yes no longer need i

  8. in test/lint/lint-format-strings.py:242 in 57281199b8
     240 | @@ -241,12 +241,11 @@ def count_format_specifiers(format_string):
     241 |      4
     242 |      """
    


    promag commented at 3:23 PM on December 18, 2018:

    Could add an example here.

  9. promag commented at 3:23 PM on December 18, 2018: member

    tACK 5728119 — also tested @practicalswift suggestion.

  10. MarcoFalke merged this on Dec 22, 2018
  11. MarcoFalke closed this on Dec 22, 2018

  12. MarcoFalke referenced this in commit 18857b4c40 on Dec 22, 2018
  13. PastaPastaPasta referenced this in commit 41bae818d7 on Jun 27, 2021
  14. PastaPastaPasta referenced this in commit 6657074db5 on Jun 28, 2021
  15. PastaPastaPasta referenced this in commit 0e84e74988 on Jun 29, 2021
  16. PastaPastaPasta referenced this in commit e8b3522039 on Jul 1, 2021
  17. PastaPastaPasta referenced this in commit 3dbd54d945 on Jul 1, 2021
  18. PastaPastaPasta referenced this in commit 8194129b6f on Jul 1, 2021
  19. UdjinM6 referenced this in commit 3e408557bf on Jul 5, 2021
  20. PastaPastaPasta referenced this in commit f10236c2bd on Jul 8, 2021
  21. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me