Developer Guide

Contributions are more than welcome, and greatly appreciated.

We expect any contributions to be done through Pull-Requests. We also appreciated comments and issues through the Issues tracker.

General Code Conventions

  • No trailing whitespace; no trailing empty lines
  • No TABs
  • Indent set at four spaces

C++ Specific

  • “private:” and “public:” tags aligned with “class” keyword
  • Class name start with a capital letter
  • Filename all lowercase and using dash as word separator
  • Header file use “#pragma once”
  • Private members start with an underscore (“_”) prefix
  • Keep your lines to about 80 characters or less in length
  • No copy-and-paste from an open source projects. Clean code is an important requirement. If inserting code taken from other source, specify licenses together with the pull request, and we will evaluate if there is not conflicts.
  • When there is something not covered in these instructions, we follow this guide.

Workflow Conventions

We follow this workflow model.

  • Develop/debug on a branch, started at “develop” (e.g., git checkout develop; git checkout –b <NEW-FEATURE>).

  • Prefer smaller, independent commits (make them ideally suited for “cherry-picking”)

    • First line of commit message descriptive of the commit; end with a period (‘.’)
    • One empty line, if more detailed explanations are needed
    • More detailed explanations in as many additional lines as needed
    • Use present tense and active voice (“Fix bug #8848” and not “Bug #8848 fixed” or “Fixed bug #8848”)
    • Keep your lines in the commit message to about 80 characters or less in length
  • When ready, create a pull request against the “develop” branch.

Tests

After you are ready for commit, run the tests. Tests are run from the tests folder, we use gtest. Make sure all the tests passes, if not, please fix the code, or the failing tests, or contact the person who wrote the test for help. Make sure that when running the tests, nothing else is printed on the screen other than gtest information. After running, all you should see on screen is something like:

user@machine:~/vdms/tests$ sh run_tests.sh
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.
[==========] Running 16 tests from 3 test cases.
[----------] Global test environment set-up.
[----------] 13 tests from PMGDQueryHandler
[ RUN      ] PMGDQueryHandler.addTest
[       OK ] PMGDQueryHandler.addTest (2 ms)
[ RUN      ] PMGDQueryHandler.queryTestList
[       OK ] PMGDQueryHandler.queryTestList (1 ms)
[ RUN      ] PMGDQueryHandler.queryTestAverage
[       OK ] PMGDQueryHandler.queryTestAverage (0 ms)
[ RUN      ] PMGDQueryHandler.queryTestUnique
[       OK ] PMGDQueryHandler.queryTestUnique (1 ms)
[ RUN      ] PMGDQueryHandler.queryNeighborTestList
[       OK ] PMGDQueryHandler.queryNeighborTestList (1 ms)
[ RUN      ] PMGDQueryHandler.queryConditionalNeighborTestList
[       OK ] PMGDQueryHandler.queryConditionalNeighborTestList (0 ms)
[ RUN      ] PMGDQueryHandler.queryNeighborTestSum
[       OK ] PMGDQueryHandler.queryNeighborTestSum (1 ms)
[ RUN      ] PMGDQueryHandler.addConstrainedTest
[       OK ] PMGDQueryHandler.addConstrainedTest (38 ms)
[ RUN      ] PMGDQueryHandler.queryNeighborLinksTestList
[       OK ] PMGDQueryHandler.queryNeighborLinksTestList (1 ms)
[ RUN      ] PMGDQueryHandler.queryNeighborLinksReuseTestList
[       OK ] PMGDQueryHandler.queryNeighborLinksReuseTestList (0 ms)
[ RUN      ] PMGDQueryHandler.querySortedNeighborLinksReuseTestList
[       OK ] PMGDQueryHandler.querySortedNeighborLinksReuseTestList (1 ms)
[ RUN      ] PMGDQueryHandler.queryTestListLimit
[       OK ] PMGDQueryHandler.queryTestListLimit (0 ms)
[ RUN      ] PMGDQueryHandler.queryTestSortedLimitedAverage
[       OK ] PMGDQueryHandler.queryTestSortedLimitedAverage (1 ms)
[----------] 13 tests from PMGDQueryHandler (47 ms total)

[----------] 2 tests from AddImage
[ RUN      ] AddImage.simpleAdd
[       OK ] AddImage.simpleAdd (17 ms)
[ RUN      ] AddImage.simpleAddx10
[       OK ] AddImage.simpleAddx10 (23 ms)
[----------] 2 tests from AddImage (40 ms total)

[----------] 1 test from QueryHandler
[ RUN      ] QueryHandler.AddAndFind
[       OK ] QueryHandler.AddAndFind (52 ms)
[----------] 1 test from QueryHandler (52 ms total)

[----------] Global test environment tear-down
[==========] 16 tests from 3 test cases ran. (139 ms total)
[  PASSED  ] 16 tests.
Running python tests...
test_addImage (__main__.TestAddImage) ... ok
test_addImageWithLink (__main__.TestAddImage) ... ok
test_findEntityImage (__main__.TestAddImage) ... ok
test_findImage (__main__.TestAddImage) ... ok
test_findImage_multiple_res (__main__.TestAddImage) ... ok
test_addEntityWithLink (__main__.TestMultiClient) ... ok
test_addFindEntity (__main__.TestMultiClient) ... ok
test_runMultipleAdds (__main__.TestMultiClient) ... ok

----------------------------------------------------------------------
Ran 8 tests in 1.751s

OK