Skip to content

Code & QA Checklist

Ralf edited this page Mar 16, 2023 · 2 revisions

This document is a work in progress, be welcome to improve it!

Before submitting new code to Kwenta, make sure new code in pull requests meets the defined standards and best practices.

General checklist

  • Does the code work?
  • Code is easy to understand.
  • Code is written following the Kwenta coding standards and guidelines.
  • Code is in sync with existing code patterns/technologies.
  • DRY (Don't repeat yourself). Is the same code duplicated more than twice?
  • Can the code be easily tested?
  • Are functions/classes/components reasonably small?
  • Are naming conventions followed for variables, file names, translations, etc.?
  • Removed unused packages from NPM?
  • Separation of Concerns principle followed?
  • Avoid premature optimization
  • Orthogonality
  • Single Responsibility Principle

Code style

  • No hardcoded values, use constants values.
  • Avoid multiple if/else blocks.
  • No commented out code.
  • No unnecessary comments: comments that describe the how.
  • Add necessary comments where needed. Necessary comments are comments that describe the why.

ESLint

  • Code ha no linte errors or warnings. Verify with npm run lint before creating commits.
  • No console.logs.

Testing

  • Tests are readable, maintainable, trustworthy.
  • Test names (describe, it) are concise, explicit, descriptive.
  • Avoid logic in your tests.
  • Don't test multiple concerns in the same test.
  • Cover the general case and the edge cases.
  • Test the behaviour, not the internal implementation.
  • Use a mock to simulate/stub complex class structure, methods or async functions.

Git

  • Commits are small and divided into logical parts.
  • Commits messages are small and understandable.
  • Use branches for new features, hotfixes, etc.
  • Make sure PR is branched off of latest perps-v2-dev branch
  • Make sure all possible PR conflicts are solved
  • Make sure no dist files, editor/IDE files, etc are checked in. There should be a .gitignore for that.

QA

  • Verify code changes do not break functionality on PR deployment
  • Verify code changes apply to both mobile and desktop, as well as light and dark theme
  • If code changes touch feature functionality (Futures, Exchange, etc.), test by making several test trades (deposit, withdraw, open position, modify position, close position, etc.)
  • More tbd

Other

  • Security.
  • Usability.

Acknowledgement

This checklist has been modified based on ivopauly's checklist.