Skip to content

Latest commit

 

History

History
136 lines (98 loc) · 6.42 KB

CONTRIBUTING.md

File metadata and controls

136 lines (98 loc) · 6.42 KB

Contributing to PowerDNS

Thank you for you interest to contribute to the PowerDNS project. This document will explain some of the things you need to keep in mind when contributing to ease the workflow of this.

Issue Tracker

When you post an issue or feature request to the issue tracker, make sure this hasn't been reported before. If there is an open issue, add extra information on this issue or show that you have the same issue/want this feature by adding a :+1:.

If there is no similar issue, feature request or you're not sure, open a new issue.

Filing a Feature Request

When filing a feature request, please use the Feature request template provided.

Please be as elaborate as possible when describing the feature you need. Provide at least the following information (if they are relevant):

  • Use case (what is the 'masterplan' that requires this feature)
  • Description of what the feature should do

Filing an Issue or Bug

Note: if you're planning to file a security bug, look at our Security Policy first.

When filing an issue or bug report, make the title of the issue a very short summary (e.g. "Recursor crash when some-setting is set to 'crash'"). In the content of the issue, be as detailed as possible. Supply at least the following information:

  • PowerDNS version
  • Where you got the software from (e.g. distribution, compiled yourself)
  • Operating System and version
  • Steps to reproduce: How can we reproduce the issue
  • Expected behavior: what did you expect what would happen?
  • Observed behavior: what actually happened when following the steps?
  • Relevant logs: Please use code blocks (```) to format console output, logs, and code as it's very hard to read otherwise.

We provide convenient templates that make it easy to not forget any of these steps.

If you have already looked deeper into the problem, provide what you found as well.

Filing a Pull Request

Code contributions are sent as a pull request on GitHub. By submitting a Pull Request you agree to your code becoming GPLv2 licensed.

Pull Request Guidelines

A pull request, at the least, should have:

  • A clear and concise title (not e.g. 'Issue #1234')
  • A description of the patch (what issue does it solve or what feature does it add)
  • Documentation for the feature or when current behaviour changes
  • Regression and/or unit tests

And must:

  • Be filed against the master branch before any release branch
  • Pass all tests in our CI (currently Github Actions and CircleCI)

Information on the tests can be found in the repository at /regression-tests/README.md , /regression-tests.recursor/README.md, plus various other directories with regression-tests.* names.

Commit Guidelines

  • Tell why the change does what it does, not how it does it.
  • The first line should be short (preferably less than 50 characters)
  • The rest of the commit body should be wrapped at 72 characters (see this for more info)
  • If this commit fixes an issue, put "Closes #XXXX" in the message
  • Do not put whitespace fixes/cleanup and functionality changes in the same commit

Coding Guidelines

clang-format

We have clang-format in place, but not for all files yet. This is an incremental process. If you're adding new code, adhering to the formatting config is appreciated. Formatting breakage in already formatted files will be caught by the CI. To format all files that are supposed to be formatted, run make format-code in the root of the tree.

Additional guidelines

  • Don't have end-of-line whitespace
  • Use spaces instead of tabs
  • Although the codebase does not consistently have them, docblocks on functions and classes are appreciated
  • Never hesitate to write comments on anything that might not be immediately clear just from reading the code
  • When adding whole new things, consider putting them in a pdns::X namespace. Look for namespace pdns in the codebase for examples.

Code Checkers

Even though we don't automatically run any of the code checkers listed below as part of our CI, it might make sense to run them manually, not only on newly added code, but to also improve existing code.

clang-tidy

clang-tidy requires a compilation database to work. See the "Compilation Database" section of the DEVELOPMENT document on how to generate a compilation database.

Once the compilation database has been generated, you can pick one of the two available clang-tidy configuration files to run checks on source files. Picking a configuration file is a matter of creating a symbolic link called .clang-tidy to said file in the topmost level of the sub-project you're working on (or the toplevel repository directory if you're working on PowerDNS auth).

We provide two configuration files for clang-tidy:

  1. A minimal .clang-tidy.bugs which only enables a few checks for common bugs. This configuration can be enabled using ln -sf .clang-tidy.bugs .clang-tidy.

  2. A more complete .clang-tidy.full which enables almost all available checks. This configuration can be enabled using ln -sf .clang-tidy.full .clang-tidy and is recommended for all new code.

Development Environment

Information about setting up a development environment using a language server like clangd or ccls can be found in DEVELOPMENT.md.

Debugging

Using GDB

To get a good debugging experience with gdb, it is recommended to build PowerDNS using the following flags:

  • CC and CXX set to gcc and g++, respectively.
  • CFLAGS and CXXFLAGS set to -ggdb -Og -fno-inline.

These variables need to be set during the configure step, as follows:

export CC=clang CXX=clang++
export CFLAGS="-ggdb -Og -fno-inline" CXXFLAGS="-ggdb -Og -fno-inline"
./configure --with-modules=gsqlite3 --disable-lua-records --enable-unit-tests
make -j 8

GDB Dashboard can be used to vastly improve the GDB debugging experience.