summaryrefslogtreecommitdiffstats
path: root/CONTRIBUTING.md
blob: 282fd068bfe4eefa368b502578e56a9a1c33e2d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Contributing

News is developed by volunteers in their free time with some support through the Nextcloud organization and community. To keep this project alive we need contributions from volunteers, the software is provided under the [AGPL v3.0 license](https://github.com/nextcloud/news/blob/master/COPYING).

Read this when you want to:

* [report a bug](#Issues)
* [help translate the News file to your language](#Translation)
* [start programming and change the way the News app works](#development)


## General
* Be as precise in your issues as possible and make it as easy as possible to understand, this heavily influences the possibility to actually help you.
* Follow the [code of conduct](https://nextcloud.com/code-of-conduct/). Being a dick and insulting people will get your posts deleted and issues locked.
* Please follow the issue template and fill all the sections as much as you can, if not we might close your issue without any comment.

### Feed issues
**For feed parsing issues, check**:
* It is a valid RSS by running it through the [W3C validator](http://validator.w3.org/feed/)
* Check if [feed-io](https://feed-io.net/) can handle it.
* Use the [feed issues](https://github.com/nextcloud/news/discussions/categories/feed-issues) section in discussions.

### Hints for reporting bugs
* We do not support Internet Explorer and Safari (Patches accepted though, except for IE < 10)
* Get the latest version of the News app, check the [Nextcloud App Store](https://apps.nextcloud.com/apps/news/releases).
* Disable all browser add-ons to make sure that it's not a plugin's fault (adblockers, especially cosmetic filters)
* Clear your PHP opcode cache if you use any by restarting your webserver.
* [Check if they have already been reported](https://github.com/nextcloud/news/issues?state=open)
* [Check if your problem is covered in the FAQ section](https://github.com/nextcloud/news#faq)

### Debugging issues
* Enable debug mode in your **config/config.php**:
 * Add the **debug** attribute to config array (if not already present) and set it to **true**:
 ```php
 <?php
 $CONFIG = array(
    // other options
    // ...
    'debug' => true,
 );
 ```

* Reproduce the Problem
* Check **data/nextcloud.log**
* Check your [browser's JavaScript console for errors](http://ggnome.com/wiki/Using_The_Browser_Error_Console) if it's a client-side issue

### When Requesting Features
Please always provide the use case in addition solution, e.g.:

* "If I read feed that has comics, the newest first ordering does not work well because I have to read from the bottom up"

is much more helpful than just writing:

* "Please add reverse ordering".

Features don't belong into the issues section, instead discuss them in [discussions](https://github.com/nextcloud/news/discussions/categories/features).

## Translation

For translations in other languages than English, we rely on the [Transifex](https://www.transifex.com/) platform.

If you want to help with translating the app, please do not create a pull request. Instead, head over to https://www.transifex.com/projects/p/nextcloud/resource/news/ and join the team of your native language.

If approved, the translation will be automatically ported to the code within 24 hours.

## Development
You can first create a [discussion](https://github.com/nextcloud/news/discussions/categories/features) where you explain why, what and how you want to make a change before writing any code. If you want to agree on a solution first.

This not required however.

### How to set up a development environment
To get started setup an developer [environment](https://docs.nextcloud.com/server/latest/developer_manual/getting_started/devenv.html). Inside the apps directory clone the news repository and enable the app with occ.
Make sure you have all [dependencies](https://github.com/nextcloud/news/blob/master/docs/install.md#build-dependencies) installed.

To build the app run:

    make

in the app directory to fetch all dependencies and compile the JavaScript. The News app uses Composer for PHP dependencies, Gulp for building the JavaScript "binary" and Bower/npm as JavaScript package manager. For more information on JavaScript development [check out the README.md in the js folder](https://github.com/nextcloud/news/blob/master/js/README.md)

For running all tests suites you can run:

    make test

Packaging is done via:

    make dist

The packages are inside the top level **build/artifacts** folder

### Coding Style Guidelines
The PHP code should all adhere to [PSR-2](https://www.php-fig.org/psr/psr-2/).
*Note that this is a different codestyle than nextcloud itself uses.*
To test the codestyle you can run `make phpcs`.

For linting JavaScript, a [jshint file](https://github.com/nextcloud/news/blob/master/js/.jshintrc) is used that is run before compiling the JavaScript

### Developer Certificate of Origin (DCO)
When you commit your change, remember to sign off that you adhere to [DCO requirements](https://developercertificate.org/) as described by [Probot](https://probot.github.io/apps/dco/).

### Change log
Before you create a pull request, please remember to add an entry to [CHANGELOG.md](https://github.com/nextcloud/news/blob/master/CHANGELOG.md), using the format [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
>"Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)" ifneq (,$(wildcard $(private_key))) ifneq (,$(wildcard $(certificate))) ifneq (,$(wildcard $(occ))) CAN_SIGN=true endif endif endif all: build # Fetches the PHP and JS dependencies and compiles the JS. If no composer.json # is present, the composer step is skipped, if no package.json or js/package.json # is present, the npm step is skipped .PHONY: build build: make composer make npm # Installs and updates the composer dependencies. If composer is not installed # a copy is fetched from the web .PHONY: composer composer: ifeq (, $(composer)) @echo "No composer command available, downloading a copy from the web" mkdir -p $(build_tools_directory) curl -sS https://getcomposer.org/installer | php mv composer.phar $(build_tools_directory) php $(build_tools_directory)/composer.phar install --prefer-dist php $(build_tools_directory)/composer.phar update --prefer-dist else composer install --prefer-dist composer update --prefer-dist endif # Installs npm dependencies .PHONY: npm npm: cd js && $(npm) run build # Removes the appstore build .PHONY: clean clean: rm -rf ./build # Same as clean but also removes dependencies installed by composer, bower and # npm .PHONY: distclean distclean: clean rm -rf vendor rm -rf node_modules rm -rf js/vendor rm -rf js/node_modules # Builds the source and appstore package .PHONY: dist dist: make source make appstore # Builds the source package .PHONY: source source: rm -rf $(source_build_directory) $(source_artifact_directory) mkdir -p $(source_build_directory) $(source_artifact_directory) rsync -rv . $(source_build_directory) \ --exclude=/.git/ \ --exclude=/.idea/ \ --exclude=/build/ \ --exclude=/js/node_modules/ \ --exclude=*.log ifdef CAN_SIGN $(sign) --path "$(source_build_directory)" else @echo $(sign_skip_msg) endif tar -cvzf $(source_package_name).tar.gz -C $(source_build_directory)/../ $(app_name) # Builds the source package for the app store, ignores php and js tests .PHONY: appstore appstore: rm -rf $(appstore_build_directory) $(appstore_artifact_directory) mkdir -p $(appstore_build_directory) $(appstore_artifact_directory) cp --parents -r \ "admin" \ "appinfo" \ "css" \ "img" \ "l10n" \ "lib" \ "templates" \ "vendor" \ "COPYING" \ "AUTHORS.md" \ "js/vendor/js-url/url.min.js" \ "js/vendor/es6-shim/es6-shim.min.js" \ "js/vendor/angular/angular.min.js" \ "js/vendor/angular-animate/angular-animate.min.js" \ "js/vendor/angular-route/angular-route.min.js" \ "js/vendor/angular-sanitize/angular-sanitize.min.js" \ "js/vendor/momentjs/min/moment-with-locales.min.js" \ "js/vendor/masonry/dist/masonry.pkgd.min.js" \ "js/build/app.min.js" \ "js/admin/Admin.js" \ $(appstore_build_directory) ifdef CAN_SIGN $(sign) --path="$(appstore_build_directory)" else @echo $(sign_skip_msg) endif tar -czf $(appstore_package_name).tar.gz -C $(appstore_build_directory)/../ $(app_name) # Command for running JS and PHP tests. Works for package.json files in the js/ # and root directory. If phpunit is not installed systemwide, a copy is fetched # from the internet .PHONY: test test: cd js && $(npm) run test ifeq (, $(shell which phpunit 2> /dev/null)) @echo "No phpunit command available, downloading a copy from the web" mkdir -p $(build_tools_directory) curl -sSL https://phar.phpunit.de/phpunit.phar -o $(build_tools_directory)/phpunit.phar php $(build_tools_directory)/phpunit.phar -c phpunit.xml --coverage-clover build/php-unit.clover php $(build_tools_directory)/phpunit.phar -c phpunit.integration.xml --coverage-clover build/php-integration.clover else phpunit -c phpunit.xml --coverage-clover build/php-unit.clover phpunit -c phpunit.integration.xml --coverage-clover build/php-unit.clover endif