Skip to content

Development Guide

John Lambert edited this page Dec 20, 2024 · 4 revisions

The following are the coding guidelines for development for Serval (and for the NLP team in general).

  • For setting up your development environment, please look at the README.

General guidelines

Code formatting - CSharpier

All C# code should be formatted using CSharpier. The best way to enable support for CSharpier is to install the appropriate IDE extension and configure it to format on save.

Try to resolve all spelling issues by adding new entries into the settings.json if necessary.

Coding conventions

Here is a good overview of naming conventions. Here is a good overview of coding conventions. If you want to get in to even more detail, check out the Framework design guidelines and the ASP.NET Core Best Practices.

No warnings on builds

The .editorconfig file specifies many of the naming conventions and formatting checks. All of the warnings should be resolved. Projects are set to fail if there are warnings on builds.

Accumulated wisdom - fodder for code reviews

Microservice decisions

  • Don't access other component's models directly, but use MassTransit consumer/producers and contracts to pass messages between, say, Serval.DataFiles and Serval.Translation.

Database updates

  • If a new field has to be added to a model file (that is stored in a MongoDB) ask yourself:
    • If the field can legitimately be null in the future, make the field nullable
    • If the field cannot legitimately be null in the future, migrate the database