CodeAnt AI home pagelight logodark logo
  • Support
  • Dashboard
  • Dashboard
Documentation
API Reference
Start Here
  • What is CodeAnt?
  • Join Community
Setup
  • Github
  • Bitbucket
  • Gitlab
  • Azure Devops
Pull Request Review
  • Features
  • Customize Review
  • Quality Gates
  • Integrations
Scan center
  • Code Security
  • Code Quality
  • Cloud Security
  • Engineering Productivity
Integrations
  • Jira
  • Test Coverage
  • CI/CD
IDE
  • Setup
  • Review
  • Enhancements
Rule Reference
  • 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
      • Lang
        • Best practice
        • Compatibility
        • Correctness
        • Performance
        • Portability
        • Security
    • Php
    • Problem-based-packs
    • Python
    • Ruby
    • Rust
    • Scala
    • Solidity
    • Swift
    • Terraform
    • Typescript
    • Yaml
Resources
  • Open Source
  • Blogs
Lang

Best practice

ocamllint-bool-true

Comparison to boolean. Just use $X

ocamllint-bool-false

Comparison to boolean. Just use not $X

ocamllint-str-first-chars

Use instead Str.first_chars

ocamllint-str-string-after

Use instead Str.string_after

ocamllint-str-last-chars

Use instead Str.last_chars

ocamllint-useless-sprintf

Useless sprintf

bad-reraise

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’.

ocamllint-useless-else

Useless else. Just remove the else branch;

ocamllint-backwards-if

Backwards if. Rewrite the code as ‘if not EthenE then EthenE2’.

hashtbl-find-outside-try

You should not use Hashtbl.find outside of a try, or you should use Hashtbl.find_opt

list-find-outside-try

You should not use List.find outside of a try, or you should use List.find_opt

ocamllint-ref-incr

You should use incr

ocamllint-ref-decr

You should use decr
Xmlreader xxeCompatibility
twitterlinkedin
Powered by Mintlify
Assistant
Responses are generated using AI and may contain mistakes.