sorted contributing differently: most important stuff comes first; corrected its contents
This commit is contained in:
parent
2236a5be61
commit
396e69e39c
1 changed files with 72 additions and 86 deletions
158
contributing.rst
158
contributing.rst
|
|
@ -1,73 +1,3 @@
|
||||||
The Git stuff
|
|
||||||
=============
|
|
||||||
|
|
||||||
General commit rules
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
1. All changes introduced by the commit (diff lines) must be related to the
|
|
||||||
subject of the commit.
|
|
||||||
|
|
||||||
If you change some other unrelated to the subject parts of the file, because
|
|
||||||
your editor reformatted automatically the code or whatever different reason,
|
|
||||||
this should be excluded from the commit.
|
|
||||||
|
|
||||||
*Tip:* Never commit everything as is using ``git commit -a``, but review
|
|
||||||
carefully your changes with ``git add -p``.
|
|
||||||
|
|
||||||
2. Changes should not introduce any trailing whitespace.
|
|
||||||
|
|
||||||
Always check your changes for whitespace errors using ``git diff --check``
|
|
||||||
or add following ``pre-commit`` hook:
|
|
||||||
|
|
||||||
.. code-block:: sh
|
|
||||||
|
|
||||||
#!/bin/sh
|
|
||||||
git diff --check --cached || exit $?
|
|
||||||
|
|
||||||
No sane programming or markup language cares about trailing whitespace, so
|
|
||||||
tailing whitespace is just a noise you should not introduce to the
|
|
||||||
repository.
|
|
||||||
|
|
||||||
3. Describe your commit well following the 50/72 rule on commit messages:
|
|
||||||
|
|
||||||
Start with the commit subject as single line maximum of 50 characters,
|
|
||||||
without trailing period, briefly describing the change.
|
|
||||||
|
|
||||||
Optionally put the detailed description as a blocks of text wrapped to 72
|
|
||||||
characters, separated by single blank line from the other parts (including
|
|
||||||
the subject).
|
|
||||||
|
|
||||||
More information
|
|
||||||
----------------
|
|
||||||
|
|
||||||
For more information on how to produce great commits and describe them well read:
|
|
||||||
|
|
||||||
* `How to Write a Git Commit Message <http://chris.beams.io/posts/git-commit/>`_
|
|
||||||
* `A Note About Git Commit Messages <http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html>`_
|
|
||||||
* `Guide by github, scroll down a bit <https://guides.github.com/activities/contributing-to-open-source/>`_
|
|
||||||
|
|
||||||
Deprecation
|
|
||||||
===========
|
|
||||||
|
|
||||||
Backward compatibility is important, so if you are renaming a proc or
|
|
||||||
a type, you can use
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: nim
|
|
||||||
|
|
||||||
{.deprecated [oldName: new_name].}
|
|
||||||
|
|
||||||
Or you can simply use
|
|
||||||
|
|
||||||
.. code-block:: nim
|
|
||||||
|
|
||||||
proc oldProc() {.deprecated.}
|
|
||||||
|
|
||||||
to mark a symbol as deprecated. Works for procs/types/vars/consts,
|
|
||||||
etc.
|
|
||||||
|
|
||||||
`Deprecated pragma in the manual. <http://nim-lang.org/docs/manual.html#pragmas-deprecated-pragma>`_
|
|
||||||
|
|
||||||
Writing tests
|
Writing tests
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
@ -94,7 +24,8 @@ Sample test:
|
||||||
seq2D[0][0] = true
|
seq2D[0][0] = true
|
||||||
seq2D[1][0] = true
|
seq2D[1][0] = true
|
||||||
seq2D[0][1] = true
|
seq2D[0][1] = true
|
||||||
doAssert seq2D == @[@[true, true], @[true, false], @[false, false], @[false, false]]
|
doAssert seq2D == @[@[true, true], @[true, false],
|
||||||
|
@[false, false], @[false, false]]
|
||||||
|
|
||||||
Compiler
|
Compiler
|
||||||
--------
|
--------
|
||||||
|
|
@ -131,22 +62,20 @@ Running tests
|
||||||
|
|
||||||
You can run the tests with
|
You can run the tests with
|
||||||
|
|
||||||
.. code-block:: bash
|
::
|
||||||
|
|
||||||
./koch tests
|
./koch tests
|
||||||
|
|
||||||
which will run a good subset of tests. Some tests may fail. If you
|
which will run a good subset of tests. Some tests may fail. If you
|
||||||
only want to run failing tests, go for
|
only want to see the output of failing tests, go for
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
|
::
|
||||||
./koch tests --failing all
|
./koch tests --failing all
|
||||||
|
|
||||||
You can also run only a single category of tests. For a list of
|
You can also run only a single category of tests. A category is a subdirectory
|
||||||
categories, see ``tests/testament/categories.nim``, at the bottom.
|
in the ``tests`` directory. There are a couple of special categories; for a
|
||||||
|
list of these, see ``tests/testament/categories.nim``, at the bottom.
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
|
::
|
||||||
./koch tests c lib
|
./koch tests c lib
|
||||||
|
|
||||||
Comparing tests
|
Comparing tests
|
||||||
|
|
@ -159,22 +88,79 @@ The tester can compare two test runs. First, you need to create the
|
||||||
reference test. You'll also need to the commit id, because that's what
|
reference test. You'll also need to the commit id, because that's what
|
||||||
the tester needs to know in order to compare the two.
|
the tester needs to know in order to compare the two.
|
||||||
|
|
||||||
.. code-block:: bash
|
::
|
||||||
|
|
||||||
git checkout devel
|
git checkout devel
|
||||||
DEVEL_COMMIT=$(git rev-parse HEAD)
|
DEVEL_COMMIT=$(git rev-parse HEAD)
|
||||||
./koch tests
|
./koch tests
|
||||||
|
|
||||||
Then switch over to your changes and run the tester again.
|
Then switch over to your changes and run the tester again.
|
||||||
|
|
||||||
.. code-block:: bash
|
::
|
||||||
|
|
||||||
git checkout your-changes
|
git checkout your-changes
|
||||||
./koch tests
|
./koch tests
|
||||||
|
|
||||||
Then you can ask the tester to create a ``testresults.html`` which will
|
Then you can ask the tester to create a ``testresults.html`` which will
|
||||||
tell you if any new tests passed/failed.
|
tell you if any new tests passed/failed.
|
||||||
|
|
||||||
.. code-block:: bash
|
::
|
||||||
|
|
||||||
./koch --print html $DEVEL_COMMIT
|
./koch --print html $DEVEL_COMMIT
|
||||||
|
|
||||||
|
|
||||||
|
Deprecation
|
||||||
|
===========
|
||||||
|
|
||||||
|
Backward compatibility is important, so if you are renaming a proc or
|
||||||
|
a type, you can use
|
||||||
|
|
||||||
|
|
||||||
|
.. code-block:: nim
|
||||||
|
|
||||||
|
{.deprecated: [oldName: new_name].}
|
||||||
|
|
||||||
|
Or you can simply use
|
||||||
|
|
||||||
|
.. code-block:: nim
|
||||||
|
|
||||||
|
proc oldProc() {.deprecated.}
|
||||||
|
|
||||||
|
to mark a symbol as deprecated. Works for procs/types/vars/consts,
|
||||||
|
etc. Note that currently the ``deprecated`` statement does not work well with
|
||||||
|
overloading so for routines the latter variant is better.
|
||||||
|
|
||||||
|
|
||||||
|
`Deprecated <http://nim-lang.org/docs/manual.html#pragmas-deprecated-pragma>`_
|
||||||
|
pragma in the manual.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The Git stuff
|
||||||
|
=============
|
||||||
|
|
||||||
|
General commit rules
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
1. All changes introduced by the commit (diff lines) must be related to the
|
||||||
|
subject of the commit.
|
||||||
|
|
||||||
|
If you change some other unrelated to the subject parts of the file, because
|
||||||
|
your editor reformatted automatically the code or whatever different reason,
|
||||||
|
this should be excluded from the commit.
|
||||||
|
|
||||||
|
*Tip:* Never commit everything as is using ``git commit -a``, but review
|
||||||
|
carefully your changes with ``git add -p``.
|
||||||
|
|
||||||
|
2. Changes should not introduce any trailing whitespace.
|
||||||
|
|
||||||
|
Always check your changes for whitespace errors using ``git diff --check``
|
||||||
|
or add following ``pre-commit`` hook:
|
||||||
|
|
||||||
|
.. code-block:: sh
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
git diff --check --cached || exit $?
|
||||||
|
|
||||||
|
No sane programming or markup language cares about trailing whitespace, so
|
||||||
|
tailing whitespace is just a noise you should not introduce to the
|
||||||
|
repository.
|
||||||
|
|
||||||
|
3. Describe your commit and use your common sense.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue