1 * https://www.ruby-lang.org/ - The homepage of Ruby which has more links and some great tutorials.
2 * http://rubyonrails.org/ - The homepage of Rails, also has links and tutorials
6 We use [Rubocop](https://github.com/rubocop-hq/rubocop) (for ruby files)
7 and [ERB Lint](https://github.com/Shopify/erb-lint) (for erb templates)
8 to help maintain consistency in our code. You can run these utilities during
9 development to check that your code matches our guidelines:
13 bundle exec rake eslint
19 Having a good suite of tests is very important to the stability and
20 maintainability of any code base. The tests in the Rails port code are
21 by no means complete, but they are extensive, and must continue to be
22 so with any new functionality which is written. Tests are also useful
23 in giving others confidence in the code you've written, and can
24 greatly speed up the process of merging in new code.
26 When hacking, you should:
28 * Write new tests to cover the new functionality you've added.
29 * Where appropriate, modify existing tests to reflect new or changed
31 * Never comment out or remove a test just because it doesn't pass.
33 You can run the existing test suite with:
39 You can view test coverage statistics by browsing the `coverage` directory.
41 The tests are automatically run on Pull Requests and other commits with the
42 results shown on [Travis CI](https://travis-ci.org/openstreetmap/openstreetmap-website).
46 We also perform static analysis of our code. You can run the analysis yourself with:
49 bundle exec brakeman -q
54 Sometimes it's not apparent from the code itself what it does, or,
55 more importantly, **why** it does that. Good comments help your fellow
56 developers to read the code and satisfy themselves that it's doing the
59 When hacking, you should:
61 * Comment your code - don't go overboard, but explain the bits which
62 might be difficult to understand what the code does, why it does it
63 and why it should be the way it is.
64 * Check existing comments to ensure that they are not misleading.
68 If you make a change that involve the locale files (in `config/locales`) then please
69 only submit changes to the `en.yml` file. The other files are updated via
70 [Translatewiki](https://translatewiki.net/wiki/Translating:OpenStreetMap) and should
71 not be included in your pull request.
73 ### Nominatim prefixes
75 I18n keys under the `geocoder.search_osm_nominatim` keyspace are managed by the
76 Nominatim maintainers. From time to time they run stats over the Nominatim
77 database, and update the list of available keys manually.
79 Adding or removing keys to this list is therefore discouraged, but contributions
80 to the descriptive texts are welcome.
84 To generate the HTML documentation of the API/rails code, run the command
92 When you submit patches, the project maintainer has to read them and
93 understand them. This is difficult enough at the best of times, and
94 misunderstanding patches can lead to them being more difficult to
95 merge. To help with this, when submitting you should:
97 * Split up large patches into smaller units of functionality.
98 * Keep your commit messages relevant to the changes in each individual
101 When writing commit messages please try and stick to the same style as
102 other commits, namely:
104 * A one line summary, starting with a capital and with no full stop.
106 * Full description, as proper sentences with capitals and full stops.
108 For simple commits the one line summary is often enough and the body
109 of the commit message can be left out.
111 ## Sending the patches
113 If you have forked on GitHub then the best way to submit your patches is to
114 push your changes back to GitHub and then send a "pull request" on GitHub.
116 Otherwise you should either push your changes to a publicly visible git repository
117 and send the details to the [rails-dev](https://lists.openstreetmap.org/listinfo/rails-dev)
118 list or generate patches with `git format-patch` and send them to the
119 [rails-dev](https://lists.openstreetmap.org/listinfo/rails-dev) list.