[gjs] maint: add a static code analysis 'make target'
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] maint: add a static code analysis 'make target'
- Date: Thu, 6 Jul 2017 02:36:46 +0000 (UTC)
commit aedf0e3c9a9c1cd35929bdbadb4cee646e685ef3
Author: Claudio André <claudioandre br gmail com>
Date: Mon May 29 09:47:26 2017 -0300
maint: add a static code analysis 'make target'
It uses cppcheck static code analysis tool. It is harmless, and can be useful.
https://bugzilla.gnome.org/show_bug.cgi?id=783214
Makefile.am | 7 +++++++
doc/Hacking.md | 12 +++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index f82194e..246e2d5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -206,4 +206,11 @@ upload-release: $(DISTNAME) Makefile
scp $(DISTNAME) master.gnome.org:
ssh master.gnome.org install-module $(DISTNAME)
+
+CPPCHECK=cppcheck
+### cppcheck static code analysis
+#
+cppcheck:
+ $(CPPCHECK) --enable=warning,performance,portability,information,missingInclude --force -q
$(top_srcdir) -I $(top_builddir)
+
-include $(top_srcdir)/git.mk
diff --git a/doc/Hacking.md b/doc/Hacking.md
index f1b0361..0da343e 100644
--- a/doc/Hacking.md
+++ b/doc/Hacking.md
@@ -90,6 +90,16 @@ G_DEBUG=gc-friendly G_SLICE=always-malloc ./libtool --mode=execute valgrind --le
(And a similar command to run each `minijasmine` test.)
+### Static Code Analysis ###
+
+To execute cppcheck, a static code analysis tool for the C and C++, run:
+```sh
+jhbuild make cppcheck
+```
+It is a versatile tool that can check non-standard code, including: variable
+checking, bounds checking, leaks, etc. It can detect the types of bugs that
+the compilers normally fail to detect.
+
### Test Coverage ###
To generate a test coverage report, put this in your JHBuild
@@ -108,4 +118,4 @@ xdg-open ~/.cache/jhbuild/build/gjs/gjs-X.Y.Z-coverage/index.html
(replace `X.Y.Z` with the version number, e.g. `1.48.0`)
-[jhbuild] https://wiki.gnome.org/HowDoI/Jhbuild
\ No newline at end of file
+[jhbuild] https://wiki.gnome.org/HowDoI/Jhbuild
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]