All Projects → duolingo → pre-commit-hooks

duolingo / pre-commit-hooks

Licence: Apache-2.0 license
Standardizing our code quality tooling 🛠️

Programming Languages

javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects
Makefile
30231 projects
java
68154 projects - #9 most used programming language
typescript
32286 projects
scala
5932 projects

Projects that are alternatives of or similar to pre-commit-hooks

blackbricks
Black for Databricks notebooks
Stars: ✭ 40 (-9.09%)
Mutual labels:  formatter, pre-commit, black
Pettier
Prettier config that randomizes options and arbitrarily switches between spaces and tabs 🙄
Stars: ✭ 149 (+238.64%)
Mutual labels:  formatter, prettier
Prettier Plugin Apex
Code formatter for the Apex Programming Language
Stars: ✭ 138 (+213.64%)
Mutual labels:  formatter, prettier
Poetic
Automatically install and maintain ESLint, Prettier, EditorConfig and Airbnb rules for JavaScript, TypeScript and React.
Stars: ✭ 165 (+275%)
Mutual labels:  formatter, prettier
Parallel Prettier
Concurrent prettier runner
Stars: ✭ 84 (+90.91%)
Mutual labels:  formatter, prettier
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+94015.91%)
Mutual labels:  formatter, prettier
gradle-scalafmt
Gradle plugin for scalafmt
Stars: ✭ 25 (-43.18%)
Mutual labels:  formatter, scalafmt
Sh
A shell parser, formatter, and interpreter with bash support; includes shfmt
Stars: ✭ 4,343 (+9770.45%)
Mutual labels:  formatter, shfmt
Prettyhtml
💅 The formatter for the modern web https://prettyhtml.netlify.com/
Stars: ✭ 241 (+447.73%)
Mutual labels:  formatter, prettier
Typescript Express Starter
🚀 TypeScript Express Starter
Stars: ✭ 238 (+440.91%)
Mutual labels:  formatter, prettier
Plugin Php
Prettier PHP Plugin
Stars: ✭ 1,243 (+2725%)
Mutual labels:  formatter, prettier
plugin-pug
Prettier Pug Plugin
Stars: ✭ 163 (+270.45%)
Mutual labels:  formatter, prettier
Prettier Atom
An atom package for the prettier formatter.
Stars: ✭ 750 (+1604.55%)
Mutual labels:  formatter, prettier
Javascriptprettier
A Visual Studio extension
Stars: ✭ 118 (+168.18%)
Mutual labels:  formatter, prettier
Prettier Eslint Cli
CLI for prettier-eslint
Stars: ✭ 451 (+925%)
Mutual labels:  formatter, prettier
Spotless
Keep your code spotless
Stars: ✭ 2,285 (+5093.18%)
Mutual labels:  formatter, prettier
snakefmt
The uncompromising Snakemake code formatter
Stars: ✭ 78 (+77.27%)
Mutual labels:  formatter, black
Prettier Eslint
Code ➡️ prettier ➡️ eslint --fix ➡️ Formatted Code ✨
Stars: ✭ 3,435 (+7706.82%)
Mutual labels:  formatter, prettier
Prettier Plugin Csharp
Prettier C# Plugin
Stars: ✭ 224 (+409.09%)
Mutual labels:  formatter, prettier
awesome-python-code-formatters
A curated list of awesome Python code formatters
Stars: ✭ 168 (+281.82%)
Mutual labels:  formatter, black

pre-commit hooks

This repo currently contains a single pre-commit hook that internally runs several code formatters in parallel.

  • Prettier v2.6.2 for CSS, HTML, JS, JSX, Markdown, Sass, TypeScript, XML, YAML
  • Black v22.3.0 for Python 3, v21.12b0 for Python 2
  • autoflake v1.4 for Python
  • isort v5.10.1 for Python
  • google-java-format v1.15.0 for Java
  • ktfmt v0.35 for Kotlin
  • scalafmt v3.5.1 for Scala
  • shfmt v3.4.3 for Shell
  • xsltproc from libxslt v10135 for XML
  • terraform fmt v1.1.8 for Terraform
  • ClangFormat v13.0.1 for Protobuf
  • SVGO v2.8.0 for SVG
  • Custom regex transformations (basically sed), for example:
    • Trimming trailing whitespace and newlines
    • Removing unnecessary coding pragmas and object base classes in Python 3
    • Replacing empty Python collections like list() with literal equivalents
    • Replacing empty Kotlin collections like arrayOf() with empty equivalents

We run this hook on developer workstations and enforce it in CI for all production repos at Duolingo.

Usage

Repo maintainers can declare this hook in .pre-commit-config.yaml:

- repo: https://github.com/duolingo/pre-commit-hooks.git
  rev: 1.6.1
  hooks:
    - id: duolingo
      args: # Optional
        - --python-version=2 # Defaults to Python 3
        - --scala-version=3 # Defaults to Scala 2.12

Directories named build and node_modules are excluded by default - no need to declare them in the hook's exclude key.

Contributors can copy or symlink this repo's .editorconfig file to their home directory in order to have their text editors and IDEs automatically pick up the same linter/formatter settings that this hook uses.

Duolingo is hiring! Apply at https://www.duolingo.com/careers

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].