Source linting: pre-commit

howto/code/lint/index.rst
howto/code/lint/pre-commit.rst
------------------------------
  o Document the pre-commit hook for linting and source cleanup.
  o Added a howto cookbook until cleaner commands can be added.

Change-Id: I41fa897ae4a9ae54f133ac6a3fbb23633bc0d648
Signed-off-by: Joey Armstrong <jarmstrong@linuxfoundation.org>
diff --git a/VERSION b/VERSION
index ea26801..6f14001 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.12.40
+2.12.41
diff --git a/howto/code/lint/index.rst b/howto/code/lint/index.rst
index c061006..01e4f71 100644
--- a/howto/code/lint/index.rst
+++ b/howto/code/lint/index.rst
@@ -6,6 +6,7 @@
 
    lint-helm.rst
    fix-errors
+   pre-commit
 
 
 ======================================
@@ -41,4 +42,5 @@
 
 - :ref:`Makefile Target lint-chart`
 - :ref:`Makefile Target lint-helm`
-
+- :ref:`Makefile Target lint-robot`
+- :ref:`Makefile Target lint-pre-commit`
diff --git a/howto/code/lint/pre-commit.rst b/howto/code/lint/pre-commit.rst
new file mode 100644
index 0000000..bf52b5c
--- /dev/null
+++ b/howto/code/lint/pre-commit.rst
@@ -0,0 +1,47 @@
+.. _Makefile Target lint-pre-commit:
+
+Tool: pre-commit
+================
+
+The `pre-commit tool <https://pre-commit.com/>`__ can also be used to:
+
+- Scan for a variety of problems: syntax, licensing, etc.
+- Perform some code cleanups
+
+  - Remove whitespace
+  - re-indent files
+  - etc
+
+## Install
+
+.. code:: bash
+
+    % git clone ssh://gerrit.opencord.org:29418/bbsim.git
+    % cd bbsim
+
+    % make help
+
+    # Install python virtualenv w/modules from requirements.txt
+    % make venv
+    % source .venv/bin/activate
+
+    # Scan for problems
+    % pre-commit
+
+    % make clean
+
+## Configuration
+
+- Each repository contains a yaml config file that controls hooks and linting behavior:
+
+  - repo:bbsim/`.pre-commit-config.yaml <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master/.pre-commit-config.yaml>`__
+
+- A skeleton config is currently being used.
+- Make changes as needed but be sure to propogate them out to all voltha repositories.
+- Long term a central repository can be maintained for pre-commit hooks that can be
+  included as a git submodule to remove duplication and potential for linting variations.
+
+.. seealso:
+
+| URL | Description |
+| pre-commit | A framework for managing and maintaining multi-language pre-commit hooks |