GithubHelp home page GithubHelp logo

classicvalues / pre-commit-hooks-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from duolingo/pre-commit-hooks

1.0 1.0 0.0 88 KB

Standardizing our code quality tooling :hammer_and_wrench:

License: Apache License 2.0

Shell 0.21% JavaScript 77.00% Python 0.21% Java 1.07% Scala 0.87% Kotlin 0.38% TypeScript 0.92% CSS 0.24% Makefile 8.35% HCL 0.82% Dockerfile 9.64% SCSS 0.29%

pre-commit-hooks-1's Introduction

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

pre-commit-hooks-1's People

Contributors

artnc avatar franklin-duolingo avatar duo-garetht avatar leonra avatar seantsb avatar svenstork avatar tobymellor avatar maxblaze avatar

Stargazers

Classic Values avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.