Skip to content
This repository was archived by the owner on Apr 22, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
5. [Forms](#Forms)
6. [Templates](#Templates)
7. [URL patterns](#URL patterns)
8. [Naming conventions](#Naming conventions)

4. [Documentation](#Documentation)
5. [Git](#Git)
Expand Down Expand Up @@ -118,6 +119,51 @@ urlpatterns = patterns(
)
```

##### Naming conventions
Avoid names which does not give additional meaning or are unclear. Some
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing the reference to PEP8 Prescriptive naming conventions.

examples of such names are: Better, Quick, Smart, Clever, Simple, Fast,
Strange, Stupid.

In general one should not use abbreviations and acronyms unless its known by
most programmers. Typical examples for known acronyms are: HTTP, HTML, URL.

The following naming conventions should be used to ensure consistency
throughout all source code. If the names don't make much sense in a given
context other names should be found. Here are some recommendations:

- For file or directory paths use `path`,
- For filename without a path use `file`,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shadows buildin file

- For directory name without a path use `dir`.
- Use `load`, `save` for complete operations on the file system, for instance
loading an entire `JSON` file.
- Use `read`, `write` for partial operations of data stream, for instance
storing 10 bytes to a file.
- Use `fetch`, `store` for remote operations, for instance fetching data from a
web server or database.
- When adding elements the following naming should be used:
- Use `add` when adding elements without a specific order.
- Use `insert` when adding elements in a specific order, for instance at a
given index or position.
- Use `append` when adding elements to the end.
- Use `prepend` when adding elements to the beginning.
- Use `create` for object creation and `generate` for operations that
generate text, code, SQL etc.
- Use `reset` for resetting elements in the object.
- When removing elements the following naming should be used:
- Use `remove` when elements are no longer referenced but not actually
deleted. For instance removing a file path from a list while still leaving
the file on the file system.
- Use `delete` when elements are no longer meant to exists. For instance
unlinking a file from the file system or deleting a database record.
- Short names are advised when their context is very clear. An example is a
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if I would agree to this point.

copy() function in a File class which has a source and a destination, it is
quite clear that in this context we are working with files and can use
abbreviated forms, `src` and `dest`. copy( src, dest ) The order of source
and destination is always source first.
- Some words are different in British English and American English. It is most
common to use the American spelling and so all words should follow this.
Some typical names are: initialize, finalize, color, grey.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

favor, favour. Maybe important as often used in deprecation.


## Documentation
- [pep257]
- [pep287]
Expand Down