25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

CONTRIBUTING.md 6.8 KiB

4 yıl önce
4 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Contributing to Kosmorro
  2. If you are reading this, then you are probably looking for a way to contribute to Kosmorro (you're in the good place!). Thank you!
  3. There are multiple ways to contribute that can match with your possibilities.
  4. ## Opening issues
  5. ### Reporting bugs
  6. If you found a bug, please check it is not already reported in the _Issues_ tab.
  7. If it is not, [create a bug report](https://github.com/Deuchnord/kosmorro/issues/new/choose) and fill in the template that offers to you. Feel free to give as much information as possible, as it will make the bug easier to fix.
  8. ### Suggest a new feature
  9. Have an idea of feature you think would be nice on Kosmorro? Time to suggest it!
  10. First, please check someone didn't suggest your next revolution in the _Issues_ tab. If it's not, [create a feature request](https://github.com/Deuchnord/kosmorro/issues/new/choose) and fill in the templace that offers to you.
  11. ## Translating
  12. If you speak another language than English, another nice way to enhance Kosmorro is to translate its messages. The recommended way to begin translating Kosmorro is to [join the POEditor team](https://poeditor.com/join/project/GXuhLpdaoh).
  13. ## Writing code
  14. First of all, if you are fixing an opened issue, check that nobody is already working on it — if someone seems to be but their Pull Request seems stuck, please ask them first if you can continue the development. If you retake the code they produced, **don't change the author of the commits**.
  15. Before writing the code, first create a fork of the repository and clone it. You may also want to add the original repository (`Deuchnord/kosmorro`), so you can update your fork with the last upstream commits.
  16. Then create a new branch and start coding. Finally, commit and push, then open a PR on this project. If your project is not complete, feel free to open it as Draft (if you forgot to activate the Draft status, just edit the first comment to say it), then mark it as ready for review when you're done.
  17. ### Choosing the right target branch
  18. Whatever you are doing, always base your working branch on `master`.
  19. When you create your PR, please consider selecting the right target branch:
  20. - If you are fixing a bug or optimizing something, then target the `master` branch.
  21. - If you are doing anything else, then target the `feature` branch.
  22. This allows to make easier to publish patch releases, which have a higher priority than the minor releases.
  23. ### Dealing with the translations
  24. The messages file contains all the messages Kosmorro can display, in order to make them translatable. When you change code, you may change also the messages displayed by the software.
  25. When you add a new string that will be displayed to the end user, please pass it to the `_()` function made available in the `kosmorrolib.i18n` package, for instance:
  26. ```python
  27. # Dont:
  28. print('Note: All the hours are given in UTC.')
  29. # Do:
  30. from kosmorrolib.i18n import _
  31. print(_('Note: All the hours are given in UTC.'))
  32. ```
  33. This will allow Python's internationalization tool to translate the string in any available language.
  34. Once you have done your work, please remember to tell [Babel](http://babel.pocoo.org) to extract the new strings:
  35. ```console
  36. $ pipenv run python setup.py extract_messages --output-file=kosmorrolib/locales/messages.pot
  37. ```
  38. > If the `setup.py` script tells you that the `extract_messages` command does not exist, then run `kosmorro sync` to ensure all the dev dependencies are installed and try again.
  39. Note that if you forget to update the messages file, the CI will fail.
  40. ### Matching the coding standards
  41. Kosmorro's source code follows the major coding standards of Python (PEPs). Before marking your Pull Request as ready for review, don't forget to check that the code respects the coding standards with PyLint (it is run on the CI, but feel free to run it on your local machine too). Your PR must have a global note of 10/10 to be elligible to merge.
  42. ### Testing the code
  43. There are two kinds of tests on this project: **unit tests** and **end-to-end tests** (sometimes abbreviated to _E2E tests_).
  44. #### Unit tests
  45. [Unit tests](https://en.wikipedia.org/wiki/Unit_testing) check that every little piece of code (any _unit_) does exactly what it is supposed to do. They have several advantages, like proving that new things in the codebase works exactly as they should, and making sure that future changes done later won't break them.
  46. Kosmorro's unit tests use Python's official `unittest` module. They live in the `/test` folder of the repository. Whenever you write a new feature or a bug fix, please write the unit tests that will make sure it works.
  47. You can also run them by invoking the following command:
  48. ```shell
  49. make test
  50. ```
  51. Note: there are currently some memory leaks in the unit tests, making the result quite difficult to read. I am working to fix this.
  52. If you have troubles reading them, feel free to ask.
  53. #### End-to-end tests
  54. If unit tests are really good at checking that every individual parts of code work well, they fail at checking that so does the _whole_ program as a finished product. That is the job of end-to-end tests.
  55. The goal here is to make sure that if you install Kosmorro from scratch, it will work without any problem. If a mandatory dependency has not been installed, or if something goes wrong in the main program (which is not possible to unit test), the E2E tests will fail.
  56. Kosmorro's 2E2 tests are a Bash script living in the `/.scripts/tests-e2e.sh` file. You should only add tests here if you add new ways to interact with Kosmorro itself (e.g. adding a new argument in the command line).
  57. Fore security purpose, it is not recommended running E2E tests locally, because some tests need the root privilege to pass (e.g. installing optional dependencies). They are run on the CI.
  58. ### Commiting
  59. The commit messages of this project follow the [Conventional Commits Specification](https://www.conventionalcommits.org/en/v1.0.0/): basically, when you commit your changes, please prefix them with the following:
  60. - **`fix: `** if your changes fix a bug;
  61. - **`feat: `** if your changes add a new feature.
  62. The message of your commit must start with a lowercase.
  63. Finally, if your change introduce a BC-break, add a footer beginning with `BREAKING CHANGE:` and explaining precisely the BC-break.
  64. Once your PR is ready to review, please squash your commits so it contains only one commit.
  65. > To ensure your commits follow this convention, you can use [glint](https://github.com/brigand/glint).
  66. The commit messages are then used to generate the changelog using [`conventional-changelog`](https://github.com/conventional-changelog/conventional-changelog):
  67. ```bash
  68. conventional-changelog -p angular -i CHANGELOG.md -s
  69. ```
  70. ## Licensing and Copyright Attribution
  71. When you open a Pull Request to the project, you agree to license your code under the [GNU Affero General Public License version 3](https://www.gnu.org/licenses/agpl-3.0.html).