Any and all contributions are welcome and appreciated. To make it easy to keep things organized, this project uses the general guidelines for the fork-branch-pull request model for github. Briefly, this means:
-
Make sure your fork's
master
branch is up to date:git remote add LeapBeyond https://github.com/LeapBeyond/scrubadub.git git checkout master git pull LeapBeyond/master
-
Start a feature branch with a descriptive name about what you're trying to accomplish:
git checkout -b italian-name-fix
-
Make commits to this feature branch (
italian-name-fix
, in this case) in a way that other people can understand with good commit message to explain the changes you've made:emacs scrubadub/__init__.py git add scrubadub/__init__.py git commit -m 'added italian name fix'
-
If an issue already exists for the code you're contributing, use issue2pr to attach your code to that issue:
git push origin italian-name-fix chrome http://issue2pr.herokuapp.com # enter the issue URL, HEAD=yourusername:italian-name-fix, Base=master
If the issue doesn't already exist, just send a pull request in the usual way:
git push origin italian-name-fix chrome http://github.com/LeapBeyond/scrubadub/compare
As a general rule of thumb, the goal of this package is to be as readable as possible to make it easy for novices and experts alike to contribute to the source code in meaningful ways. Pull requests that favor cleverness or optimization over readability are less likely to be incorporated.
To make this notion of "readability" more concrete, here are a few stylistic guidelines that are inspired by other projects and we generally recommend:
-
write functions and methods that can
fit on a screen or two of a standard terminal <https://www.kernel.org/doc/Documentation/CodingStyle>
_ --- no more than approximately 40 lines. -
unless it makes code less readable, adhere to
PEP 8 <http://legacy.python.org/dev/peps/pep-0008/>
_ style recommendations --- use an appropriate amount of whitespace. This is enforced in the test suite -
code comments should be about *what* and *why* is being done, not *how* it is being done <https://www.kernel.org/doc/Documentation/CodingStyle>
_ --- that should be self-evident from the code itself.
This project has really taken off, much more so than I would have thought
(thanks everybody!). One very common contribution is adding a new type of filth
that should be removed by scrubadub
. To make it as easy as possible to add
these types of contributions, I thought I'd jot down a few notes about how to
add a new type of filth, for example, addresses.
-
Create an appropriately named python file in
scrubadub/filth/
and write a newFilth
class that inherits fromscrubadub.filth.base.Filth
. In this case, perhaps you'd create anAddressFilth
class inscrubadub/filth/address.py
-
Add your new type of
Filth
to thescrubadub.filth
namespace by importing it inscrubadub/filth/__init__.py
-
Create an appropriately named python file in
scrubadub/detectors/
and write a newDetector
class that inherits fromscrubadub.detectors.base.Detector
. In this case, perhaps you'd create anAddressDetector
class inscrubadub/detectors/address.py
. -
Add your new type of
Detector
to thescrubadub.detectors
namespace by importing it inscrubadub/detectors/__init__.py
. -
Register your new detector by adding it to the
types
dictionary inscrubadub/detectors/__init__.py
-
Create a new python file to handle some tests for your particular type of filth. In this case, perhaps you would write your tests in
tests/test_addresses.py
-
Add documentation for the new type of filth in
docs/index.rst
and be sure to give yourself a pat on the back indocs/changelog.rst
-
Make sure all of the tests are passing by running
./tests/run.py
and fix any lingering problems (usually PEP-8 nonsense).