UNPKG

8.44 kBMarkdownView Raw
1# Contributing to OpenLayers
2
3Thanks for your interest in contributing to OpenLayers.
4
5## Asking Questions
6
7Please ask questions about using the library on [Stack Overflow using the tag 'openlayers'](http://stackoverflow.com/questions/tagged/openlayers).
8
9When you want to get involved and discuss new features or changes, please use [the mailing list](https://groups.google.com/forum/#!forum/openlayers-dev).
10
11
12## Submitting Bug Reports
13
14Please use the [GitHub issue tracker](https://github.com/openlayers/openlayers/issues). Before creating a new issue, do a quick search to see if the problem has been reported already.
15
16
17## Getting Familiar with the Code in the Repository
18
19Look for `readme.md` files! Several directories contain a `readme.md` file that explains the contents of the directory and how to work with them.
20
21
22## Contributing Code
23
24See [`DEVELOPING.md`](https://github.com/openlayers/openlayers/blob/master/DEVELOPING.md) to learn how to get started developing.
25
26Our preferred means of receiving contributions is through [pull requests](https://help.github.com/articles/using-pull-requests). Make sure
27that your pull request follows our pull request guidelines below before submitting it.
28
29This page describes what you need to know to contribute code to OpenLayers as a developer.
30
31
32## Contributor License Agreement
33
34Before accepting a contribution, we ask that you provide us a Contributor
35License Agreement. If you are making your contribution as part of work for
36your employer, please follow the guidelines on submitting a [Corporate
37Contributor License Agreement](https://raw.github.com/openlayers/cla/master/ccla.txt). If you are
38making your contribution as an individual, you can submit a digital [Individual
39Contributor License Agreement](https://docs.google.com/spreadsheet/viewform?formkey=dGNNVUJEMXF2dERTU0FXM3JjNVBQblE6MQ).
40
41
42## Pull request guidelines
43
44Before working on a pull request, create an issue explaining what you want to contribute. This ensures that your pull request won't go unnoticed, and that you are not contributing something that is not suitable for the project. Once a core developer has set the `pull request accepted` label on the issue, you can submit a pull request. The pull request description should reference the original issue.
45
46Your pull request must:
47
48 * Follow OpenLayers's coding style.
49
50 * Pass the integration tests run automatically by the Travis Continuous
51 Integration system.
52
53 * Address a single issue or add a single item of functionality.
54
55 * Contain a clean history of small, incremental, logically separate commits,
56 with no merge commits.
57
58 * Use clear commit messages.
59
60 * Be possible to merge automatically.
61
62
63### The `check` build target
64
65It is strongly recommended that you run
66
67 $ make check
68
69before every commit. This will catch many problems quickly, and it is much
70faster than waiting for the Travis CI integration tests to run.
71
72The `check` build target runs a number of quick tests on your code. These
73include:
74
75 * Lint
76 * Compile
77 * Tests
78
79
80### Follow OpenLayers's coding style
81
82OpenLayers follows [Google's JavaScript Style
83Guide](https://google.github.io/styleguide/javascriptguide.xml).
84This is checked using [ESLint](http://eslint.org/), you
85can run the linter locally on your machine before committing using the `lint`
86target:
87
88 $ make lint
89
90In addition to fixing problems identified by the linter, please also follow the
91style of the existing OpenLayers code, which includes:
92
93 * Always wrap the body of `for`, `if`, and `while` statements in braces.
94
95 * Class methods should be in alphabetical order.
96
97 * `var` declarations should not span multiple lines. If you cannot fit all
98 the declarations in a single line, then start a new `var` declaration on a
99 new line. Within a single line, variables should be declared in
100 alphabetical order.
101
102 * Do not use assignments inside expressions.
103
104 * Use uppercase for `@const` variables.
105
106### Configure your editor
107
108If possible, configure your editor to follow the coding conventions of the
109library. A `.editorconfig` file is included at the root of the repository that
110can be used to configure whitespace and charset handling in your editor. See
111that file for a description of the conventions. The [EditorConfig](
112http://editorconfig.org/#download) site links to plugins for various editors.
113
114### Pass the integration tests run automatically by the Travis CI system
115
116The integration tests contain a number of automated checks to ensure that the
117code follows the OpenLayers style and does not break tests or examples. You
118can run the integration tests locally using the `ci` target:
119
120 $ make ci
121
122
123### Address a single issue or add a single item of functionality
124
125Please submit separate pull requests for separate issues. This allows each to
126be reviewed on its own merits.
127
128
129### Contain a clean history of small, incremental, logically separate commits, with no merge commits
130
131The commit history explains to the reviewer the series of modifications to the
132code that you have made and breaks the overall contribution into a series of
133easily-understandable chunks. Any individual commit should not add more than
134one new class or one new function. Do not submit commits that change thousands
135of lines or that contain more than one distinct logical change. Trivial
136commits, e.g. to fix lint errors, should be merged into the commit that
137introduced the error. See the [Atomic Commit Convention on Wikipedia](http://en.wikipedia.org/wiki/Atomic_commit#Atomic_Commit_Convention) for more detail.
138
139`git apply --patch` and `git rebase` can help you create a clean commit
140history.
141[Reviewboard.org](http://www.reviewboard.org/docs/codebase/dev/git/clean-commits/)
142and [Pro GIT](http://git-scm.com/book/en/Git-Tools-Rewriting-History) have
143explain how to use them.
144
145
146### Use clear commit messages
147
148Commit messages should be short, begin with a verb in the imperative, and
149contain no trailing punctuation. We follow
150http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
151for the formatting of commit messages.
152
153Git commit message should look like:
154
155 Header line: explaining the commit in one line
156
157 Body of commit message is a few lines of text, explaining things
158 in more detail, possibly giving some background about the issue
159 being fixed, etc etc.
160
161 The body of the commit message can be several paragraphs, and
162 please do proper word-wrap and keep columns shorter than about
163 74 characters or so. That way "git log" will show things
164 nicely even when it's indented.
165
166 Further paragraphs come after blank lines.
167
168Please keep the header line short, no more than 50 characters.
169
170### Be possible to merge automatically
171
172Occasionally other changes to `master` might mean that your pull request cannot
173be merged automatically. In this case you may need to rebase your branch on a
174more recent `master`, resolve any conflicts, and `git push --force` to update
175your branch so that it can be merged automatically.
176
177## Building on Windows
178
179Most developers build on Linux. Building on Windows is possible under Cygwin.
180When installing Cygwin from https://www.cygwin.com/, include the developer
181tools to get GNU make.
182
183First (before npm install), to avoid file permission problems between Windows
184and Cygwin, edit Cygwin's /etc/fstab file to disable ACLs like this
185`none /cygdrive cygdrive binary,noacl,posix=0,user 0 0`
186
187Python is normally installed with Cygwin so need not be installed separately.
188By default Cygwin will use its own version of Python rather than Window's,
189so the Python modules should be installed for Cygwin's Python.
190
191The build targets `check-deps`, `serve`, `lint`, `build`, `test`, `check` and
192`host-examples` described above should all work. `host-examples` takes quite a
193while to run. If a target does not run properly first time, try it again.
194
195Currently, Firefox fails to run http://localhost:3000/build/examples
196from make serve, but Chrome and Internet Explorer will.
197
198Microsoft Visual Studio's javascript debugger may be used to debug the
199build/hosted/your-branch/examples. It will be convenient to set
200build/hosted/your-branch/examples/index.html as the startup page.
201
202Your OpenLayers source tree need not be under the Cygwin root.
203if you checkout to c:/openlayers then you can build under Cygwin at /cygdrive/c/openlayers .
204However, keep the path to the OpenLayers files short otherwise you may see
205`ENAMETOOLONG` errors.