Jhernandez has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/173026

Change subject: WIP: Auto beautify files when adding them to the staging area
......................................................................

WIP: Auto beautify files when adding them to the staging area

This sets up a filter so that JS files are beautified when added to the staging
area automatically.

This means code is formated automatically before commiting (or precommitting)
so JSCS should rarely be a problem any more.

Change-Id: I6ece4f6723ce12d5006873526adafaebd0f82ec3
---
A .gitattributes
M Makefile
A dev-scripts/git-filters
3 files changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/26/173026/1

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..af435aa
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.js filter=jsbeautify
diff --git a/Makefile b/Makefile
index d66f154..c50a993 100644
--- a/Makefile
+++ b/Makefile
@@ -99,6 +99,7 @@
 installhooks:                          ## Install the pre-commit and 
pre-review Git hooks
        ln -sf ${PWD}/dev-scripts/pre-commit .git/hooks/pre-commit
        ln -sf ${PWD}/dev-scripts/pre-review .git/hooks/pre-review
+       dev-scripts/git-filters
 
 # user must create W3CValidationTest wiki page with text 'Hello world' for 
this to work
 validatehtml:                          ## Validates the HTML output of the 
specified page with the W3C validator. Usage: make validatehtml <title>
diff --git a/dev-scripts/git-filters b/dev-scripts/git-filters
new file mode 100755
index 0000000..10556ea
--- /dev/null
+++ b/dev-scripts/git-filters
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+git config --local filter.jsbeautify.clean "js-beautify -f -"
+git config --local filter.jsbeautify.smudge cat

-- 
To view, visit https://gerrit.wikimedia.org/r/173026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ece4f6723ce12d5006873526adafaebd0f82ec3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to