Skip to content

Commit

Permalink
[website] Update the website
Browse files Browse the repository at this point in the history
Summary: Latest version of the website

Reviewed By: skcho

Differential Revision: D66239447

fbshipit-source-id: 6d496ce0ecae5fe032073c2e6d1ed37d464457a8
  • Loading branch information
dulmarod authored and facebook-github-bot committed Nov 21, 2024
1 parent bef8c76 commit 230a45b
Show file tree
Hide file tree
Showing 317 changed files with 621 additions and 367 deletions.
3 changes: 2 additions & 1 deletion website/checkers.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"all-checkers", "all-categories", "all-issue-types",
"checker-annotation-reachability", "checker-biabduction",
"checker-bufferoverrun", "checker-config-impact-analysis",
"checker-cost", "checker-fragment-retains-view", "checker-impurity",
"checker-cost", "checker-dispatch-once-static-init",
"checker-fragment-retains-view", "checker-impurity",
"checker-inefficient-keyset-iterator", "checker-lineage",
"checker-litho-required-props", "checker-liveness",
"checker-loop-hoisting", "checker-parameter-not-null-checked",
Expand Down
2 changes: 2 additions & 0 deletions website/docs/all-categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Concurrent accesses to the same resource conflict in a way that can give incorre

Issue types in this category:
- [DEADLOCK](/docs/next/all-issue-types#deadlock)
- [DISPATCH_ONCE_IN_STATIC_INIT](/docs/next/all-issue-types#dispatch_once_in_static_init)
- [GUARDEDBY_VIOLATION](/docs/next/all-issue-types#guardedby_violation)
- [INTERFACE_NOT_THREAD_SAFE](/docs/next/all-issue-types#interface_not_thread_safe)
- [LOCK_CONSISTENCY_VIOLATION](/docs/next/all-issue-types#lock_consistency_violation)
Expand All @@ -32,6 +33,7 @@ Issue types in this category:
- [CXX_STRING_CAPTURED_IN_BLOCK](/docs/next/all-issue-types#cxx_string_captured_in_block)
- [NIL_MESSAGING_TO_NON_POD](/docs/next/all-issue-types#nil_messaging_to_non_pod)
- [NIL_MESSAGING_TO_NON_POD_LATENT](/docs/next/all-issue-types#nil_messaging_to_non_pod_latent)
- [NSSTRING_INTERNAL_PTR_CAPTURED_IN_BLOCK](/docs/next/all-issue-types#nsstring_internal_ptr_captured_in_block)
- [PULSE_REFERENCE_STABILITY](/docs/next/all-issue-types#pulse_reference_stability)
- [PULSE_UNINITIALIZED_VALUE](/docs/next/all-issue-types#pulse_uninitialized_value)
- [STACK_VARIABLE_ADDRESS_ESCAPE](/docs/next/all-issue-types#stack_variable_address_escape)
Expand Down
8 changes: 7 additions & 1 deletion website/docs/all-checkers.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Here is an overview of the checkers currently available in Infer.

## Annotation Reachability

Given pairs of source and sink annotations, e.g. `@A` and `@B`, this checker will warn whenever some method annotated with `@A` calls, directly or indirectly, another method annotated with `@B`. Besides the custom pairs, it is also possible to enable some built-in checks, such as `@PerformanceCritical` reaching `@Expensive` or `@NoAllocation` reaching `new`. See flags starting with `--annotation-reachability`.
Given pairs of source and sink annotations, e.g. `@A` and `@B`, this checker will warn whenever some method annotated with `@A` calls, directly or indirectly, another method annotated with `@B`. Besides the custom pairs, it is also possible to enable some built-in checks, such as `@PerformanceCritical` reaching `@Expensive` or `@NoAllocation` reaching `new`. It is also possible to model methods as if they were annotated, using regular expressions. This should also work in languages where there are no annotations. See flags starting with `--annotation-reachability`.

[Visit here for more information.](/docs/next/checker-annotation-reachability)

Expand Down Expand Up @@ -37,6 +37,12 @@ Computes the asymptotic complexity of functions with respect to execution cost o

[Visit here for more information.](/docs/next/checker-cost)

## dispatch-once in static init

Detect if dispatch_once is called from a static constructor.

[Visit here for more information.](/docs/next/checker-dispatch-once-static-init)

## Fragment Retains View

Detects when Android fragments are not explicitly nullified before becoming unreachable.
Expand Down
73 changes: 64 additions & 9 deletions website/docs/all-issue-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,25 +554,21 @@ dereferences it later.
*Category: [Memory error](/docs/next/all-categories#memory-error). Reported as "C++ String Captured in Block" by [self-in-block](/docs/next/checker-self-in-block).*
This check flags when a local variable of type `std::string` is captured in an escaping block.
This check flags when an internal pointer of a local variable of type `std::string` is captured in an escaping block.
This means that the block will be leaving the current scope, i.e. it is
not annotated with `__attribute__((noescape))`.
Example:
```
- (void)string_captured_in_escaping_block_bad {
std::string fullName;
const char* c = fullName.c_str();
dispatch_async(dispatch_get_main_queue(), ^{
const char* c = fullName.c_str();
...
const char* c1 = c;
});
...;
}
```
This could cause crashes because the variable is likely to be freed if the block
uses it later.
This could cause crashes because the variable is likely to be freed when the code is executed, leaving the pointer dangling.
## DANGLING_POINTER_DEREFERENCE
Expand Down Expand Up @@ -656,6 +652,11 @@ To suppress reports of deadlocks in a method `m()` use the
This error is reported in C++. It fires when the value assigned to a variables
is never used (e.g., `int i = 1; i = 2; return i;`).
## DISPATCH_ONCE_IN_STATIC_INIT
*Category: [Concurrency](/docs/next/all-categories#concurrency). Reported as "dispatch_once in static init" by [dispatch-once-static-init](/docs/next/checker-dispatch-once-static-init).*
Calling dispatch_once during the static initialization of objects is risky, for example it could cause deadlocks, because other objects might not have been initialized yet.
## DIVIDE_BY_ZERO
*Reported as "Divide By Zero" by [biabduction](/docs/next/checker-biabduction).*
Expand Down Expand Up @@ -1494,6 +1495,26 @@ sign(X) ->
*Category: [Runtime exception](/docs/next/all-categories#runtime-exception). Reported as "No True Branch In If Latent" by [pulse](/docs/next/checker-pulse).*

A latent [NO_TRUE_BRANCH_IN_IF](#no_true_branch_in_if). See the [documentation on Pulse latent issues](/docs/next/checker-pulse#latent-issues).
## NSSTRING_INTERNAL_PTR_CAPTURED_IN_BLOCK

*Category: [Memory error](/docs/next/all-categories#memory-error). Reported as "NSString Captured in Block" by [self-in-block](/docs/next/checker-self-in-block).*

This check flags when an internal pointer of a local variable of type `std::string` is captured in an escaping block.
This means that the block will be leaving the current scope, i.e. it is
not annotated with `__attribute__((noescape))`.

Example:

```
std::string fullName;
const char* c = fullName.c_str();
dispatch_async(dispatch_get_main_queue(), ^{
const char* c1 = c;
});
```

This could cause crashes because the variable is likely to be freed when the code is executed, leaving the pointer dangling.

## NULLPTR_DEREFERENCE

*Category: [Null pointer dereference](/docs/next/all-categories#null-pointer-dereference). Reported as "Null Dereference" by [pulse](/docs/next/checker-pulse).*
Expand Down Expand Up @@ -2013,7 +2034,41 @@ Failure to `await` an `Awaitable` can lead to non-deterministic amount of the as

*Category: [Resource leak](/docs/next/all-categories#resource-leak). Reported as "Unfinished Builder" by [pulse](/docs/next/checker-pulse).*

See [RESOURCE_LEAK](#resource_leak)
Classes adhering to builder pattern are usually expected to call a finalizer function at some point to produce final result based on values that were passed to a builder itself. If finalizer function hasn't been called then builder's data won't be consumed in any meaningful way and will just be discarded.

```hack
class MyBuilder {
private int $a = 0;
private int $b = 0;

public function setA(int $a): MyBuilder {
$this->a = $a;
return $this;
}

public function setB(int $b): MyBuilder {
$this->b = $b;
return $this;
}

public function saveX(): Awaitable<void> {
// typically do something involving IO
}
}

class BuilderTester {
public static function builderUserOK(): void {
$b = new MyBuilder(0);
$b->setA(42)->setB(97)->saveX();
}

public static function builderUserBad(): void {
$b = new MyBuilder(0);
$b->setA(42)->setB(97); // ERROR: saveX hasn't been called so the builder's data is discarded
}
}
```

## PULSE_UNINITIALIZED_CONST

*Category: [Runtime exception](/docs/next/all-categories#runtime-exception). Reported as "Uninitialized Const" by [pulse](/docs/next/checker-pulse).*
Expand Down
8 changes: 4 additions & 4 deletions website/docs/checker-annotation-reachability.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: "Annotation Reachability"
description: "Given pairs of source and sink annotations, e.g. `@A` and `@B`, this checker will warn whenever some method annotated with `@A` calls, directly or indirectly, another method annotated with `@B`. Besides the custom pairs, it is also possible to enable some built-in checks, such as `@PerformanceCritical` reaching `@Expensive` or `@NoAllocation` reaching `new`. See flags starting with `--annotation-reachability`."
description: "Given pairs of source and sink annotations, e.g. `@A` and `@B`, this checker will warn whenever some method annotated with `@A` calls, directly or indirectly, another method annotated with `@B`. Besides the custom pairs, it is also possible to enable some built-in checks, such as `@PerformanceCritical` reaching `@Expensive` or `@NoAllocation` reaching `new`. It is also possible to model methods as if they were annotated, using regular expressions. This should also work in languages where there are no annotations. See flags starting with `--annotation-reachability`."
---

Given pairs of source and sink annotations, e.g. `@A` and `@B`, this checker will warn whenever some method annotated with `@A` calls, directly or indirectly, another method annotated with `@B`. Besides the custom pairs, it is also possible to enable some built-in checks, such as `@PerformanceCritical` reaching `@Expensive` or `@NoAllocation` reaching `new`. See flags starting with `--annotation-reachability`.
Given pairs of source and sink annotations, e.g. `@A` and `@B`, this checker will warn whenever some method annotated with `@A` calls, directly or indirectly, another method annotated with `@B`. Besides the custom pairs, it is also possible to enable some built-in checks, such as `@PerformanceCritical` reaching `@Expensive` or `@NoAllocation` reaching `new`. It is also possible to model methods as if they were annotated, using regular expressions. This should also work in languages where there are no annotations. See flags starting with `--annotation-reachability`.

Activate with `--annotation-reachability`.

Supported languages:
- C/C++/ObjC: No
- C/C++/ObjC: Yes
- C#/.Net: No
- Erlang: No
- Erlang: Yes
- Hack: No
- Java: Yes
- Python: No
Expand Down
23 changes: 23 additions & 0 deletions website/docs/checker-dispatch-once-static-init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "dispatch-once in static init"
description: "Detect if dispatch_once is called from a static constructor."
---

Detect if dispatch_once is called from a static constructor.

Activate with `--dispatch-once-static-init`.

Supported languages:
- C/C++/ObjC: Yes
- C#/.Net: No
- Erlang: No
- Hack: No
- Java: No
- Python: No



## List of Issue Types

The following issue types are reported by this checker:
- [DISPATCH_ONCE_IN_STATIC_INIT](/docs/next/all-issue-types#dispatch_once_in_static_init)
1 change: 1 addition & 0 deletions website/docs/checker-self-in-block.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The following issue types are reported by this checker:
- [CXX_STRING_CAPTURED_IN_BLOCK](/docs/next/all-issue-types#cxx_string_captured_in_block)
- [MIXED_SELF_WEAKSELF](/docs/next/all-issue-types#mixed_self_weakself)
- [MULTIPLE_WEAKSELF](/docs/next/all-issue-types#multiple_weakself)
- [NSSTRING_INTERNAL_PTR_CAPTURED_IN_BLOCK](/docs/next/all-issue-types#nsstring_internal_ptr_captured_in_block)
- [SELF_IN_BLOCK_PASSED_TO_INIT](/docs/next/all-issue-types#self_in_block_passed_to_init)
- [STRONG_SELF_NOT_CHECKED](/docs/next/all-issue-types#strong_self_not_checked)
- [WEAK_SELF_IN_NO_ESCAPE_BLOCK](/docs/next/all-issue-types#weak_self_in_no_escape_block)
69 changes: 66 additions & 3 deletions website/static/man/next/infer-analyze.1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions website/static/man/next/infer-report.1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 230a45b

Please sign in to comment.