Skip to content

SimpleReport Style Guide

emmastephenson edited this page Jul 14, 2022 · 15 revisions

This style guide is very much a WIP! Feel free to edit!

Java

We use the Google Java Style Guide as our baseline: https://google.github.io/styleguide/javaguide.html Our gradle spotlessApply command (run automatically when committing changes) will format some things based on this style guide like formatting and spacing. However, the linter isn't strongly opinionated so it won't catch everything.

Exceptions

Whenever possible, avoid throwing a generic Exception in the method signature, preferring to throw the explicit Exception type.

No:

private String getUserStatus(UUID id) throws Exception {}

Yes:

private String getUserStatus(UUID id) throws IllegalStateException, BadRequestException {}

Frontend

Graphql Queries

All graphql queries used in a container component (a component that is the root of a view e.g.: Test Results View) should be place in a operations.graphql file that lives in the relevant subdirectory. For example, for the Test Results view the file that lives in the testResults folder.

Whenever you change the location/contents of a query file, run the command yarn codegen. This will generated the necessary hooks that will allow you call the query on the front end. For example, to fetch data using the query GetResultsCountByFacility you need to use the hook useGetResultsCountByFacilityQuery which will get automatically generated by the codegen command.

To see this example in action check the file TestResultsList.tsx in the repo.

Local development

Setup

How to

Development process and standards

Oncall

Technical resources

How-to guides

Environments/Azure

Misc

?

Clone this wiki locally