lint: Convert lint-locale-dependence.sh to Python #24932

pull Kvaciral wants to merge 2 commits into bitcoin:master from Kvaciral:lint-locale-dependence-port changing 2 files +259 −241
  1. Kvaciral commented at 2:05 pm on April 20, 2022: contributor
    A port of test/lint/lint-locale-dependence.sh to a Python-script as part of the request of #24783. Checked for output-consistency.
  2. DrahtBot added the label Tests on Apr 20, 2022
  3. DrahtBot commented at 2:59 pm on April 20, 2022: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #24922 (Isolate the storage abstraction layer from the application/serialization layer by TheQuantumPhysicist)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. Kvaciral force-pushed on Apr 20, 2022
  5. laanwj commented at 3:18 pm on April 20, 2022: member

    No idea if you want to do it here, but FWIW here’s a patch that makes KNOWN_VIOLATIONS specific:

     0diff --git a/test/lint/lint-locale-dependence.py b/test/lint/lint-locale-dependence.py
     1index 47f1395dd626468eb8a427ee64897f6abcdf8acb..6c7b5f549f9bd67d40dfdb38df201303b43079b2 100755
     2--- a/test/lint/lint-locale-dependence.py
     3+++ b/test/lint/lint-locale-dependence.py
     4@@ -46,9 +46,10 @@ from subprocess import check_output, CalledProcessError
     5 KNOWN_VIOLATIONS = [
     6     "src/dbwrapper.cpp:.*vsnprintf",
     7     "src/test/dbwrapper_tests.cpp:.*snprintf",
     8-    "src/test/fuzz/locale.cpp",
     9-    "src/test/fuzz/string.cpp",
    10-    "src/test/util_tests.cpp"
    11+    "src/test/fuzz/locale.cpp:.*setlocale",
    12+    "src/test/fuzz/string.cpp:.*strtol",
    13+    "src/test/fuzz/string.cpp:.*strtoul",
    14+    "src/test/util_tests.cpp:.*strtoll"
    15 ]
    16 
    17 REGEXP_EXTERNAL_DEPENDENCIES_EXCLUSIONS = [
    

    Edit: and after #24933 we could also enable checking for strerror except for src/util/strerror.cpp, but I would guess this gets merged first.

  6. laanwj commented at 3:20 pm on April 20, 2022: member
    Tested ACK 0628561af940b8dd08565586af911a1b06576b97 re-ACK d1a7d2af231597c200441f9ffdd277f4888a41e9
  7. in test/lint/lint-locale-dependence.py:218 in d1a7d2af23 outdated
    213+    "wcwidth",
    214+    "wprintf"
    215+]
    216+
    217+
    218+def git_grep_call(regexp_locale_dependent_functions):
    


    laanwj commented at 4:44 pm on April 21, 2022:
    This function name is too generic for what it does. Maybe find_locale_dependent_function_uses?
  8. lint: Convert lint-locale-dependence.sh to Python 229917d3d4
  9. in test/lint/lint-locale-dependence.py:237 in d1a7d2af23 outdated
    232+def main():
    233+    exit_code = 0
    234+
    235+    regexp_ignore_known_violations = "|".join(KNOWN_VIOLATIONS)
    236+    regexp_locale_dependent_functions = "|".join(LOCALE_DEPENDENT_FUNCTIONS)
    237+    git_grep_output = git_grep_call(regexp_locale_dependent_functions)
    


    laanwj commented at 4:46 pm on April 21, 2022:
    I think it’d make sense to pass in the list of locale dependent functions to this function, then build the regexp inside (it’s a implementation detail).
  10. Kvaciral force-pushed on Apr 21, 2022
  11. lint: Make known violations more specific in lint-locale-dependence 3043a1bc9d
  12. Kvaciral force-pushed on Apr 21, 2022
  13. laanwj commented at 3:53 pm on April 25, 2022: member
    Tested and code review ACK 3043a1bc9d32b451020b511c8340c12e0d99f8cc
  14. laanwj merged this on Apr 25, 2022
  15. laanwj closed this on Apr 25, 2022

  16. sidhujag referenced this in commit 8b554817a2 on Apr 26, 2022
  17. DrahtBot locked this on Apr 25, 2023

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: 2024-12-18 21:12 UTC

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