Skip to content

Contributing to MapStore

Simone Giannecchini edited this page Oct 1, 2024 · 16 revisions

Contributing to MapStore

  1. Getting Involved
  2. Reporting Bugs
  3. Contributing Code (here more recommendations on the topic)
  4. Improving Documentation

Getting Involved

There are several ways you can contribute to MapStore development. If you are a developer, you can provide new features and bug fixes, by using pull requests. But you can also help by:

Reporting Bugs

Before reporting a bug on the project's issues page, first make sure that your issue is caused by MapStore, not your application code (e.g. passing incorrect arguments to methods, etc.). Second, search the already reported issues for similar cases, and if it's already reported, just add any additional details in the comments.

After you've made sure that you've found a new MapStore bug, here are some tips for creating a helpful report that will make fixing it much easier and quicker:

  • Write a descriptive, specific title. Bad: Map does not show. Good: Doing X in Chrome causes Z.
  • Include browser, OS and MapStore version info in the description.
  • Create a simple test case that demonstrates the bug (e.g. using JSFiddle or JS Bin).
  • Check whether the bug can be reproduced in other browsers.
  • Check if the bug occurs in the stable version, master, or both.
  • Bonus tip: if the bug only appears in the master version but the stable version is fine, use git bisect to find the exact commit that introduced the bug.

If you just want some help with your project, try asking on the MapStore users mailing list instead.

Contributing Code

The information below will cover the process to contributing code back to MapStore. Obviously the process for small contributions is going to be more agile that the process for large contributions.

Proposing small contributions

For a small change to a handful source files a project committer can review and apply the change on your behalf. This is a quick workaround allowing us to correct spelling mistakes in the documentation, clarify a javadoc, or accept a very small fix. We understand that fixing a single source file may require changes to several test case files to verify the fix addresses its intended problem.

While we happily accept patches, we're also committed to quality. So bugfixes, performance optimizations and small improvements that don't add a lot of code are much more likely to get accepted quickly.

Before sending a pull request with a new feature, check if it's been discussed before already (either on GitHub issues or on the MapStore developers mailing list), and ask yourself two questions:

  1. Are you sure that this new feature is important enough to justify its presence in the MapStore core? Or will it look better as a plugin in a separate repository?
  2. Is it written in a simple, concise way that doesn't add bulk to the codebase?

If your feature did get merged into master, please consider submitting another pull request with the corresponding documentation update.

Proposing Large Contributions: the role of MapStore Improvement Proposals (WORK IN PROGRESS)

If someone is thinking to propose a change to MapStore that is particularly destabilizing or far-reaching, a MapStore Improvement Proposal (MIP) is required. MIP are tracked github issues and provide an opportunity for committers and users alike to provide feedback about the design of a proposed feature or architectural change. The proposal should be iteratively edited in response to community feedback.

To upgrade an issue to a MIP, an active committer should give the ticket the 'MIP' label in the issue tracker, and announce the issue on the developer mailing list.

If a ticket has a MIP label, its patch can't be committed unless it also has the 'Approved' label. To be approved, it must pass community vote (see below).

When a MIP is announced, committers should review and provide feedback in the issue comments. Feedback should take the form of:

  • +1 (with optional comment)
  • -1, with mandatory rationale and suggestion for a better approach. The suggestion may be omitted if the objection doesn't have a straightforward solution - we don't want to withhold feedback just because problems with a proposal are hard to solve.

After receiving feedback, the proposal's author should discuss the feedback on the list if necessary and adjust the proposal in response.

A proposal can be Approved when there are 3 +1 responses (including the author's implicit approval) and no -1 responses from committers; and no feedback is offered in 3 days. If a proposal fails to receive multiple +1 responses within 5 days of the request for feedback it is rejected and the issue should be closed (but the author is free to draft similar proposals in the future.) Any committer may reverse or withdraw votes on a proposal until the proposal is closed.

If a user would like to submit a GNIP, they are welcome to write it as a ticket but should find an active committer willing to promote it to GNIP status.

Recommendations for contributing code changes to MapStore source

Making Changes to MapStore Source

If you're not yet familiar with the way GitHub works (forking, pull requests, etc.), be sure to check out the awesome article about forking on the GitHub Help website — it will get you started quickly.

You should always write each batch of changes (feature, bugfix, etc.) in its own topic branch. Please do not commit to the master branch, or your unrelated changes will go into the same pull request.

Pull request guidelines

Your pull request must:

  • Follow MapStore's coding style.

  • Pass the integration tests run automatically by the Github Action - Continuous Integration system.

  • Address a single issue or add a single item of functionality. (Start the pull request title with the addressed issues if in case and #NUMBER_OF_ISSUE)

  • Contain a clean history of small, incremental, logically separate commits, with no merge commits.

  • Use clear commit messages.

  • Be possible to merge automatically.

The test and lint build targets

It is strongly recommended that you run

npm test
npm run lint

before every commit. This will catch many problems quickly, and it is much faster than waiting for the CI integration tests to run.

The test build target runs a number of quick tests on your code.

The lint build target runs ESLint checks on your code.

File Naming Conventions

The test files should in a folder named __tests__ in the module folder.

If you are testing a specific component follow the following convention:

  • Component: MyComponent.jsx
  • Test File: MyComponent-test.jsx

Follow MapStore's coding style

MapStore follows a strict coding style, enforced by ESLint rules.

The set of used rules can be found in the ESLint config packageeslint-config-mapstore file, deployed on npm and configured in the package.json.

Additionally if you use VScode these are the extensions to install that will help notify lint errors on the fly

We suggest also to add the following configuration that will fix lint errors while saving the file (.vscode/settings.json)

"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
},

You can run the linter locally on your machine before committing using the lint target:

npm run lint

In addition, take care of adding the standard file header in each javascript / css added file, and update copyright years in modified ones.

This is the standard file header:

/**
 * Copyright <year>, GeoSolutions Sas.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree.
 */

Configure your editor

If possible, configure your editor to follow the coding conventions of the library. A .editorconfig file is included at the root of the repository that can be used to configure whitespace and charset handling in your editor. See that file for a description of the conventions. The EditorConfig site links to plugins for various editors.

Pass the integration tests run automatically by the CI system

The integration tests contain a number of automated checks to ensure that the code follows the MapStore style and does not break tests or examples. You can run the integration tests locally using the test target:

npm test

Address a single issue or add a single item of functionality

Please submit separate pull requests for separate issues. This allows each to be reviewed on its own merits.

Contain a clean history of small, incremental, logically separate commits, with no merge commits

The commit history explains to the reviewer the series of modifications to the code that you have made and breaks the overall contribution into a series of easily-understandable chunks. Any individual commit should not add more than one new class or one new function. Do not submit commits that change thousands of lines or that contain more than one distinct logical change. Trivial commits, e.g. to fix lint errors, should be merged into the commit that introduced the error. See the Atomic Commit Convention on Wikipedia for more detail.

git apply --patch and git rebase can help you create a clean commit history. Reviewboard.org and Pro GIT have explain how to use them.

Use clear commit messages

Commit messages should be short, begin with a verb in the imperative, and contain no trailing punctuation. We follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html for the formatting of commit messages.

Git commit message should look like:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
74 characters or so. That way "git log" will show things
nicely even when it's indented.

Further paragraphs come after blank lines.

Please keep the header line short, no more than 50 characters.

Be possible to merge automatically

Occasionally other changes to master might mean that your pull request cannot be merged automatically. In this case you may need to merge your branch with more recent master, resolve any conflicts, and git push to update your branch so that it can be merged automatically. Please try to not rewrite the history of a pull request after the first review or it will be very hard for the reviewer to see if the required changes has been applied, expecially for big pull requests.

Improving Documentation

All MapStore objects (i.e. components, plugins, actions, reducers etc) should be properly documented in their JS documentation, please follow the required JSDoc syntax looking at the online documentation available in the JSDoc web site for more details.

Thank you for every contribution that helps to keep updated the MapStore's documentation.

Thank You

At the end, however you decide to contribute to the project, your help is very welcome and we would like to thank you for doing it.