Get Started
- CodeAnt AI
- Control Center
- Pull Request Review
- IDE
- Compliance
- Anti-Patterns
- Code Governance
- Infrastructure Security Database
- Application Security Database
- Apex
- Bash
- C
- Clojure
- Cpp
- Csharp
- Dockerfile
- Elixir
- Fingerprints
- Generic
- Go
- Html
- Java
- Javascript
- Json
- Kotlin
- Ocaml
- Php
- Problem-based-packs
- Python
- Ruby
- Rust
- Scala
- Solidity
- Swift
- Terraform
- Typescript
- Yaml
Best practice
Comparison to boolean. Just use $X
Comparison to boolean. Just use not $X
Use instead Str.first_chars
Use instead Str.string_after
Use instead Str.last_chars
Useless sprintf
You should not re-raise exceptions using ‘raise’ because it loses track of where the exception was raised originally, leading to a useless and possibly confusing stack trace. Instead, you should obtain a stack backtrace as soon as the exception is caught using ‘try … with exn -> let trace = Printexc.get_raw_backtrace () in …’, and keep it around until you re-raise the exception using ‘Printexc.raise_with_backtrace exn trace’. You must collect the stack backtrace before calling another function which might internally raise and catch exceptions. To avoid false positives from Semgrep, write ‘raise (Foo args)’ instead of ‘let e = Foo args in raise e’.
Useless else. Just remove the else branch;
Backwards if. Rewrite the code as ‘if not EthenE2’.
You should not use Hashtbl.find outside of a try, or you should use Hashtbl.find_opt
You should not use List.find outside of a try, or you should use List.find_opt
You should use incr
You should use decr