hh_client (1) - Linux Man Pages
hh_client: Interface to Hack language typechecker
SYNOPSIShh_client [MODE] [OPTIONS] [DIRECTORY]
hh_client(1) is an interface to a static analysis tool which is what enforces most of the Hack language's type system. Code must pass validation of this tool in order to be considered valid code in the Hack language.
There are several possible MODEs for hh_client(1) (see below). By default, it will invoke the check mode, with the current directory as DIRECTORY. These are reasonable defaults, meaning that most users can simply invoke the command as
with no arguments to get a list of type errors across the entire project.
All of the MODEs accept a DIRECTORY as an optional final argument. This denotes the project upon which to operate. hh_client(1) walks up the filesystem from the DIRECTORY until it finds a file called .hhconfig and then operates on the body of Hack language code rooted in this directory. If no DIRECTORY is specified, it uses the current directory by default. This means you may run hh_client(1) in any subdirectory of your project and get type errors for the whole project without ever specifying a DIRECTORY explicitly.
The default MODE if none is specified. With no OPTIONS specified, it prints a list of type errors on standard output, or prints "No errors!" if there were none.
Many OPTIONS affect the output of check mode, sometimes causing it to do completely different things. (Those can be considered "sub-modes" of check mode.) Many of these options are undergoing considerable revision and so are not documented here; read the source for a full list.
Widely-useful OPTIONS for check mode include:
- --color FILE
Sub-mode which prints out information on what parts of
are actually typechecked and which are not. Due to Hack's partial mode and PHP
interoperability, the type system may not know the types of parts of a program.
In this case, it trusts the programmer and carries on. The
mode prints out a file with ANSI terminal colors, where green code is actually
fully checked, and red code cannot be fully checked due to such missing type
Prints information about
and its command line options, and then exits. Many of the options described
there are experimental, especially if they are not described in this man
- --from EDITOR
Prints output in the format expected by a specific editor. Valid values of
For usage by other tools, try
Prints output in a JSON format intended for machine consumption, instead of the
output intended for human consumption that is output by default.
- --retries NUM
If the typechecker daemon is busy, try
times to connect to it before giving up. Set
to 0 to disable retries if the server is not immediately available.
Prints human-readable type error information to standard out and then exits.
The default sub-mode of
if none is specified. This output is not intended for usage by tools, but
only for human consumption. For output intended for tool usage, see the
Prints the current client version, including build ID and build date, and
Autocompletes text on STDIN where the cursor is replaced with
Returns a newline-separated list.
- --search STRING
Fuzzy search symbol definitions for
Returns a newline-separated list.
Explicitly starts the hh_server(1) daemon if it is not already running. This is not normally necessary, since check mode will start it as needed if it is not running.
Explicitly stops the hh_server(1) daemon if it is running. This is not normally necessary, since the daemon will exit if it has not been used for an extended period of time.
Explicitly stops and then starts again the hh_server(1) daemon. Fails if the daemon is not currently running. Restarting the daemon is not normally necessary, since it updates its state in the background, and hh_client(1) will restart it automatically if the typechecker binaries have been updated.
For check mode in the --status sub-mode, hh_client(1) returns 0 if there are no type errors, and non-zero otherwise.
Exit statuses for any other invocations are currently undefined and subject to change.
Used in combination with the path to the project root in order to locate the
socket for communicating with the running
daemon. Normally set by your login environment, but may be unset in some
When determining where the project root is in order to figure out what files to
walks up the directory tree from the specified
until it finds this file. The set of files recursively included in the directory
file is the set of files typechecked.
The client looks inside this directory for sockets to communicate with the
daemon. The sockets are named based on a hash of the absolute path of the
BUGSThe Hack language is part of the HHVM project. Known bugs can be found at that tracker, and new ones should be reported there as well: https://github.com/facebook/hhvm/issues
SEE ALSOhh_server(1), hackificator(1), hack_remove_soft_types(1).