Run pre-commit on all files

This commit is contained in:
Charles-Axel Dein 2020-07-21 09:37:15 +02:00
parent 4af5a19d79
commit ec0f449ede
22 changed files with 125 additions and 36 deletions

View File

@ -13,4 +13,6 @@ repos:
rev: v1.4.0 rev: v1.4.0
hooks: hooks:
- id: doctoc - id: doctoc
args: --title "## Table of Contents" args:
- --title
- "## Table of Contents"

View File

@ -1,3 +1,12 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Contributing](#contributing)
- [Install pre-commit hooks](#install-pre-commit-hooks)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Contributing # Contributing
## Install pre-commit hooks ## Install pre-commit hooks

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Professional Programming - about this list](#professional-programming---about-this-list) - [Professional Programming - about this list](#professional-programming---about-this-list)
- [Contributing to this list](#contributing-to-this-list) - [Contributing to this list](#contributing-to-this-list)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Antipatterns](#antipatterns) - [Antipatterns](#antipatterns)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Antipatterns](#antipatterns) - [Antipatterns](#antipatterns)
- [Strict email validation](#strict-email-validation) - [Strict email validation](#strict-email-validation)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Database anti-patterns](#database-anti-patterns) - [Database anti-patterns](#database-anti-patterns)
- [Using `VARCHAR` instead of `TEXT` (PostgreSQL)](#using-varchar-instead-of-text-postgresql) - [Using `VARCHAR` instead of `TEXT` (PostgreSQL)](#using-varchar-instead-of-text-postgresql)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Error handling anti-patterns](#error-handling-anti-patterns) - [Error handling anti-patterns](#error-handling-anti-patterns)
- [Hiding exceptions](#hiding-exceptions) - [Hiding exceptions](#hiding-exceptions)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [MVCS Antipatterns](#mvcs-antipatterns) - [MVCS Antipatterns](#mvcs-antipatterns)
- [Creating entities for association tables](#creating-entities-for-association-tables) - [Creating entities for association tables](#creating-entities-for-association-tables)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Python Antipatterns](#python-antipatterns) - [Python Antipatterns](#python-antipatterns)
- [Redundant type checking](#redundant-type-checking) - [Redundant type checking](#redundant-type-checking)

View File

@ -1,19 +1,21 @@
from collections import namedtuple from collections import namedtuple
Bread = namedtuple('Bread', 'color') Bread = namedtuple("Bread", "color")
class ToastException(Exception): class ToastException(Exception):
pass pass
def toast(bread): def toast(bread):
try: try:
put_in_toaster(bread) put_in_toaster(bread)
except: except:
raise ToastException('Could not toast bread') raise ToastException("Could not toast bread")
def put_in_toaster(bread): def put_in_toaster(bread):
brad.color = 'light_brown' # Note the typo brad.color = "light_brown" # Note the typo
toast(Bread('yellow')) toast(Bread("yellow"))

View File

@ -1,20 +1,22 @@
from collections import namedtuple from collections import namedtuple
Bread = namedtuple('Bread', 'color') Bread = namedtuple("Bread", "color")
class ToastException(Exception): class ToastException(Exception):
pass pass
def toast(bread): def toast(bread):
try: try:
put_in_toaster(bread) put_in_toaster(bread)
except: except:
print 'Got exception while trying to toast' print("Got exception while trying to toast")
raise raise
def put_in_toaster(bread): def put_in_toaster(bread):
brad.color = 'light_brown' # Note the typo brad.color = "light_brown" # Note the typo
toast(Bread('yellow')) toast(Bread("yellow"))

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Not paging a database query](#not-paging-a-database-query) - [Not paging a database query](#not-paging-a-database-query)
- [Returning whole objects where primary key would suffice](#returning-whole-objects-where-primary-key-would-suffice) - [Returning whole objects where primary key would suffice](#returning-whole-objects-where-primary-key-would-suffice)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [SQLAlchemy Anti-Patterns](#sqlalchemy-anti-patterns) - [SQLAlchemy Anti-Patterns](#sqlalchemy-anti-patterns)
- [Abusing lazily loaded relationships](#abusing-lazily-loaded-relationships) - [Abusing lazily loaded relationships](#abusing-lazily-loaded-relationships)

View File

@ -4,13 +4,13 @@ from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
engine = create_engine('sqlite:///:memory:', echo=True) engine = create_engine("sqlite:///:memory:", echo=True)
Session = sessionmaker(bind=engine) Session = sessionmaker(bind=engine)
Base = declarative_base() Base = declarative_base()
class Toaster(Base): class Toaster(Base):
__tablename__ = 'toasters' __tablename__ = "toasters"
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
name = Column(String) name = Column(String)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Test antipatterns](#test-antipatterns) - [Test antipatterns](#test-antipatterns)
- [Testing implementation](#testing-implementation) - [Testing implementation](#testing-implementation)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Why use feature flags?](#why-use-feature-flags) - [Why use feature flags?](#why-use-feature-flags)
- [Should feature flags be used for everything?](#should-feature-flags-be-used-for-everything) - [Should feature flags be used for everything?](#should-feature-flags-be-used-for-everything)

View File

@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
# Table of Contents
- [Glossary](#glossary) - [Glossary](#glossary)
- [Second system effect](#second-system-effect) - [Second system effect](#second-system-effect)

View File

@ -1,3 +1,16 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Introduction to front-end programming](#introduction-to-front-end-programming)
- [Goal of this training](#goal-of-this-training)
- [Prerequisites](#prerequisites)
- [To do before the course](#to-do-before-the-course)
- [Curriculum](#curriculum)
- [Inspiration](#inspiration)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Introduction to front-end programming # Introduction to front-end programming
## Goal of this training ## Goal of this training

View File

@ -1,3 +1,43 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Modern JavaScript/TypeScript](#modern-javascripttypescript)
- [Quirks](#quirks)
- [Printing and interacting with the console](#printing-and-interacting-with-the-console)
- [Comparing scalar, arrays, and objects](#comparing-scalar-arrays-and-objects)
- [Always use triple comparators (`===`) instead of double (`==`)](#always-use-triple-comparators--instead-of-double-)
- [Comparing non-scalar](#comparing-non-scalar)
- [`Object` methods](#object-methods)
- [`Object.assign`, spread operator](#objectassign-spread-operator)
- [`Array` methods](#array-methods)
- [`Array.includes` (ES7)](#arrayincludes-es7)
- [Object literals, assignment and destructuring](#object-literals-assignment-and-destructuring)
- [Objects](#objects)
- [Array](#array)
- [`let` and `const`](#let-and-const)
- [Arrow functions](#arrow-functions)
- [How `this` works in arrow functions](#how-this-works-in-arrow-functions)
- [Best practices](#best-practices)
- [Classes](#classes)
- [Prototypal inheritance](#prototypal-inheritance)
- [Template literals](#template-literals)
- [Template tags](#template-tags)
- [Loops](#loops)
- [`for... of`](#for-of)
- [Promises](#promises)
- [Creating a promise](#creating-a-promise)
- [Consuming a promise](#consuming-a-promise)
- [Chaining promises](#chaining-promises)
- [Async functions](#async-functions)
- [Modules](#modules)
- [TypeScript](#typescript)
- [Differences between TypeScript and JavaScript](#differences-between-typescript-and-javascript)
- [An introduction to TypeScript's type system](#an-introduction-to-typescripts-type-system)
- [References](#references)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Modern JavaScript/TypeScript # Modern JavaScript/TypeScript
Note: run code quickly with https://codesandbox.io/s/ Note: run code quickly with https://codesandbox.io/s/

View File

@ -1,3 +1,15 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [An introduction to React](#an-introduction-to-react)
- [The inspiration for React](#the-inspiration-for-react)
- [React components](#react-components)
- [An introduction to state management in React application](#an-introduction-to-state-management-in-react-application)
- [Testing React applications](#testing-react-applications)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# An introduction to React # An introduction to React
## The inspiration for React ## The inspiration for React

View File

@ -1,3 +1,14 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [CSS & HTML: restart](#css--html-restart)
- [An intro to modern technologies and methodologies](#an-intro-to-modern-technologies-and-methodologies)
- [Topics](#topics)
- [Accessibility](#accessibility)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# CSS & HTML: restart # CSS & HTML: restart
## An intro to modern technologies and methodologies ## An intro to modern technologies and methodologies

View File

@ -1,3 +1,13 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Front-end development practices](#front-end-development-practices)
- [Testing](#testing)
- [Code style](#code-style)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Front-end development practices # Front-end development practices
## Testing ## Testing