Skip to main content

Style Guide Examples

Overview

Retool leverages JavaScript, Python and SQL to develop Apps and Workflows. Style guides represent organization-defined conventions to create consistency and improve the discoverability and interpretability of source code within and across software teams. The following provides an example of best practices that are not meant to replace an existing organization's set of standards but rather inform the importance of those standards.

JavaScript

The following standards are samples provided at w3c

StandardExample
Use camelCase for identifier names (variables and functions)socialSecurityNumber, dataOfBirth, cost, costOfItem, function getMarketPricing()
Always put spaces around operators ( = + - * / ), and after commaslet calculatedTax = cost * 0.625
Always end a simple statement with a semicolon.const colors = ["blue",  "green",  "yellow"];
General rules for complex (compound) statements: Put the opening bracket at the end of the first line.
General rules for complex (compound) statements: Use one space before the opening bracket.
General rules for complex (compound) statements: Put the closing bracket on a new line, without leading spaces.
General rules for complex (compound) statements: Do not end a complex statement with a semicolon.
General rules for object definitions: Place the opening bracket on the same line as the object name.const patient = { ....
General rules for object definitions: Use colon plus one space between each property and its value. firstname : "Chris"
General rules for object definitions: Use quotes around string values, not around numeric values.{dateOfBirth = "1972", weight = 255}
General rules for object definitions: Do not add a comma after the last property-value pair.{dateOfBirth = "1972", weight = 255}
General rules for object definitions: Place the closing bracket on a new line, without leading spaces.
General rules for object definitions: Always end an object definition with a semicolon.
Always use the same naming convention for all your code. For example: Global variables and Constants written in UPPERCASEPI = 3.14; STATE_TAX = 0.625;
For readability, avoid lines longer than 80 characters. If a JavaScript statement does not fit on one line, the best place to break it, is after an operator or a comma.adminNavPage.childNameSpace = "adminPortalNavPage1";

SQL

The following is a Gitlab style guide for SQL. Another example is provided at 10 rules for a better SQL Schema

Python

The following is a Style guide example for Python