mirror of
https://github.com/sstent/foodplanner.git
synced 2026-02-17 16:25:24 +00:00
conductor(setup): Add conductor setup files
This commit is contained in:
49
conductor/code_styleguides/html-css.md
Normal file
49
conductor/code_styleguides/html-css.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Google HTML/CSS Style Guide Summary
|
||||
|
||||
This document summarizes key rules and best practices from the Google HTML/CSS Style Guide.
|
||||
|
||||
## 1. General Rules
|
||||
- **Protocol:** Use HTTPS for all embedded resources.
|
||||
- **Indentation:** Indent by 2 spaces. Do not use tabs.
|
||||
- **Capitalization:** Use only lowercase for all code (element names, attributes, selectors, properties).
|
||||
- **Trailing Whitespace:** Remove all trailing whitespace.
|
||||
- **Encoding:** Use UTF-8 (without a BOM). Specify `<meta charset="utf-8">` in HTML.
|
||||
|
||||
## 2. HTML Style Rules
|
||||
- **Document Type:** Use `<!doctype html>`.
|
||||
- **HTML Validity:** Use valid HTML.
|
||||
- **Semantics:** Use HTML elements according to their intended purpose (e.g., use `<p>` for paragraphs, not for spacing).
|
||||
- **Multimedia Fallback:** Provide `alt` text for images and transcripts/captions for audio/video.
|
||||
- **Separation of Concerns:** Strictly separate structure (HTML), presentation (CSS), and behavior (JavaScript). Link to CSS and JS from external files.
|
||||
- **`type` Attributes:** Omit `type` attributes for stylesheets (`<link>`) and scripts (`<script>`).
|
||||
|
||||
## 3. HTML Formatting Rules
|
||||
- **General:** Use a new line for every block, list, or table element, and indent its children.
|
||||
- **Quotation Marks:** Use double quotation marks (`""`) for attribute values.
|
||||
|
||||
## 4. CSS Style Rules
|
||||
- **CSS Validity:** Use valid CSS.
|
||||
- **Class Naming:** Use meaningful, generic names. Separate words with a hyphen (`-`).
|
||||
- **Good:** `.video-player`, `.site-navigation`
|
||||
- **Bad:** `.vid`, `.red-text`
|
||||
- **ID Selectors:** Avoid using ID selectors for styling. Prefer class selectors.
|
||||
- **Shorthand Properties:** Use shorthand properties where possible (e.g., `padding`, `font`).
|
||||
- **`0` and Units:** Omit units for `0` values (e.g., `margin: 0;`).
|
||||
- **Leading `0`s:** Always include leading `0`s for decimal values (e.g., `font-size: 0.8em;`).
|
||||
- **Hexadecimal Notation:** Use 3-character hex notation where possible (e.g., `#fff`).
|
||||
- **`!important`:** Avoid using `!important`.
|
||||
|
||||
## 5. CSS Formatting Rules
|
||||
- **Declaration Order:** Alphabetize declarations within a rule.
|
||||
- **Indentation:** Indent all block content.
|
||||
- **Semicolons:** Use a semicolon after every declaration.
|
||||
- **Spacing:**
|
||||
- Use a space after a property name's colon (`font-weight: bold;`).
|
||||
- Use a space between the last selector and the opening brace (`.foo {`).
|
||||
- Start a new line for each selector and declaration.
|
||||
- **Rule Separation:** Separate rules with a new line.
|
||||
- **Quotation Marks:** Use single quotes (`''`) for attribute selectors and property values (e.g., `[type='text']`).
|
||||
|
||||
**BE CONSISTENT.** When editing code, match the existing style.
|
||||
|
||||
*Source: [Google HTML/CSS Style Guide](https://google.github.io/styleguide/htmlcssguide.html)*
|
||||
51
conductor/code_styleguides/javascript.md
Normal file
51
conductor/code_styleguides/javascript.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# Google JavaScript Style Guide Summary
|
||||
|
||||
This document summarizes key rules and best practices from the Google JavaScript Style Guide.
|
||||
|
||||
## 1. Source File Basics
|
||||
- **File Naming:** All lowercase, with underscores (`_`) or dashes (`-`). Extension must be `.js`.
|
||||
- **File Encoding:** UTF-8.
|
||||
- **Whitespace:** Use only ASCII horizontal spaces (0x20). Tabs are forbidden for indentation.
|
||||
|
||||
## 2. Source File Structure
|
||||
- New files should be ES modules (`import`/`export`).
|
||||
- **Exports:** Use named exports (`export {MyClass};`). **Do not use default exports.**
|
||||
- **Imports:** Do not use line-wrapped imports. The `.js` extension in import paths is mandatory.
|
||||
|
||||
## 3. Formatting
|
||||
- **Braces:** Required for all control structures (`if`, `for`, `while`, etc.), even single-line blocks. Use K&R style ("Egyptian brackets").
|
||||
- **Indentation:** +2 spaces for each new block.
|
||||
- **Semicolons:** Every statement must be terminated with a semicolon.
|
||||
- **Column Limit:** 80 characters.
|
||||
- **Line-wrapping:** Indent continuation lines at least +4 spaces.
|
||||
- **Whitespace:** Use single blank lines between methods. No trailing whitespace.
|
||||
|
||||
## 4. Language Features
|
||||
- **Variable Declarations:** Use `const` by default, `let` if reassignment is needed. **`var` is forbidden.**
|
||||
- **Array Literals:** Use trailing commas. Do not use the `Array` constructor.
|
||||
- **Object Literals:** Use trailing commas and shorthand properties. Do not use the `Object` constructor.
|
||||
- **Classes:** Do not use JavaScript getter/setter properties (`get name()`). Provide ordinary methods instead.
|
||||
- **Functions:** Prefer arrow functions for nested functions to preserve `this` context.
|
||||
- **String Literals:** Use single quotes (`'`). Use template literals (`` ` ``) for multi-line strings or complex interpolation.
|
||||
- **Control Structures:** Prefer `for-of` loops. `for-in` loops should only be used on dict-style objects.
|
||||
- **`this`:** Only use `this` in class constructors, methods, or in arrow functions defined within them.
|
||||
- **Equality Checks:** Always use identity operators (`===` / `!==`).
|
||||
|
||||
## 5. Disallowed Features
|
||||
- `with` keyword.
|
||||
- `eval()` or `Function(...string)`.
|
||||
- Automatic Semicolon Insertion.
|
||||
- Modifying builtin objects (`Array.prototype.foo = ...`).
|
||||
|
||||
## 6. Naming
|
||||
- **Classes:** `UpperCamelCase`.
|
||||
- **Methods & Functions:** `lowerCamelCase`.
|
||||
- **Constants:** `CONSTANT_CASE` (all uppercase with underscores).
|
||||
- **Non-constant Fields & Variables:** `lowerCamelCase`.
|
||||
|
||||
## 7. JSDoc
|
||||
- JSDoc is used on all classes, fields, and methods.
|
||||
- Use `@param`, `@return`, `@override`, `@deprecated`.
|
||||
- Type annotations are enclosed in braces (e.g., `/** @param {string} userName */`).
|
||||
|
||||
*Source: [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)*
|
||||
37
conductor/code_styleguides/python.md
Normal file
37
conductor/code_styleguides/python.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Google Python Style Guide Summary
|
||||
|
||||
This document summarizes key rules and best practices from the Google Python Style Guide.
|
||||
|
||||
## 1. Python Language Rules
|
||||
- **Linting:** Run `pylint` on your code to catch bugs and style issues.
|
||||
- **Imports:** Use `import x` for packages/modules. Use `from x import y` only when `y` is a submodule.
|
||||
- **Exceptions:** Use built-in exception classes. Do not use bare `except:` clauses.
|
||||
- **Global State:** Avoid mutable global state. Module-level constants are okay and should be `ALL_CAPS_WITH_UNDERSCORES`.
|
||||
- **Comprehensions:** Use for simple cases. Avoid for complex logic where a full loop is more readable.
|
||||
- **Default Argument Values:** Do not use mutable objects (like `[]` or `{}`) as default values.
|
||||
- **True/False Evaluations:** Use implicit false (e.g., `if not my_list:`). Use `if foo is None:` to check for `None`.
|
||||
- **Type Annotations:** Strongly encouraged for all public APIs.
|
||||
|
||||
## 2. Python Style Rules
|
||||
- **Line Length:** Maximum 80 characters.
|
||||
- **Indentation:** 4 spaces per indentation level. Never use tabs.
|
||||
- **Blank Lines:** Two blank lines between top-level definitions (classes, functions). One blank line between method definitions.
|
||||
- **Whitespace:** Avoid extraneous whitespace. Surround binary operators with single spaces.
|
||||
- **Docstrings:** Use `"""triple double quotes"""`. Every public module, function, class, and method must have a docstring.
|
||||
- **Format:** Start with a one-line summary. Include `Args:`, `Returns:`, and `Raises:` sections.
|
||||
- **Strings:** Use f-strings for formatting. Be consistent with single (`'`) or double (`"`) quotes.
|
||||
- **`TODO` Comments:** Use `TODO(username): Fix this.` format.
|
||||
- **Imports Formatting:** Imports should be on separate lines and grouped: standard library, third-party, and your own application's imports.
|
||||
|
||||
## 3. Naming
|
||||
- **General:** `snake_case` for modules, functions, methods, and variables.
|
||||
- **Classes:** `PascalCase`.
|
||||
- **Constants:** `ALL_CAPS_WITH_UNDERSCORES`.
|
||||
- **Internal Use:** Use a single leading underscore (`_internal_variable`) for internal module/class members.
|
||||
|
||||
## 4. Main
|
||||
- All executable files should have a `main()` function that contains the main logic, called from a `if __name__ == '__main__':` block.
|
||||
|
||||
**BE CONSISTENT.** When editing code, match the existing style.
|
||||
|
||||
*Source: [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html)*
|
||||
Reference in New Issue
Block a user