]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
adding some static-anslysis docs 2115/head
authorBimba Shrestha <bimbashrestha@fb.com>
Thu, 7 May 2020 15:38:06 +0000 (10:38 -0500)
committerBimba Shrestha <bimbashrestha@fb.com>
Thu, 7 May 2020 15:38:06 +0000 (10:38 -0500)
CONTRIBUTING.md

index 02834659c62d7bfc6a942f29d56683aae2a98dce..23d62c099cedfd155d3857c32bd02b4902454b64 100644 (file)
@@ -70,6 +70,8 @@ Our contribution process works in three main stages:
     * Ensure CI tests pass:
         * Before sharing anything to the community, make sure that all CI tests pass on your local fork.
         See our section on setting up your CI environment for more information on how to do this.
+        * Ensure that static analysis passes on your development machine. See the Static Analysis section
+        below to see how to do this.
     * Create a pull request:
         * When you are ready to share you changes to the community, create a pull request from your branch
         to facebook:dev. You can do this very easily by clicking 'Create Pull Request' on your fork's home
@@ -106,6 +108,24 @@ Our contribution process works in three main stages:
         their change makes it to the next release of zstd. Users will often discover bugs in your code or
         suggest ways to refine and improve your initial changes even after the pull request is merged.
 
+## Static Analysis
+Static analysis is a process for examining the correctness or validity of a program without actually
+executing it. It usually helps us find many simple bugs. Zstd uses clang's `scan-build` tool for
+static analysis. You can install it by following the instructions for your OS on https://clang-analyzer.llvm.org/scan-build.
+
+Once installed, you can ensure that our static analysis tests pass on your local development machine
+by running:
+```
+make staticAnalyze
+```
+
+In general, you can use `scan-build` to static analyze any build script. For example, to static analyze
+just `contrib/largeNbDicts` and nothing else, you can run:
+
+```
+scan-build make -C contrib/largeNbDicts largeNbDicts
+```
+
 ## Setting up continuous integration (CI) on your fork
 Zstd uses a number of different continuous integration (CI) tools to ensure that new changes
 are well tested before they make it to an official release. Specifically, we use the platforms