Development and review checklist

Introduction

This guide serves as a reference for developers and code reviewers and contains a list of often forgotten or overlooked things when implementing or reviewing code changes to SORMAS. We heavily encourage to actively refer to it when performing one of these tasks in order to improve the quality of the software. This guide will be maintained and updated with new aspects as we learn about them. If you are working on SORMAS and there is something that you think would be a good addition, please let us know in our Gitter channel or open a task issue with your request.

General

  • Code adheres to the formatting and codestyle guidelines

  • If applicable (and reasonable), unit tests have been added/altered for new/updated functionalities

  • If new strings have been added or existing strings have been updated, the respective Java files (e.g. Strings.java, Captions.java, ...) have been automatically (not manually) updated using the I18nConstantGenerator class

  • When new backend queries have been written, deleted entities are filtered out by default (unless they are specifically required for the query in question)

Entities/Database

  • VERY IMPORTANT: Any database upgrade has been tested in both the web and the Android app; this means that:

    • For the web app, a running server has been re-deployed after adding the upgrade script, and the upgrade script has been executed automatically and successfully during server startup

    • For the mobile app, prior to the database upgrade, there is a running app set up on an emulator or physical device that has been connected to a running server, and has synchronized with that server at least once; once the upgrade script has been added, the app is NOT uninstalled, but instead the Run App command in Android Studio is successfully used to update the existing app on the device (i.e. the app does not crash when automatically opened after running this command)

  • In case of database changes, the schema version (Web App) and DATABASE_VERSION (Android App) have been incremented correctly; the DATABASE_VERSION always has to be the last case in the switch statement in onUpgrade + 1

  • The owner of newly created tables is set to sormas_user (Web App)

  • A history table has been created for new entities (Web App)

  • New fields have been added to the history tables (Web App)

  • Column declarations are written in camel case (Android App)

  • String fields are declared with the text data type instead of varchar

  • If an "embedded" entity or a list of those is added to a parent entity (i.e. an entity that is not synchronized individually, but alongside its parent entity), it has been added to the createChangeDateFilter method of its parent entity's service (Web) and the getLatestChangeDate method of its parent entity's Dao class (App); if such methods do not exist so far, they have been added accordingly

  • Statements for new entities have been added to the clearTables, onCreate, and upgradeFromUnupgradableVersion methods of the DatabaseHelper (Android App)

DataTransferObjects (DTOs)

  • New String fields that are supposed to contain user-entered information that can be used to unambiguously identify persons are annotated with @PersonalData

  • New String fields that can contain user-entered information, but do not satisfy the above condition are annotated with @SensitiveData

  • Any method that starts with get, is, or set but is not a direct getter/setter of a field is annotated with @JsonIgnore