This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Development Guidelines
FABIANO Serge edited this page Sep 20, 2021
·
34 revisions
Find below the golden rules that you have to go through for each PR:
- Do not stack several PRs in parallel on the same topic or depending on each others
- Schedule a short technical meeting with me before you start a task
- Check the logs in production after each deployment and report to me before opening an issue
- Translate texts and maintain all i18n files + provide english translation for unknown languages (check same number of lines in all files too)
- Full translation in all languages occurs once a week and is handled by the responsible people (native speakers)
- Pick up a Small task, fix an Issue, enhance the Unit Tests or perform a QA test in the case you have finished your main task
- Do not copy/paste the code blindly, understand the purpose of every line of code you use
- Test each line of your code in the debugger!
- Code provided in Pull Request must be tested up by a Unit Test (create a new issue)
- Provide a short test case in your issue when moved to QA pipeline so anyone can test your feature
- Learn from your mistakes, be proud of them and do not make them again
- Do not mix implementation of different issues in one PR: 1 PR -> 1 Issue
- Comment your code if necessary to explain choices that are not self-explanatory
- Avoid tree of i18n in json doc (chargers.popup.error.title -> chargers.popup_error_title)
- Each front-end screen should trigger 1 or 2 calls max in the backend to retrieve and display the data
- Always think big, your code must scale: millions users, charging stations...
- Develop with production in mind: multiple instances of the same server, limited Memory/CPU, use of Locks...
- Keep the code readable, simple, self-explanatory (naming of classes/methods/vars) and try to avoid lengthy methods
- A Class/Method should be done for one and only one purpose (deleteUser() should not create a user, a Car class should contain only ca related method)
- Follow the logic in place, don't reinvent the weel (Hanlding of HTTP calls, DB access...)
- The code must be more appealing than the UI which should give the 'wow' moment to the users!
- Request only the necessary fields from the database (use of MongoDB $project)
- Maintain the REST endpoint documentation in the open-api-standard.json file when you create/change a REST endpoint
- Keep both Response Time and Data Volume low in the REST/OCPP/DB endpoints
- MongoDB requests should be returned by REST service without further data processing (use MongoDB $project)
- Check your MongoDB requests with the explain() method -> Should use an index
- Don't forget to move your task to the right pipeline when you have finished your work / requested changes
- Check authorisation and use canChange...(), canDelete...() to check authorizations instead of isAdmin(), isBasic()
- Follow the case standard when you create interface, constants... (e.g. interface is Pascal Case: MyInterface, variable in Camel Case: myVar...)
- Keep your branch or pull request up to date with master-qa on daily basis + retest the merged parts
- Don't break Angular module dependencies: transactions depends on shared module but never on charging-stations
- Use only relative path imports in TypeScript
- Test your implementation with different user's profiles (Basic, Admin, Demo, Site Admin)
- Check Tenant's component to enable/disable features in the front-end and the backend
- Maintain your absence in the shared calendar when you plan to be OoO (Charge-Angels holidays)
- Test the front-end with the debug console opened and check and fix any logged errors
- Check if the front-end adapts correctly to the giant iPad resolution (1063 x 1546) that we have at SAP Mougins entrance
- Do not write anything on the disk
- Do not use methods in Angular HTML template expect for event handling
- Avoid mixing several statements in one line (break it down into several to ensure readability)
- Keep your PR as small as possible. Split into several ones if necessary.
- When new open source is added to the package.json, check the license which should not be restrictive (MIT...)
- Always link your pull request to its corresponding issue in GitHub
- Conversation opened in GitHub during a code review can be only closed by the person who created it
- Avoid doing lookups (join) in storage classes before sort/limit is processed (performances), only filters are allowed
- Use decimal.js lib to manipulate floats that will be persisted: Utils.createDecimal(meterValueWh).minus(lastConsumption.value).toNumber()
- Keep in sync the types from ev-server to ev-dashboard and ev-mobile
- Use the new RESTful endpoint for new backend API
- Whenever the REST endpoint is changed, update the e-mobility-oas.json file (used by Swagger)
- Do not check error messages returned with the REST endpoint but only HTTP code
- For any new REST endpoint, use the new routing framework (cf. GlobalRouter) and validate your HTTP requests with JSon schemas
- If you need to update partial data of an object in MongoDB, create a new saveXXX() method to update that data
- Do not expose sensitive data in GitHub issues (user name, email...) - Blur your screenshot
- Every GitHub issue should be linked to an Asana task (copy the GitHub issue link into the task) and properly assigned and tagged
- When you have finished your implementation run through the golden rules before creating a PR