Skip to content

Latest commit

 

History

History
162 lines (101 loc) · 10.8 KB

CONTRIBUTING.md

File metadata and controls

162 lines (101 loc) · 10.8 KB

Contributing to ThingsDB

👍🎉 First off, thanks for taking the time to contribute! 🎉👍

The following is a set of guidelines for contributing to ThingsDB and its packages, which are hosted in the ThingsDB Organization on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

Table Of Contents

Code of Conduct

I don't want to read this whole thing, I just have a question!!!

What should I know before I get started?

How Can I Contribute?

Styleguides

Code of Conduct

This project and everyone participating in it is governed by the ThingsDB Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to info@thingsdb.net.

I don't want to read this whole thing I just have a question!!!

Note: Please don't file an issue to ask a question.

We have an official message board where the community chimes in with helpful advice if you have questions.

What should I know before I get started?

ThingsDB and related projects

ThingsDB is an open source project — with several repositories.

Here's a list with a few of them:

  • thingsdb/ThingsDB -ThingsDB Core! This is the code that runs ThingsDB and is written using the C language.
  • ThingsDocs - The official ThingsDB documentation.
  • ThingsGUI - A GUI for managing ThingsDB. This project contains frontend code written in JavaScript/React and a webserver component written in Go.

ThingsDB and Modules

ThingsDB can be extended with modules.

How Can I Contribute?

Reporting Bugs

This section guides you through submitting a bug report for ThingsDB. Following these guidelines helps maintainers and the community understand your report 📝, reproduce the behavior 💻 💻, and find related reports 🔎.

Before creating bug reports, please check this list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible.

Note: If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.

How Do I Submit A (Good) Bug Report?

Bugs are tracked as GitHub issues. After you've determined which repository your bug is related to, create an issue on that repository. Explain the problem and include additional details to help maintainers reproduce the problem:

  • Use a clear and descriptive title for the issue to identify the problem.
  • Describe the exact steps which reproduce the problem in as many details as possible. For example, start by explaining how you configured yout ThingsDB node(s).
  • Explain which behavior you expected to see instead and why.
  • If the problem is related to a crash or memory issue, install valgrind and run ThingsDB using valgrind --tool=memcheck thingsdb.

Provide more context by answering these questions:

  • Can you reproduce the problem with a single node? Usually ThingsDB is running on multiple nodes, did you try if the issue exists when running only a single node?
  • Did the problem start happening recently (e.g. after updating to a new version of ThingsDB) or was this always a problem?
  • If the problem started happening recently, can you reproduce the problem in an older version of ThingsDB? What's the most recent version in which the problem doesn't happen? You can download older versions of ThingsDB from the releases page.
  • Can you reliably reproduce the issue? If not, provide details about how often the problem happens and under which conditions it normally happens.

Include details about your configuration and environment:

  • Which version of ThingsDB are you using? You can get the exact version by running thingsdb -v in your terminal, or by starting ThingsDB and run the query node_info().load().version; in the @node scope.
  • What's the name and version of the OS you're using?
  • Which modules do you have installed? You can get that list of module files by running modules_info().map(|m| m.load().file); in the @node scope.
  • What configuration are you using? Provide the onfig file and environment variable and optionally provide the output of node_info(); from the @node scope.

Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for ThingsDB, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion 📝 and find related suggestions 🔎.

Before creating enhancement suggestions, please check this list as you might find out that you don't need to create one. When you are creating an enhancement suggestion, please include as many details as possible. Fill in the template, including the steps that you imagine you would take if the feature you're requesting existed.

Before Submitting An Enhancement Suggestion

How Do I Submit A (Good) Enhancement Suggestion?

Enhancement suggestions are tracked as GitHub issues. After you've determined which repository your enhancement suggestion is related to, create an issue on that repository and provide the following information:

  • Use a clear and descriptive title for the issue to identify the suggestion.
  • Provide a step-by-step description of the suggested enhancement in as many details as possible.
  • Explain why this enhancement would be useful to most ThingsDB users and isn't something that can or should be implemented as a community module.
  • Specify which version of ThingsDB you're using. You can get the exact version by running thingsdb -v in your terminal, or by starting ThingsDB and run the query node_info().load().version; in the @node scope.
  • Specify the name and version of the OS you're using.
  • Do you want to suggest a new function for ThingsDB?
    • Functions should be short and do exactly one thing.
    • Function names are lower case and if composed of two words an underscore should be user to combine the words. For example find_index().
    • If a function modifies an object, the function should extend the type of the object. For example, push() extends type list.
    • If a function modifies an object, the return value should not be the instance but rather some other useful value. For example, push() returns the new length of the list.
    • Functions may accept arguments but functions should never modify one of the arguments. (If the argument is an identifier to something else, for example a Type, the function is allowed to make changes to that Type)

Your First Code Contribution

Unsure where to begin contributing to ThingsDB? You can start by looking through these beginner and help-wanted issues:

  • Beginner issues - issues which should only require a few lines of code, and a test or two.
  • Help wanted issues - issues which should be a bit more involved than beginner issues.

Both issue lists are sorted by total number of comments. While not perfect, number of comments is a reasonable proxy for impact a given change will have.

Local development

ThingsDB Core and modules can be developed locally.

Once you've set up your fork of the thingsdb/ThingsDB repository, you can clone it to your local machine:

$ git clone git@github.com:your-username/ThingsDB.git

From there, you can navigate into the directory where you've cloned the ThingsDB source code and install all the required dependencies.

See the build-from-source documentation on how to compile ThingsDB.

Note: The documentation above let's you compile the Release build. For local development you want to use the Debug build instead. The Debug version builds a bit faster, enables all assertions and includes debug symbols.

Styleguides

C Styleguide

  • All variables must be declared at the top of the relevant function (with one exception). The only exception to this rule is index variables in loops, which may be declared locally.
  • Comments must start with /* and end with */.
  • Braces { and } go on a new line.
  • Indentation is done by using 4 spaces.
  • Try to limit the number of characters of a single line to 80.

Python Styleguide

  • PEP 8 is used as the Style Guide for Python Code.

Documentation