You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/10/19 21:01:16 UTC

[9/9] couchdb commit: updated refs/heads/master to c071df9

Add targets for code analyze

Supports build-plt, check-plt and dialyze. You can run
them against some specific apps by using `apps` options,
and ignore apps with `skip_deps`:

    make dialyze apps=couch_epi,couch

If you eventually need more, use DIALYZE_OPTS to specify
own options set:

    make dialyze DIALYZE_OPTS="..."


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/de72658a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/de72658a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/de72658a

Branch: refs/heads/master
Commit: de72658a747c0b1704a969cdadb11b2c5ad78f19
Parents: 9eabbc6
Author: Alexander Shorin <kx...@apache.org>
Authored: Sat Oct 17 19:56:12 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Mon Oct 19 14:02:14 2015 +0300

----------------------------------------------------------------------
 .gitignore          |  1 +
 Makefile            | 26 ++++++++++++++++++++++++++
 rebar.config.script |  7 +++++++
 3 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/de72658a/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index b92f076..77ae520 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,5 +28,6 @@ src/couch/priv/couch_js/config.h
 src/couch/priv/couchjs
 src/couch/priv/couchspawnkillable
 
+.rebar
 bin/
 apache-couchdb-*/

http://git-wip-us.apache.org/repos/asf/couchdb/blob/de72658a/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index bb0114c..bf24ed4 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,10 @@ EUNIT_OPTS=$(shell echo "\
 	suites=$(suites) \
 	tests=$(tests) \
 	" | sed -e 's/[a-z]\+= / /g')
+DIALYZE_OPTS=$(shell echo "\
+	apps=$(apps) \
+	skip_deps=$(skip_deps) \
+	" | sed -e 's/[a-z]\+= / /g')
 
 
 ################################################################################
@@ -113,6 +117,24 @@ build-test:
 ################################################################################
 
 
+.PHONY: build-plt
+# target: build-plt - Build project-specific PLT
+build-plt:
+	@$(REBAR) -r build-plt $(DIALYZE_OPTS)
+
+
+.PHONY: check-plt
+# target: check-plt - Check the PLT for consistency and rebuild it if it is not up-to-date
+check-plt:
+	@$(REBAR) -r check-plt $(DIALYZE_OPTS)
+
+
+.PHONY: dialyze
+# target: dialyze - Analyze the code for discrepancies
+dialyze: .rebar
+	@$(REBAR) -r dialyze $(DIALYZE_OPTS)
+
+
 .PHONY: docker-image
 # target: docker-image - Build Docker image
 docker-image:
@@ -220,6 +242,7 @@ install: all
 # target: clean - Remove build artifacts
 clean:
 	@$(REBAR) -r clean
+	@rm -rf .rebar/
 	@rm -f bin/couchjs
 	@rm -rf src/*/ebin
 	@rm -rf src/*/.rebar
@@ -273,6 +296,9 @@ uninstall:
 ################################################################################
 
 
+.rebar: build-plt
+
+
 config.erl:
 	@echo "Apache CouchDB has not been configured."
 	@echo "Try \"./configure -h\" for help."

http://git-wip-us.apache.org/repos/asf/couchdb/blob/de72658a/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index 8e9dbbb..8f3b63a 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -85,6 +85,13 @@ AddConfig = [
     {erl_opts, [debug_info]},
     {eunit_opts, [verbose]},
     {plugins, [eunit_plugin]},
+    {dialyzer, [
+        {plt_location, local},
+        {plt_location, COUCHDB_ROOT},
+        {plt_extra_apps, [
+            asn1, compiler, crypto, inets, kernel, os_mon, runtime_tools,
+            sasl, ssl, stdlib, syntax_tools, xmerl]},
+        {warnings, [unmatched_returns, error_handling, race_conditions]}]},
     {post_hooks, [{compile, "escript support/build_js.escript"}]}
 ],