diff --git a/dev/intellij-setup.md b/dev/intellij-setup.md index 9d455d1fd99..1cedeb0d156 100644 --- a/dev/intellij-setup.md +++ b/dev/intellij-setup.md @@ -34,6 +34,11 @@ an alias name. You can do this in Using `File` -> `Project Structure...` -> `Pla ## Code Style The Code Style is available in XML format at [druid_intellij_formatting.xml](druid_intellij_formatting.xml) and can be [imported into IntelliJ](https://www.jetbrains.com/help/idea/2017.1/copying-code-style-settings.html). +## Git Checkstyle Verification Hook (Optional) +Git Checkstyle pre-commit hook can be installed to automatically run checkstyle verification before committing, +saving cycle from avoiding the checkstyle failing later in Travis/CI environment. +The hook can be setup easily by running the /setup-hooks.sh script. + ## Metadata The installation of a MySQL metadata store is outside the scope of this document, but instructions on setting up MySQL can be found at [docs/development/extensions-core/mysql.md](/docs/development/extensions-core/mysql.md). This assumes you followed the example there and have a database named `druid` with proper permissions for a user named `druid` and a password of `diurd`. diff --git a/hooks/pre-push.sh b/hooks/pre-push.sh new file mode 100755 index 00000000000..a0928db75ba --- /dev/null +++ b/hooks/pre-push.sh @@ -0,0 +1,17 @@ +#!/bin/bash -eu +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +mvn checkstyle:checkstyle --fail-at-end diff --git a/setup-hooks.sh b/setup-hooks.sh new file mode 100755 index 00000000000..85c60d1a725 --- /dev/null +++ b/setup-hooks.sh @@ -0,0 +1,17 @@ +#!/bin/bash -eu +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ln -s ../../hooks/pre-push.sh .git/hooks/pre-push