Skip to content

Commit b82928d

Browse files
committed
Lint markdown - without changes to content
1 parent 54c6397 commit b82928d

File tree

88 files changed

+662
-589
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+662
-589
lines changed

CONTRIBUTING.md

Lines changed: 35 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Contribution Guidelines
22

3-
43
## Reporting Issues
54

65
If you encounter a problem when using infer or if you have any questions, please open a
@@ -14,6 +13,7 @@ We welcome contributions via [pull requests on GitHub](https://github.com/facebo
1413

1514
You'll want to install a few more dependencies to comfortably hack on the infer codebase;
1615
in order to do this run `./build_infer.sh` which will allow you to then run:
16+
1717
```sh
1818
make devsetup
1919
```
@@ -23,14 +23,11 @@ make devsetup
2323
- The default build mode ("dev") makes all build warnings *fatal*. If you want the build to ignore
2424
warnings, for example to be able to test an infer executable before polishing the code to remove
2525
warnings, you can build in "dev-noerror" mode with `make BUILD_MODE=dev-noerror`.
26-
2726
- Faster edit/build cycle when working on OCaml code inside infer/src/: build inside infer/src/
2827
(skips building the models after infer has been built), and build only what is needed for type
2928
checking with `make -j -C infer/src check`. You need to have run `make -j` at some point before.
30-
3129
- Alternatively, if you want to test your changes on a small example, build in bytecode mode:
3230
`make -j -C infer/src byte`.
33-
3431
- In general, `make` commands from the root of the repository make sure that dependencies are in a
3532
consistent and up-to-date state (e.g., they rebuild infer and the models before running steps that
3633
use infer), while running `make` commands from within subdirectories generally assumes that
@@ -40,26 +37,23 @@ make devsetup
4037
necessary before running the test, but running `make -C infer/tests/codetoanalyze/java/biabduction/ test`
4138
will just execute the test.
4239

43-
4440
### Debugging OCaml Code
4541

4642
- Printf-debug using `Logging.debug_dev`. It comes with a warning so
4743
that you don't accidentally push code with calls to `debug_dev` to
4844
the repo.
49-
5045
- Browse the documentation of OCaml modules in your browser with `make doc`
51-
5246
- When using `ocamldebug`, and in particular when setting break points
5347
with `break @ <module> <line>` don't forget that an infer module `M`
5448
is in reality called `InferModules__M`, or `InferBase__M`, or
5549
... See the html documentation of the OCaml modules from `make doc`
5650
if you're unsure of a module name.
5751

58-
```console
59-
$ ledit ocamldebug infer/bin/infer.bc.exe
60-
(ocd) break @ InferModules__InferAnalyze 100
61-
Breakpoint 1 at 9409684: file backend/InferAnalyze.ml, line 99, characters 18-78
62-
```
52+
```console
53+
$ ledit ocamldebug infer/bin/infer.bc.exe
54+
(ocd) break @ InferModules__InferAnalyze 100
55+
Breakpoint 1 at 9409684: file backend/InferAnalyze.ml, line 99, characters 18-78
56+
```
6357

6458
- To test the infer OCaml code you can use the OCaml toplevel. To
6559
build the OCaml toplevel with the infer modules pre-loaded, run
@@ -71,7 +65,6 @@ Breakpoint 1 at 9409684: file backend/InferAnalyze.ml, line 99, characters 18-78
7165
Many operations require the results directory and database to be
7266
initialized with `ResultsDir.assert_results_dir ""`.
7367

74-
7568
## Contributor License Agreement
7669

7770
We require contributors to sign our Contributor License Agreement. In
@@ -88,80 +81,71 @@ Thanks!
8881
### All Languages
8982

9083
- Indent with spaces, not tabs.
91-
9284
- Line width limit is 100 characters.
93-
9485
- In general, follow the style of surrounding code.
9586

9687
### OCaml
9788

9889
- The module IStd (infer/src/istd/IStd.ml) is automatically opened in every file. Beware that this
9990
can cause weird errors such as:
100-
```
101-
$ pwd
102-
/somewhere/infer/infer/src
103-
$ cat base/toto.ml
104-
let b = List.mem true [true; false]
105-
$ make
106-
[...]
107-
File "base/toto.ml", line 1, characters 17-21:
108-
Error: This variant expression is expected to have type 'a list
109-
The constructor true does not belong to type list
110-
```
91+
92+
```console
93+
$ pwd
94+
/somewhere/infer/infer/src
95+
$ cat base/toto.ml
96+
let b = List.mem true [true; false]
97+
$ make
98+
[...]
99+
File "base/toto.ml", line 1, characters 17-21:
100+
Error: This variant expression is expected to have type 'a list
101+
The constructor true does not belong to type list
102+
```
111103

112104
- All modules open `IStd` using `open! IStd`. This is to make that fact more explicit (there's also
113105
the compilation flag mentioned above), and also it helps merlin find the right types. In
114106
particular this also opens `Core.Std`.
115-
116107
- Do not add anything to `IStd` unless you have a compelling reason to do so, for instance if you
117108
find some utility function is missing and is not provided by
118109
[`Core`](https://ocaml.janestreet.com/ocaml-core/latest/doc/core/).
119-
120110
- Polymorphic equality is disabled; use type-specific equality instead, even for primitive types
121111
(e.g., `Int.equal`). However, if your module uses a lot of polymorphic variants with no arguments
122112
you may safely `open PolyVariantEqual`.
123113

124114
If you try and use polymorphic equality `=` in your code you will get a compilation error, such as:
125-
```
126-
Error: This expression has type int but an expression was expected of type
127-
[ `no_polymorphic_compare ]
128-
```
115+
116+
```console
117+
Error: This expression has type int but an expression was expected of type
118+
[ `no_polymorphic_compare ]
119+
```
129120

130121
- Alias and use `module L = Logging` for all your logging needs. Refer to its API in Logging.mli for
131122
documentation.
132-
133123
- Check that your code compiles without warnings with `make -j test_build` (this also runs as part
134124
of `make test`).
135-
136125
- Apart from `IStd` and `PolyVariantEqual`, refrain from globally `open`ing modules. Using
137126
local open instead when it improves readability: `let open MyModule in ...`.
138-
139127
- Avoid the use of module aliases, except for the following commonly-aliased modules. Use
140128
module aliases consistently (e.g., do not alias `L` to a module other than `Logging`).
141-
```OCaml
142-
module CLOpt = CommandLineOption
143-
module F = Format
144-
module L = Logging
145-
module MF = MarkupFormatter
146-
```
129+
130+
```OCaml
131+
module CLOpt = CommandLineOption
132+
module F = Format
133+
module L = Logging
134+
module MF = MarkupFormatter
135+
```
147136

148137
- Use `[@@deriving compare, equal]` to write comparison/equality functions whenever possible.
149138
Watch out for [this issue](https://github.com/ocaml-ppx/ppx_deriving/issues/116) when writing
150139
`type nonrec t = t [@@deriving compare]`.
151-
152140
- Use named arguments whenever the purpose of the argument is not immediately obvious. In
153141
particular, use named arguments for boolean and integer parameters unless the name of the function
154142
mentions them explicitly. Also use named arguments to disambiguate between several arguments of
155143
the same type.
156-
157144
- Use named arguments for functions taken as argument; it is common to name a function argument
158145
`f`. For instance: `List.map : 'a list -> f:('a -> 'b) -> 'b list`.
159-
160146
- In modules defining a type `t`, functions that take an argument of that type should generally have
161147
that argument come first, except for optional arguments: `val f : ?optional:bool -> t -> ...`.
162-
163148
- Use the `_hum` suffix to flag functions that output human-readable strings.
164-
165149
- Format code with [ocamlformat](https://github.com/ocaml-ppx/ocamlformat).
166150

167151
### C/C++/Objective-C
@@ -172,20 +156,16 @@ Follow `clang-format` (see ".clang-format" at the root of the repository).
172156

173157
- Make sure infer builds: `make -j test_build`. Refer to the [installation
174158
document](https://github.com/facebook/infer/blob/main/INSTALL.md) for details.
175-
176159
- Run the tests: `make -j 4 test` (adjust 4 to the number of cores available of your machine). The
177160
tests (almost) all consist of the same three ingredients:
178161
1. Some source code to run infer on.
179162
2. An "issues.exp" file where each line represents one item of output of the test. For most tests,
180163
one line is one issue reported by infer.
181164
3. A `Makefile` that orchestrates the test, for instance running infer on the source code and
182165
comparing the results with issues.exp using `diff`.
183-
184166
- If your changes modified some of the expected outputs and if the changes make sense, you can
185167
update the expected test results by running `make test-replace`.
186-
187168
- If relevant, add a test for your change.
188-
189169
- To add a test that infer finds (or does not find) a particular issue, add your test in
190170
"infer/tests/codetoanalyze/{language}/{analyzer}/". Look at the `Makefile` in that directory and
191171
make sure it runs your test. "{analyzer}" is often an infer analyzer (as in
@@ -200,21 +180,18 @@ Follow `clang-format` (see ".clang-format" at the root of the repository).
200180
- Test procedures documenting current limitations of the analyzer should have the prefix `FP_`
201181
(for "false positive") or `FN_` (for "false negative") and a comment explaining why the analyzer
202182
gets the wrong answer.
203-
204-
205183
- To add a test that a certain build system integration or a command-line option works in a certain
206184
way, add a test in "infer/tests/build_systems/".
207-
208185
- If you created a new Makefile for your test, add it to the root "Makefile", either to the
209186
`DIRECT_TESTS` (first case) or to the `BUILD_SYSTEMS_TESTS` variable (second case). Gate the
210187
test appropriately if it depends on Java or Clang or Xcode (see how other tests do it).
211-
212188
- It can be useful to look at the debug HTML output of infer to see the detail of the symbolic
213189
execution. For instance:
214-
```sh
215-
$ infer --debug -- clang -c examples/hello.c
216-
$ firefox infer-out/captured/hello.c.*.html
217-
```
190+
191+
```console
192+
infer --debug -- clang -c examples/hello.c
193+
firefox infer-out/captured/hello.c.*.html
194+
```
218195

219196
## Updating infer.opam and infer.opam.locked
220197

FILES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#Files in infer/bin/
1+
# Files in infer/bin/
22

33
## Top-level commands
44

5-
*infer* : Main command to run Infer. Check out the docs for instructions on how to use it.
5+
`infer` : Main command to run Infer. Check out the docs for instructions on how to use it.
66

7-
*infer-<command>* : Infer subcommands. Running `infer-<command> [options]` is the same as running `infer <command> [options]`.
7+
`infer-<command>` : Infer subcommands. Running `infer-<command> [options]` is the same as running `infer <command> [options]`.

INSTALL.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ the instructions in our [Getting
88
Started](http://fbinfer.com/docs/getting-started/#get-infer)
99
page to install Infer.
1010

11-
1211
## Infer dependencies for MacOSX
1312

1413
Here are the prerequisites to be able to compile Infer on MacOSX. This
@@ -35,7 +34,6 @@ You can install some of these dependencies using
3534
brew install autoconf automake cmake opam pkg-config sqlite gmp mpfr java
3635
```
3736

38-
3937
## Infer dependencies for Linux
4038

4139
Here are the prerequisites to be able to compile Infer on Linux. This
@@ -52,7 +50,6 @@ is required to compile everything from source.
5250

5351
See also the distro-specific instructions for Ubuntu and Debian below.
5452

55-
5653
## Install Infer from source
5754

5855
Run the following commands to get Infer up and running:
@@ -78,7 +75,6 @@ Objective-C source code.
7875
See `./build-infer.sh --help` for more options, eg `./build-infer.sh`
7976
on its own will build the analyzers for both Java and C/ObjC.
8077

81-
8278
## Install Infer from source without opam
8379

8480
If for some reason you prefer to install Infer's OCaml dependencies by
@@ -94,13 +90,11 @@ sudo make install
9490
export PATH=`pwd`/infer/bin:$PATH
9591
```
9692

97-
9893
## How to install the dependencies on Linux
9994

10095
See the Dockerfile in docker/ for inspiration. It includes the
10196
dependencies needed to build Infer on Debian 9 (stretch).
10297

103-
10498
### Setting up opam
10599

106100
Get opam from your distribution, or from the

ISSUE_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Please make sure your issue is not addressed in the [FAQ](https://fbinfer.com/docs/support#troubleshooting).
22

33
Please include the following information:
4+
45
- [ ] The version of infer from `infer --version`.
56
- [ ] Your operating system and version, for example "Debian 9", "MacOS High Sierra", whether you are using Docker, etc.
67
- [ ] Which command you ran, for example `infer -- make`.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md).
2020

2121
Infer is MIT-licensed.
2222

23-
Note: Enabling Java support may require you to download and install
23+
Note: Enabling Java support may require you to download and install
2424
components licensed under the GPL.

docker/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@ contains a docker file to install Infer within a
55
[docker](https://www.docker.com/) container. This can be used to
66
quickly try Infer or to deploy Infer.
77

8-
98
## Pre-requisites
109

1110
To use this docker image, you will need a working docker
1211
installation. See the instructions for
1312
[Linux](http://docs.docker.com/linux/step_one/) or
1413
[MacOSX](http://docs.docker.com/mac/step_one/) as appropriate.
1514

16-
1715
## How to use
1816

1917
This docker file will use the latest
2018
[released](https://github.com/facebook/infer/releases) version of
21-
Infer.
19+
Infer.
2220

2321
1. Get docker running, e.g. using Docker Quickstart Terminal.
2422
2. go to the version of your choice, e.g. `cd docker/1.1.0/`

examples/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Contents
55
--------
66

77
- `Hello.java`: try this example by running
8-
```infer -- javac Hello.java ```
8+
```infer -- javac Hello.java```
99

1010
- `Hello.m`: try this example by running
1111
```infer -- clang -c Hello.m```
@@ -38,4 +38,3 @@ Note
3838
The infer toplevel command must be in your PATH for the commands above to
3939
succeed. Otherwise, modify the commands to use the correct path to infer, eg
4040
```../infer/bin/infer -- javac Hello.java```
41-

facebook-clang-plugins/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ Structure of the repository
77
---------------------------
88

99
- libtooling : frontend plugins (currently a clang-to-json AST exporter),
10-
1110
- clang-ocaml : OCaml libraries to process the JSON output of frontend plugins,
1211

13-
1412
Quick start
1513
-----------
1614

@@ -19,13 +17,15 @@ The plugin requires recent version of the clang compiler, re-compiled from sourc
1917
To compile and use the required version of clang, please run ./clang/setup.sh.
2018

2119
Caveat:
20+
2221
- Because of the nature of C++, clang and the plugins need to be compiled with the exact same C++ libraries.
2322
- Also, the default stripping command of clang in release mode breaks plugins.
2423

2524
Once the target compiler is installed, `make test` should run the unit tests.
2625

2726
OCaml users may also run:
28-
```
27+
28+
```console
2929
make -C clang-ocaml test #requires proper ocaml libraries, see included clang-ocaml/README
3030
```
3131

0 commit comments

Comments
 (0)