-
Notifications
You must be signed in to change notification settings - Fork 58
Coding guidelines
Make it easier to review
- Keep method cyclomatic complexity below 5.
- Keep methods short, below 20 lines
We prefer to use PHPStorm. It's free for students and affordable for others. It lets you run the command you need to participate in this project and offers advanced features such as re-factoring.
Here is a sample code style config you can use: https://github.com/owncloud/gallery/wiki/PHPstorm-code-style-config
- Use meaningful method and variable names
- Keep referring to media types as mimetype, so that people woring on core understand what it means
You can use this tool to test the output of your PHP scripts: https://3v4l.org/
PHP uses a short-circuit evaluation technique when looking at conditions
if (conditionA && conditionB)
If conditionA is false, conditionB will never be tested.
When searching in a storage's cache, you can't limit the scope to a specific path, the cache will look in the entire storage.
Be very careful when working on the slideshow as the code and the CSS is being injected in the Files app and there could be side effects. Use the proper namespace and encapsulation.
t('gallery',"This is my very long" +
" string, that I want to split");
t('gallery',"This is my very long string, that I want to split");
- General
- Installation
- Configuration
- OCC commands
- Developers