From 9293c8101f725f5283faf66422a7376347d08d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Placzy=C5=84ski?= Date: Mon, 25 Mar 2024 11:46:49 +0100 Subject: [PATCH] [#530] Apply contribution tools documentation on backend module In adherence to the user story's objective of implementing code formatting and checks for the backend to ensure a consistent code style, this commit enhances the documentation within the backend module. By incorporating instructions on utilizing development tools like `hlint`, `stylish-haskell`, and `Haskell-Language-Server` within the README.md file, developers gain valuable insights into applying linting, formatting, and language server capabilities to optimize the code quality and maintain uniformity across the backend project. --- govtool/backend/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/govtool/backend/README.md b/govtool/backend/README.md index bf9225f57..8d539b304 100644 --- a/govtool/backend/README.md +++ b/govtool/backend/README.md @@ -3,6 +3,7 @@ This is a backend application of GovTool project. ## Prerequisites + In order to run `backend` your host machine will need access to the `cardano-db-sync` postgres database. To have this database running locally you'll need: * `cardano-node` * `cardano-db-sync` @@ -18,6 +19,8 @@ You will need your `cardano-node` and `cardano-db-sync` to be compatible with Sa [`sancho` testnet config files](https://sancho.network/tutorials/start-node/) +You can utilize the [docker-compose.node+dbsync.yml](../../scripts/govtool/docker-compose.node+dbsync.yml) file to setup the required services. + ### Using Nix and Direnv Due to problems with openapi3 package it's hard to build this project with plain `ghc` and `cabal-install`. Until the prolem is solved we reccomend using `nix` - this problem is fixed when you build your project from inside of the nix shell. @@ -51,3 +54,21 @@ Due to problems with openapi3 package it's hard to build this project with plain ``` > [!WARNING] > In the context of our ongoing project enhancements, it is assumed that the executable previously known as 'vva-be' should be now officially renamed to 'govtool-backend'. This change is necessary for aligning with the updated branding and functional scope of the application and it has to be implemented in the near future as a chore and refactoring ticket. Make sure that the documentation matches the actual name of the executable. + +## Development + +### Linter + +In the development environment in Nix, the [`hlint`](https://github.com/ndmitchell/hlint) tool is readily available to verify Haskell files. + +By using `hlint`, developers can ensure that their code adheres to best practices and follows appropriate guidelines. By incorporating `hlint` into the development process, developers can catch potential errors and make necessary improvements early on, ultimately leading to more efficient and robust software development. + +### Formatter + +To easily format Haskell code, ensuring consistency and readability across the codebase the [`stylish-haskell`](https://github.com/haskell/stylish-haskell) formatter has been introduced into the nix configuration. + +Developers can streamline the process of formatting their code, reducing the time and effort required for manual formatting. + +### HLS + +Developers can use the IDE integrations for Language Server Protocol (LSP) by utilising the [Haskell-Language-Server](https://github.com/haskell/haskell-language-server) that include support for GHC 9.2.7. Using such integration, developers can ensure a seamless and efficient experience with Haskell code in their IDE.