Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hair trimming in pdnsutil #1 #15039

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

miodvallat
Copy link
Contributor

Short description

This PR is one first step in the path to make pdnsutil code readable and maintainable.
Key changes are:

  • every toplevel pdnsutil command is now handled by its own routine, rather than inline in main.
  • command declaration is now a map data structure, which allows the nested if ... else if ... else if ... spaghetti in main to be replaced by a find and function pointer call.

Did you know that pdnsutil had two different logic blocks handling the hash-password command, 600 lines of code apart, with the second one being completely dead code as it would have no chance to run?

Checklist

I have:

  • read the CONTRIBUTING.md document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

@coveralls
Copy link

coveralls commented Jan 15, 2025

Pull Request Test Coverage Report for Build 12788952103

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 81 unchanged lines in 8 files lost coverage.
  • Overall coverage decreased (-0.01%) to 64.888%

Files with Coverage Reduction New Missed Lines %
pdns/recursordist/recursor_cache.cc 1 84.35%
pdns/recursordist/aggressive_nsec.cc 2 66.17%
modules/lmdbbackend/lmdbbackend.cc 3 73.58%
pdns/recursordist/rec-main.cc 3 62.38%
pdns/recursordist/taskqueue.cc 11 34.15%
pdns/recursordist/test-syncres_cc1.cc 13 89.37%
pdns/recursordist/syncres.cc 14 79.97%
pdns/recursordist/rec-taskqueue.cc 34 40.14%
Totals Coverage Status
Change from base Build 12766545506: -0.01%
Covered Lines: 126327
Relevant Lines: 163842

💛 - Coveralls

Copy link
Member

@chbruyand chbruyand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice to have split the main(). On other binaries we have been tending to explicit short variable names instead of adding a bunch of NOLINT(readability-identifier-length) (which decreases readability IMO). Otherwise LGTM !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants