lint: run mypy over contrib/devtools #20451

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:contrib_devtools_mypy changing 3 files +12 −11
  1. fanquake commented at 3:43 am on November 22, 2020: member

    wumpus mentioned on IRC that we don’t currently run mypy over the contrib/devtools directory, and that it would likely be worthwhile given #20434. This just adds that dir to the linter, as well as some missing annotations to fix existing errors. Note that now we require Python 3.6 we can make use of variable annotations.

    master (patched to check contrib devtools):

    0test/lint/lint-python.sh
    1contrib/devtools/symbol-check.py:154: error: Incompatible types in assignment (expression has type "List[str]", variable has type "str")
    2contrib/devtools/circular-dependencies.py:35: error: Need type annotation for 'deps' (hint: "deps: Dict[<type>, <type>] = ...")
    3contrib/devtools/circular-dependencies.py:67: error: Need type annotation for 'closure' (hint: "closure: Dict[<type>, <type>] = ...")
    4Found 4 errors in 3 files (checked 187 source files)
    

    I haven’t quite gone as far as to add annotations like

    0CHECKS: Dict[str, List[Tuple[str, Callable[[Any], bool]]]] = {...
    

    to symbol-check.py.

  2. fanquake added the label Tests on Nov 22, 2020
  3. fanquake added the label Scripts and tools on Nov 22, 2020
  4. in contrib/devtools/symbol-check.py:154 in 88e839bea9 outdated
    155-        if 'Machine:' in line:
    156-            arch = line[-1]
    157-        if len(line)>7 and re.match('[0-9]+:$', line[0]):
    158-            (sym, _, version) = line[7].partition('@')
    159-            is_import = line[6] == 'UND'
    160+        split_line: List[str] = line.split()
    


    fanquake commented at 3:44 am on November 22, 2020:
    note: this will be removed with #20434.

    laanwj commented at 10:12 am on November 22, 2020:
    yes, this entire function doesn’t exist anymore :smile:
  5. laanwj commented at 9:09 am on November 22, 2020: member
    Concept ACK
  6. laanwj commented at 10:10 am on November 22, 2020: member

    In #20434 (specifically for pixie and symbol check / security check) I’ve used mypy with --disallow-untyped-calls . I tried --disallow-untyped-defs and --disallow-incomplete-defs as well but that was some more work. probably better to leave it for a later PR.

    Better not to overlap work here. I’d prefer if this didn’t collide with changes in #20434 (or maybe base it on that).

    CHECKS: Dict[str, List[Tuple[str, Callable[[Any], bool]]]] = {… to symbol-check.py.

    I didn’t figure out that one!

  7. practicalswift commented at 11:12 am on November 22, 2020: contributor
    Concept ACK: fail swift is better than fail slow (at run-time)
  8. DrahtBot commented at 1:20 pm on November 22, 2020: member

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

    Conflicts

    No conflicts as of last run.

  9. fanquake force-pushed on Nov 23, 2020
  10. fanquake force-pushed on Nov 23, 2020
  11. fanquake commented at 4:04 am on November 23, 2020: member

    Better not to overlap work here. I’d prefer if this didn’t collide with changes in #20434 (or maybe base it on that).

    Good call. I’ve now based this on #20434.

  12. DrahtBot added the label Needs rebase on Dec 18, 2020
  13. DrahtBot commented at 12:18 pm on December 18, 2020: member

    🐙 This pull request conflicts with the target branch and needs rebase.

    Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a “draft”.

  14. lint: run mypy over contrib/devtools 1ef2138c0d
  15. fanquake force-pushed on Dec 28, 2020
  16. fanquake removed the label Needs rebase on Dec 28, 2020
  17. fanquake commented at 6:26 am on December 28, 2020: member
    This has been rebased post #20434 and should be ready for review.
  18. laanwj commented at 1:17 pm on December 28, 2020: member
    ACK 1ef2138c0db3bd4f9332c777fa3fb2770dc1b08c
  19. laanwj merged this on Dec 28, 2020
  20. laanwj closed this on Dec 28, 2020

  21. sidhujag referenced this in commit 93ce1b2cd9 on Dec 28, 2020
  22. fanquake deleted the branch on Feb 9, 2021
  23. DrahtBot locked this on Aug 16, 2022

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-11-17 06:12 UTC

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