blob: 2e612af0586d5a46803b079fd27e8c4a404fcdaf [file] [log] [blame]
Zack Williams36451912022-03-04 20:31:37 -07001Development Conventions
2=======================
3
4ONF has many (over 300) software repositories as of 2022, and to effectively
5develop across all of these projects, the following development conventions are
6used.
7
8Strategy
9--------
10
11The general strategy for ONF software development is as follows:
12
13Make it easy to start contributing to any repo
14""""""""""""""""""""""""""""""""""""""""""""""
15
16A convention we've embraced in nearly all repos is to have a ``Makefile`` in
17their base directory, which has a few common targets:
18
19* ``make help``: Get a list of ``make`` targets
20* ``make build`` run
21* ``make test`` run all tests, as they'd be run in CI by a
22
23
24Most ``Makefiles`` use the GNU Make syntax variant.
25
26Automated tests should be identical for the developer and automation
27""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
28
29The CI test runner (Jenkins or similar) that performs automated testing should
30run the same tests in the same way that a developer would on their local
31system, by running ``make test``. There should be no (or very rare) cases where
32a test will pass locally but fail in CI.
33
34Additionally, this greatly simplifies the configuration of the test runner - it
35only needs to run ``make test``. In some cases, it may be necessary for the
36Makefile to include commands that generate Jenkins-consumable output, such as
37test results (usually in JUnit, xUnit, or TAP formats) or coverage information
38(usually in Cobertura XML format).
39
40
41Style, formatting, linting, license compliance should be automated
42""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
43
44Code review should be about the structure and design of the code, and should
45
46To that end, automated tools should be used that verify and conform the code to
47a specific convention and standard:
48
49* Formatting tools such as ``go fmt``, ``black`` and similar should be used to
50 conform code to style guidelines
51
52* Linting tools such as ``pylint``, ``yamllint``
53
54In the documentation space, spelling and other checks should also be performed.
55
56Versioning and Releasing Software
57---------------------------------
58
59Versioning software and performing releases are fundamentally for two audiences:
60
611. Providing compatibility claims about
622. Developers who use the
63
64Two common and recommended versioning schemes are;
65
66* SemVer
67* CalVer
68
69Division of responsibilities
70""""""""""""""""""""""""""""
71
72Automated tools should perform low-level versioning tasks like creating tags on
73repos.