Analyze your changeset in a branch before git push using SonarLint + Git hooks; Round #2

32ef4e3e388cbadc756a008cade3ee6a?s=47 Janos Gyerik
December 08, 2016

Analyze your changeset in a branch before git push using SonarLint + Git hooks; Round #2

32ef4e3e388cbadc756a008cade3ee6a?s=128

Janos Gyerik

December 08, 2016
Tweet

Transcript

  1. ANALYZE YOUR CHANGESET BEFORE GIT PUSH WITH SONARLINT + GIT

    HOOKS ROUND #2 https://speakerdeck.com/janosgyerik/sonarlint-before-git-push-2
  2. Recap

  3. Motivation * Changeset = branch = many commits * Automatic

    (+bypass)
  4. git clone https://github.com/janosgyerik/sonarlint-git-hooks cd sonarlint-git-hooks ./get-and-setup-sonarlint.sh hooks=$PWD cd /path/to/your/project $hooks/install.sh

    Setup
  5. Difference from sonar-github * Runs locally * Fast feedback *

    No-brainer setup
  6. Difference from pre-commit checks in IntelliJ * Many commits vs

    one * Less frequent * IntelliJ not needed
  7. “custom” sonarlint? custom == future

  8. None
  9. Tip #1 : bypass the analysis SKIPSONARLINT=1 git push -u

    origin HEAD
  10. Tip #2 : git alias to bypass the analysis somename

    = "!f() { SKIPSONARLINT=1 git push -u origin HEAD \"$@\"; }; f"
  11. Tip #3 : enable pre-commit hook mv .git/hooks/pre-commit.optional .git/hooks/pre-commit

  12. https://github.com/janosgyerik/sonarlint-git-hooks/issues Problems? Ideas? Feature requests?