Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/metabase/metabase. Pull mirroring updated .
  1. Nov 14, 2023
    • Mark Bastian's avatar
      Adding linter and formatter pre-commit hooks for staged BE files · d4957af1
      Mark Bastian authored
      * Adding linter and formatter to staged BE files.
      
      Note that `.cljfmt/indents.clj` tries to capture our indent rules
      and, so far, seems to get things right. There are still some inconsistencies
      in some of our nses in how we indent assoc(-in) and some t2 functions
      when it comes to key-value pairs on following lines. Should the keys
      align with the function call or be indented. Aesthetically, people
      seem to like indents, but these are functions, so should align with the
      first argument. IDK that it really matters as long as we have agreement.
      
      We may, as we adopt this, have some files be reformatted in unexpected ways
      for items that have been missed. If so, the developer can simply update
      the .cljfmt/indents.clj file, rerun the hook, and commit that along with
      their other changes.
      
      * Added whitespace linter.
      
      * Updating husky commit hook
      
      * Updated hook scripts to be exclusively for staged files.
      
      Updated cljfmt to use the latest and greatest along with the new format of config file.
      
      * Commenting out the actual formatting hook in .husky/pre-commit until we come up with a globally happy solution to forms that don't have good formatting rules, like defprotocol+ in a reader conditional.
      
      * Reverting formatting
      
      * Moving pre-commit hooks from .husky/pre-commit to the package.json's lint-staged section.
      
      Note that we're still not calling the cljfmt file (.bin/cljfmt_staged.sh)
      until we get agreement on formatting.
      
      One thing we might do since we're using lint-staged is we can probably
      exclude the "bad" files that go sideways with linting and format everything
      else automatically. This might be a good follow-on PR.
      Unverified
      d4957af1
  2. Apr 27, 2022
    • Case Nelson's avatar
      Add git pre-commit hook to catch `nocommit` lines (#22096) · 8108f0aa
      Case Nelson authored
      Sometimes you’ll make a change to some code and not want to commit it. You probably add a comment to the code and hope you’ll either see the comment in the diff before committing or just remember not to check in the change. If you’ve ever done this you’ve probably also committed something you didn’t mean to commit. I know I have.
      
      Below is a git pre-commit hook that searches for the text `nocommit` and if found rejects the commit. With it you can stick `nocommit` in a comment next to the change you don’t want committed and know that it won’t be committed.
      
      You can maintain a list of personal forbidden words by exporting
      `NOCOMMIT_RE` e.g:
      `export NOCOMMIT_RE="spy|tap>|curse word"`
      Unverified
      8108f0aa
  3. Jun 09, 2021
Loading