FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
CONTRIBUTING.md
1 # Contributing
2 
3 We welcome contributions in several forms, e.g.
4 
5 - Improve end user documenting on the [Wiki](https://github.com/fossology/fossology/wiki)
6 
7 - Testing
8 
9  - e.g. by using an instant version of FOSSology with [vagrant](https://github.com/fossology/fossology/wiki/vagrant)
10 
11  - Write unit tests and learn how the code works
12 
13 - Verify available [patches (pull requests)](https://github.com/fossology/fossology/pulls)
14 
15 - Working on [issues](https://github.com/fossology/fossology/issues)
16 
17  - Fix a bug
18  - Add a new feature
19 
20 - etc.
21 
22 ## Reporting Bugs
23 
24 FOSSology uses GitHub's issue tracker. All bugs and enhancements should be
25 entered so that we don't lose track of them, can prioritize, assign, and so code
26 fixes can refer to the bug number in its check-in comments.
27 
28 The issue usually contains much more detail (including test cases) than can be
29 reasonably put in check-in comments, so being able to correlate the two is
30 important.
31 
32 Consider the usual best practice for writing issues, among them:
33 
34 - More verbosity rather than one liners
35 - Screenshots are a great help
36 - Providing example files (in case for example scanning crashes)
37 - Please determine the version, better the commit id
38 - Details on operating system you are using
39 
40 ## Code Guidelines
41 
42 follow the [Coding Style](https://github.com/fossology/fossology/wiki/Coding-Style)
43 
44 ## Git Guidelines
45 
46 Not familiar with git, see [Git basic commands](https://github.com/fossology/fossology/wiki/Git-basic-commands)
47 
48 ### Workflow
49 
50 We are using the [Feature Branch Workflow (also known as GitHub Flow)](https://guides.github.com/introduction/flow/),
51 and prefer delivery as pull requests.
52 
53 Our first line of defense is the [Travis CI](https://travis-ci.org/fossology/fossology/) build defined within [.travis.yml](.travis.yml) and triggered for every pull request.
54 
55 Create a feature branch:
56 
57 ```sh
58 git checkout -B feat/tune-vagrant-vm
59 ```
60 
61 ### Git Commit
62 
63 The cardinal rule for creating good commits is to ensure there is only one
64 "logical change" per commit. Why is this an important rule?
65 
66 - The smaller the amount of code being changed, the quicker & easier it is to
67  review & identify potential flaws.
68 
69 - If a change is found to be flawed later, it may be necessary to revert the
70  broken commit. This is much easier to do if there are not other unrelated
71  code changes entangled with the original commit.
72 
73 - When troubleshooting problems using Git's bisect capability, small well
74  defined changes will aid in isolating exactly where the code problem was
75  introduced.
76 
77 - When browsing history using Git annotate/blame, small well defined changes
78  also aid in isolating exactly where & why a piece of code came from.
79 
80 Things to avoid when creating commits
81 
82 - Mixing whitespace changes with functional code changes.
83 - Mixing two unrelated functional changes.
84 - Sending large new features in a single giant commit.
85 
86 ### Git Commit Conventions
87 
88 We use git commit as per [Conventional Changelog](https://github.com/ajoslin/conventional-changelog):
89 
90 ```none
91 <type>(<scope>): <subject>
92 ```
93 
94 Example:
95 
96 ```none
97 feat(vagrant): increase upload size
98 ```
99 
100 Allowed types:
101 
102 - **feat**: A new feature
103 - **fix**: A bug fix
104 - **docs**: Documentation only changes
105 - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, newline, line endings, etc)
106 - **refactor**: A code change that neither fixes a bug or adds a feature
107 - **perf**: A code change that improves performance
108 - **test**: Adding missing tests
109 - **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
110 
111 You can add additional details after a new line to describe the change in detail or automatically close a issue on Github.
112 
113 ```none
114 feat(CONTRIBUTING.md): create initial CONTRIBUTING.md
115 
116 makes the following wiki Page obsolete:
117 - https://github.com/fossology/fossology/wiki/Reporting-bugs
118 
119 This closes #22
120 ```
121 
122 > **NOTE:** [CHANGELOG.md](CHANGELOG.md) is generated based on the commits.
123 
124 ### Developer Certificate of Origin (DCO)
125 
126 All commits not submitted via GitHub pull request shall contain a
127 Signed-off-by line, also known as the **Developer Certificate of Origin (DCO)**
128 as we know it from the Linux Kernel [Documenation/SubmittingPatches](https://www.kernel.org/doc/Documentation/SubmittingPatches)
129 
130 ```none
131  Signed-off-by: Peace Fun Ingenium <peacefun.ingenium@example.com>
132 ```
133 
134 Additional tags in addition to Signed-off-by shall be used as long as it makes
135 sense for any commit, e.g.
136 
137 ```none
138  Reviewed-by:
139  Tested-by:
140  Reviewed-by:
141  Suggested-by:
142  Acked-by:
143  Sponsored-by:
144 ```
145 
146 ## Pull requests
147 
148 Pull requests with patches, improvements, new features are a great help.
149 Please keep them clean from unwanted commits.
150 
151 Follow the steps to get your work included in the project.
152 
153 1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
154  and add the fossology remote:
155 
156  ```bash
157  # Clone your fork of the repo into the current directory
158  git clone https://github.com/<your-username>/fossology.git
159  # Navigate to the cloned directory
160  cd fossology
161  # Assign the original repo to a remote called "upstream"
162  git remote add upstream https://github.com/fossology/fossology.git
163  ```
164 
165 2. Get the latest changes from upstream:
166 
167  ```bash
168  git checkout master
169  git pull upstream master
170  ```
171 
172 3. Create a new branch from the main master branch to contain your changes.
173  Best way is to call is to follow the type described in **Git Commit Conventions**
174  stated above: `<githubId>/#<issueNr>/<description/scope/topic>`
175 
176  ```bash
177  git checkout -b <topic-branch-name>
178  ```
179 
180  Example:
181 
182  ```bash
183  git checkout -b john/138/buckets-undefined-index
184  ```
185 
186  Or
187 
188  ```bash
189  git checkout -b john/fix/138
190  ```
191 
192 4) It's coding time!
193  Please respect the coding convention: [Coding guidelines](https://github.com/fossology/fossology/wiki/Coding-Style)
194 
195  Commit your changes in logical chunks. Please adhere to **Git Commit Conventions**
196  and [Coding guidelines](https://github.com/fossology/fossology/wiki/Coding-Style)
197  or your code is unlikely be merged into the main project.
198  Use Git's [interactive rebase](https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase)
199  feature to tidy up your commits before making them public.
200 
201 5) Locally rebase the upstream master branch into your topic branch:
202 
203  ```bash
204  git pull --rebase upstream master
205  ```
206 
207 6) Push your topic branch up to your fork:
208 
209  ```bash
210  git push origin <topic-branch-name>
211  ```
212 
213 7) [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
214  with a clear title and description against the `master` branch.
215 
216 ## IMPORTANT
217 
218 The FOSSology project does not require you to assign the copyright of your
219 contributions, you retain the copyright. The FOSSology project **does** require
220 that you make your contributions available under the
221 [GNU General Public License as published by the Free Software Foundation, version 2](LICENSE),
222 in order to be accepted as contribution in the main repo.
223 
224 If appropriate, include the [GPLv2 license header](https://github.com/fossology/fossology/wiki/Coding-Style#default-license-and-file-headers)
225 at the top of each file along with the copyright info. If you are adding a new
226 file that you wrote, include your name in the copyright notice in the license
227 summary.