Slide 1

Slide 1 text

ANALYZE YOUR CHANGESET BEFORE GIT PUSH WITH SONARLINT + GIT HOOKS ROUND #2 https://speakerdeck.com/janosgyerik/sonarlint-before-git-push-2

Slide 2

Slide 2 text

Recap

Slide 3

Slide 3 text

Motivation * Changeset = branch = many commits * Automatic (+bypass)

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

Difference from sonar-github * Runs locally * Fast feedback * No-brainer setup

Slide 6

Slide 6 text

Difference from pre-commit checks in IntelliJ * Many commits vs one * Less frequent * IntelliJ not needed

Slide 7

Slide 7 text

“custom” sonarlint? custom == future

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Tip #1 : bypass the analysis SKIPSONARLINT=1 git push -u origin HEAD

Slide 10

Slide 10 text

Tip #2 : git alias to bypass the analysis somename = "!f() { SKIPSONARLINT=1 git push -u origin HEAD \"$@\"; }; f"

Slide 11

Slide 11 text

Tip #3 : enable pre-commit hook mv .git/hooks/pre-commit.optional .git/hooks/pre-commit

Slide 12

Slide 12 text

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