| 1 | # License |
| 2 | |
| 3 | By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or |
| 4 | |
| 5 | (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to |
| 6 | submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as Indicated in the file; or |
| 7 | |
| 8 | (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. |
| 9 | |
| 10 | (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. |
| 11 | |
| 12 | This project is licensed under the GPL version 2 or later. |
| 13 | |
| 14 | Some files are licensed under CC-BY or CC0. Attribution is given in the [Thanks](https://github.com/c172p-team/c172p-detailed/blob/master/Thanks) file. |
| 15 | |
| 16 | # Reporting bugs or features |
| 17 | |
| 18 | Try to be concise when describing the problem. Add screenshots if they can clearly show that something is wrong. |
| 19 | |
| 20 | The `master` branch of this project should be used together with the development version of FlightGear. If you're using a released version, you should mention the version number. |
| 21 | |
| 22 | # Fixing a bug or adding a feature |
| 23 | |
| 24 | Before you starting creating any patches, make sure you first check the bug or feature hasn't already been reported. See the [issues](https://github.com/c172p-team/c172p-detailed/issues) page. Beginners should consider looking for issues with the label [good first bug](https://github.com/c172p-team/c172p-detailed/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+bug%22). |
| 25 | |
| 26 | For the repository containing the texture files for the liveries and instruments (including their .xcf files), visit [c172p-detailed-liveries](https://github.com/gilbertohasnofb/c172p-detailed-liveries). |
| 27 | |
| 28 | 1. Open an issue describing the bug or the feature that you would like to implement. This is so that we can try to reproduce the bug or discuss the feature. |
| 29 | |
| 30 | 2. Fork the repository and create a branch called `issue-X` where X is the issue number. |
| 31 | |
| 32 | 3. Submit a new pull request. Make sure you add to the opening comment the text `Fixes #X` where X is the issue number. This will cause Github to create a reference to the issue and when the PR gets merged, the issue will be automatically closed. |
| 33 | |
| 34 | Make sure your branch only contains clean commits. Try to avoid `Merge branch...` commits. If you work on the branch from multiple computers or with multiple users, you should use `git pull --rebase` before you push your locally created commits. |
| 35 | |
| 36 | Your commits should tell a story how you fixed a bug or implemented a feature. If you have made a commit and want to fix some small mistakes in it, you can use `git commit --amend`. If you need to clean up your commits history by squashing or removing commits, you should use [interactive rebasing](https://www.atlassian.com/git/tutorials/merging-vs-rebasing). You can rebase using `git rebase -i master` or `git rebase -i HEAD~5` to fix your last 5 commits for example. |
| 37 | |
| 38 | Don't try to modify parts of the code that do not fix/implement your bug/feature. This will make it more difficult to do code reviews. |
| 39 | |
| 40 | Make sure all files have a license that is compatible with the GPL version 2. Files licensed under the CC-BY and CC0 are okay. Make sure you give attribution by modifying the [Thanks](https://github.com/c172p-team/c172p-detailed/blob/master/Thanks) file. |
| 41 | |
| 42 | Try to avoid massive commits that fix multiple issues. Use multiple commits instead. For binary files this advice can be ignored. |
| 43 | |
| 44 | Write good commit messages (see below) |
| 45 | |
| 46 | Make sure your XML and Nasal code follows the coding style guidelines (see below) |
| 47 | |
| 48 | # Writing good commit messages |
| 49 | |
| 50 | To make the code reviews easier and help the future maintainers of this project to understand what you did and why, you should write clear commits messages. |
| 51 | |
| 52 | Make sure the commit message is at most 72 characters. If necessary, leave the second line blank and write a more detailed explanation messages starting on the third line. |
| 53 | |
| 54 | Use the imperative mood. Use words like "Fix" and "Add" instead of "Fixed" and "Added". |
| 55 | |
| 56 | Wrap the message manually to 72 characters so that you don't have to manually scroll in order to read them. |
| 57 | |
| 58 | Do not end with a period. |
| 59 | |
| 60 | See [this blog post](https://chris.beams.io/posts/git-commit/) on how to write good commit messages. |
| 61 | |
| 62 | # Coding style guidelines |
| 63 | |
| 64 | Use 4 spaces indentation for the XML and Nasal files. For example, to find XML files that contain tabs, execute: |
| 65 | |
| 66 | ```sh |
| 67 | find . -type f -name "*.xml" -exec grep -HP '\t' {} \; |
| 68 | ``` |
| 69 | |
| 70 | If you think it's necessary to fully reformat an XML, execute: |
| 71 | |
| 72 | ```sh |
| 73 | XMLLINT_INDENT=" " xmllint --format the-file.xml --output the-file.xml |
| 74 | ``` |
| 75 | |
| 76 | This will also remove any blank lines, so you have to reinsert them manually. |
| 77 | |
| 78 | Try to avoid trailing whitespace. You can check this with `git diff --check`. |
| 79 | |
| 80 | Use the [Stroustrup](https://en.wikipedia.org/wiki/Indentation_style#Variant:_Stroustrup) indentation style for the curly brackets. Do not emit curly brackets for single statements. |
| 81 | |
| 82 | Don't use spaces inside parenthesis, but use them around keywords and operators. Write `if (a == b) {` instead of `if( a ==b){` |
| 83 | |
| 84 | Do not commit commented-out code or files that are no longer needed. Remove the code or the files. |
| 85 | |
| 86 | Use `maketimer` instead of `settimer`. Systems should be written in JSBSim if possible. |
| 87 | |
| 88 | # Creating a release |
| 89 | |
| 90 | See the [wiki page "Release process and versioning"](https://github.com/Juanvvc/c172p-detailed/wiki/Release-process-and-versioning) how to do a release. |