Enable clang-tidy bugprone-argument-comment and fix violations #22903

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2109-tidyNamedArgs changing 9 files +14 −12
  1. MarcoFalke commented at 3:35 PM on September 6, 2021: member

    Named arguments can be dangerous when they are wrong, because they are not enforced by the compiler. Currently there are only minor typos, no actual bugs.

    Fix the typos and add the .clang-tidy file to make it easier to find them in the future.

  2. MarcoFalke added the label Refactoring on Sep 6, 2021
  3. MarcoFalke commented at 3:45 PM on September 6, 2021: member

    To test on Ubuntu:

    apt install clang-tidy bear clang
    ./autogen.sh && ./configure --with-incompatible-bdb CC=clang CXX=clang++
    make clean && bear make -j $(nproc)     # For bear 2.x
    make clean && bear -- make -j $(nproc)  # For bear 3.x
    ( cd ./src/ && run-clang-tidy  -j $(nproc) )
    
  4. kiminuo commented at 8:28 PM on September 6, 2021: contributor

    Is it possibly instead of:

    make clean && bear make -j $(nproc) -> make clean && bear -- make -j $(nproc)

    ?

    (https://github.com/rizsotto/Bear#how-to-use)

    edit: I think there are two more instances where the parameter names are not entirely correct:

  5. DrahtBot commented at 12:26 AM on September 7, 2021: member

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #22019 (wallet: Introduce SelectionResult for encapsulating a coin selection solution by achow101)

    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.

  6. MarcoFalke commented at 6:58 AM on September 7, 2021: member

    @kiminuo

    No, that doesn't work for me:

    bear: Internal error.
    Traceback (most recent call last):
      File "/usr/local/bin/bear", line 265, in wrapper
        return function(*args, **kwargs)
      File "/usr/local/bin/bear", line 291, in intercept_build
        exit_code, current = capture(args, category)
      File "/usr/local/bin/bear", line 315, in capture
        exit_code = run_build(args.build, env=environment)
      File "/usr/local/bin/bear", line 189, in run_build
        exit_code = subprocess.call(command, *args, **kwargs)
      File "/usr/lib64/python3.9/subprocess.py", line 349, in call
        with Popen(*popenargs, **kwargs) as p:
      File "/usr/lib64/python3.9/subprocess.py", line 951, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/usr/lib64/python3.9/subprocess.py", line 1821, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '--'
    bear: Please run this command again and turn on verbose mode (add '-vvvv' as argument).
    
  7. kiminuo commented at 7:02 AM on September 7, 2021: contributor

    My bear version is bear 3.0.8 and I have Ubuntu 21.04. Anyway, bear make -j $(nproc) does not work for me, only bear -- make -j $(nproc). Maybe there was a breaking change in bear command. I don't know.

    edit: Yes, https://github.com/rizsotto/Bear/pull/388/files

  8. MarcoFalke commented at 7:10 AM on September 7, 2021: member

    @kiminuo Thanks, updated comment

  9. Enable clang-tidy bugprone-argument-comment and fix violations fa57fa1a2e
  10. MarcoFalke force-pushed on Sep 7, 2021
  11. MarcoFalke commented at 8:47 AM on September 7, 2021: member

    edit: I think there are two more instances where the parameter names are not entirely correct:

    Thanks, fixed

  12. practicalswift commented at 7:57 AM on September 8, 2021: contributor

    Concept ACK

    Could add this specific clang-tidy check as part of the CI lint pass to reduce the risk of introduction of bugprone argument comments going forward?

  13. MarcoFalke commented at 8:03 AM on September 8, 2021: member

    Could add this specific clang-tidy check as part of the CI lint pass to reduce the risk of introduction of bugprone argument comments going forward?

    Seems like something that should be done in a separate pull request to keep the discussion here focussed on adding the flag and fixing the violations.

  14. practicalswift commented at 10:27 AM on September 8, 2021: contributor

    cr ACK fa57fa1a2e764792b873998ddf38db2ac061dcb6

    Could add this specific clang-tidy check as part of the CI lint pass to reduce the risk of introduction of bugprone argument comments going forward?

    Seems like something that should be done in a separate pull request to keep the discussion here focussed on adding the flag and fixing the violations.

    Makes sense! I'd gladly review such PR FWIW :)

  15. fanquake approved
  16. fanquake commented at 3:33 AM on September 9, 2021: member

    ACK fa57fa1a2e764792b873998ddf38db2ac061dcb6

  17. fanquake merged this on Sep 9, 2021
  18. fanquake closed this on Sep 9, 2021

  19. sidhujag referenced this in commit daa3c6d230 on Sep 11, 2021
  20. MarcoFalke deleted the branch on Sep 14, 2021
  21. DrahtBot locked this on Oct 30, 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: 2026-05-02 15:14 UTC

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