Repository Analysis

facebook/watchman

Watches files and records, or triggers actions, when they change.

3.8 Likely human-written View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of facebook/watchman, a C++ project with 13,646 GitHub stars. SynthScan v2.0 examined 96,058 lines of code across 585 source files, recording 290 pattern matches distributed across 13 syntactic categories. The overall adjusted score of 3.8 places this repository in the Likely human-written band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

3.8
Adjusted Score
3.8
Raw Score
100%
Time Factor
2026-07-13
Last Push
13.6K
Stars
C++
Language
96.1K
Lines of Code
585
Files
290
Pattern Hits
2026-07-14
Scan Date
0.01
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 3MEDIUM 25LOW 262

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 290 distinct pattern matches across 13 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Over-Commented Block152 hits · 148 pts
SeverityFileLineSnippetContext
LOWCMakeLists.txt61# Determine whether we are the git repo produced by shipit, a stagingCOMMENT
LOWrun-tests.sh1#!/bin/bash -eCOMMENT
LOWinstall-system-packages.sh1#!/bin/bash -eCOMMENT
LOWwatchman/PathUtils.cpp1/*COMMENT
LOWwatchman/XattrUtils.cpp21// The following are lifted from sys/acl.h and inlined to avoid thatCOMMENT
LOWwatchman/XattrUtils.cpp41COMMENT
LOWwatchman/watchman_string.h81COMMENT
LOWwatchman/ChildProcess.h1/*COMMENT
LOWwatchman/ChildProcess.h161 // If stdin is a pipe and stdout and stderr aren't, then it's safe to extractCOMMENT
LOWwatchman/bser.cpp21COMMENT
LOWwatchman/PerfSample.cpp1/*COMMENT
LOWwatchman/LRUCache.h221 // This owns the nodes in the mapCOMMENT
LOWwatchman/LRUCache.h361 // If the key is present and satisfied, return a Future that willCOMMENT
LOWwatchman/Client.cpp1/*COMMENT
LOWwatchman/Logging.cpp261 // msvcrt abort() ultimately calls exit(3), so we shortcut that.COMMENT
LOWwatchman/ThreadPool.h21// tasks that are executed in the thread pool. Contrast withCOMMENT
LOWwatchman/watchman_system.h1/*COMMENT
LOWwatchman/watchman_system.h21// is included before this header, so we pull it in early.COMMENT
LOWwatchman/watchman_system.h41#include <errno.h>COMMENT
LOWwatchman/watchman_system.h61#define STDOUT_FILENO 1COMMENT
LOWwatchman/watchman_system.h81#define WATCHMAN_BUILD_INFO BuildInfo_kUpstreamRevisionCOMMENT
LOWwatchman/watchman_system.h101#include <grp.h>COMMENT
LOWwatchman/watchman_system.h121#ifdef HAVE_EXECINFO_HCOMMENT
LOWwatchman/watchman_system.h141 (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ >= 5)) && \COMMENT
LOWwatchman/watchman_system.h161// configuration. These are helpers to make this workCOMMENT
LOWwatchman/watchman_system.h201 } while (0)COMMENT
LOWwatchman/ProcessLock.cpp61 "Failed to lock pidfile {}: process {} owns it: {}, and my pid = {}",COMMENT
LOWwatchman/ProcessLock.cpp81 // for the name.COMMENT
LOWwatchman/state.cpp1/*COMMENT
LOWwatchman/ContentHash.cpp1/*COMMENT
LOWwatchman/Errors.h61}COMMENT
LOWwatchman/string.cpp1/*COMMENT
LOWwatchman/TriggerCommand.cpp1/*COMMENT
LOWwatchman/Logging.h161 __FILE__, \COMMENT
LOWwatchman/stream_unix.cpp1/*COMMENT
LOWwatchman/stream_unix.cpp21#ifdef HAVE_SYS_UCRED_HCOMMENT
LOWwatchman/PendingCollection.cpp161}COMMENT
LOWwatchman/InMemoryView.cpp1/*COMMENT
LOWwatchman/watchman_preprocessor.h1/*COMMENT
LOWwatchman/watchman_preprocessor.h21#endifCOMMENT
LOWwatchman/watchman_cmd.h21} // namespace watchmanCOMMENT
LOWwatchman/listener.cpp1/*COMMENT
LOWwatchman/listener.cpp21#include "watchman/GroupLookup.h"COMMENT
LOWwatchman/UserDir.cpp1/*COMMENT
LOWwatchman/main.cpp1/*COMMENT
LOWwatchman/main.cpp21COMMENT
LOWwatchman/main.cpp41#include "watchman/fs/FileSystem.h"COMMENT
LOWwatchman/main.cpp881COMMENT
LOWwatchman/InMemoryView.h1/*COMMENT
LOWwatchman/watcher/kqueue.cpp1/*COMMENT
LOWwatchman/watcher/win32.cpp1/*COMMENT
LOWwatchman/watcher/kqueue_and_fsevents.cpp1/*COMMENT
LOWwatchman/watcher/inotify.cpp1/*COMMENT
LOWwatchman/watcher/eden.cpp1/*COMMENT
LOWwatchman/watcher/eden.cpp21#include <thrift/lib/cpp2/async/RocketClientChannel.h>COMMENT
LOWwatchman/test/PathUtilsTest.cpp1/*COMMENT
LOWwatchman/test/BserTest.cpp1/*COMMENT
LOWwatchman/test/run.sh1#!/bin/bashCOMMENT
LOWwatchman/test/FailsToStartViewTest.cpp1/*COMMENT
LOWwatchman/test/InMemoryViewTest.cpp1/*COMMENT
92 more matches not shown…
Hyper-Verbose Identifiers54 hits · 54 pts
SeverityFileLineSnippetContext
LOWwatchman/test/async/test_dead_socket.py33 def test_subscription_dead_socket(self):CODE
LOWwatchman/python/pywatchman_aio/__init__.py218 async def receive_bilateral_response(self):CODE
LOWwatchman/python/pywatchman_aio/__init__.py353 def _ensure_subscription_queue_exists(self, name, root):CODE
LOWwatchman/python/pywatchman_aio/__init__.py358 async def _process_unilateral_response(self, response):CODE
LOWwatchman/python/tests/tests.py101 def test_missing_socket_file_raises_connect_error(self):CODE
LOWwatchman/python/tests/tests.py116 def make_deleted_windows_socket_path(self):CODE
LOWwatchman/python/tests/tests.py119 def make_deleted_unix_socket_path(self):CODE
LOWwatchman/python/pywatchman/__init__.py395def _get_overlapped_result_ex_impl(pipe, olap, nbytes, millis, alertable):CODE
LOWwatchman/integration/test_command.py16 def test_unknown_commands_print_json_error(self) -> None:CODE
LOWwatchman/integration/test_ignore.py46 def test_ignore_overlap_vcs_ignore(self) -> None:CODE
LOWwatchman/integration/test_invalid_expr.py41 def test_invalid_sync_timeout(self) -> None:CODE
LOWwatchman/integration/test_sock_perms.py131 def test_user_not_in_sock_group(self) -> None:CODE
LOWwatchman/integration/test_sock_perms.py163 def test_user_previously_in_sock_group(self) -> None:CODE
LOWwatchman/integration/test_sock_perms.py222 def test_custom_sock_access_group(self) -> None:CODE
LOWwatchman/integration/test_sock_perms.py230 def test_custom_sock_access_others(self) -> None:CODE
LOWwatchman/integration/test_sock_perms.py248 def test_sock_access_downgrade(self) -> None:CODE
LOWwatchman/integration/test_sock_perms.py258 def test_sock_access_group_change(self) -> None:CODE
LOWwatchman/integration/test_sock_perms.py281 def test_sock_access_via_acl_user_not_in_sock_group(self) -> None:CODE
LOWwatchman/integration/test_nice.py22 def test_failing_to_start_when_nice(self) -> None:CODE
LOWwatchman/integration/test_nice.py31 def test_failing_to_start_when_nice_foreground(self) -> None:CODE
LOWwatchman/integration/test_subscribe.py656 def test_subscription_cleanup(self) -> None:CODE
LOWwatchman/integration/test_subscribe.py800 def test_resubscribe_same_name_no_error(self) -> None:CODE
LOWwatchman/integration/test_subscribe.py841 def test_resubscribe_same_name_no_warning(self) -> None:CODE
LOWwatchman/integration/test_subscribe.py885 def test_multi_client_same_name(self) -> None:CODE
LOWwatchman/integration/test_watch_project.py17def make_empty_watchmanconfig(dir) -> None:CODE
LOWwatchman/integration/test_glob.py162 def test_glob_generator_empty(self) -> None:CODE
LOWwatchman/integration/test_glob.py173 def test_glob_generator_absolute(self) -> None:CODE
LOWwatchman/integration/test_path_generator.py60 def test_path_generator_relative_root(self) -> None:CODE
LOWwatchman/integration/test_path_generator.py103 def test_path_generator_empty(self) -> None:CODE
LOWwatchman/integration/test_suffix_generator.py60 def test_suffix_generator_empty(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_since.py59 def test_eden_empty_relative_root(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_since.py256 def test_eden_since_across_update(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_since.py297 def test_eden_since_over_threshold(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_since.py357 def test_eden_since_dotfiles_change(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_since.py387 def test_eden_since_fresh_instance_dotfiles(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py45 def test_eden_since_upper_bound(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py92 def test_eden_since_empty_upper_bound(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py117 def test_eden_since_upper_bound_case_insensitive(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py147 def test_eden_since_upper_bound_includedotfiles(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py177 def test_eden_since_upper_bound_name_escaping(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py204 def test_eden_since_upper_bound_name_normalization(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py229 def test_eden_since_upper_bound_name_set_normalization(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py256 def test_eden_since_upper_bound_match_noescape(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py280 def test_eden_since_upper_bound_match_escape(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py304 def test_eden_since_upper_bound_dirname_escaping(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py327 def test_eden_since_upper_bound_match_complex_pattern(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_journal.py104 def test_two_rapid_checkouts_show_briefly_changed_files(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_journal.py161 def test_aba_checkouts_show_briefly_changed_files(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_journal.py214 def test_querying_with_truncated_journal_returns_fresh_instance(self) -> None:CODE
LOWwatchman/integration/eden/test_eden_pathgen.py292 def test_path_and_glob_dotfiles(self):CODE
LOWwatchman/integration/eden/test_eden_shutdown.py14 def test_shutdown_and_restart(self) -> None:CODE
LOWwatchman/integration/lib/path_utils.py32 def get_canonical_filesystem_path(name):CODE
LOWwatchman/integration/lib/path_utils.py63 def get_canonical_filesystem_path(name):CODE
LOWwatchman/integration/lib/path_utils.py75 def get_canonical_filesystem_path(name):CODE
Self-Referential Comments14 hits · 42 pts
SeverityFileLineSnippetContext
MEDIUMwatchman/python/tests/tests.py141 # Define a new class that derives from the input classCOMMENT
MEDIUMwatchman/integration/test_big.py21 # Create a huge query. We're shooting for more than 2MB; the server bufferCOMMENT
MEDIUMwatchman/integration/test_subscribe.py771 # Create a subscriptionCOMMENT
MEDIUMwatchman/integration/test_subscribe.py809 # Create a subscriptionCOMMENT
MEDIUMwatchman/integration/test_subscribe.py826 # Create a new subscription with the same nameCOMMENT
MEDIUMwatchman/integration/test_subscribe.py850 # Create a subscriptionCOMMENT
MEDIUMwatchman/integration/test_subscribe.py867 # Create a new subscription with the same nameCOMMENT
MEDIUMwatchman/integration/test_subscribe.py897 # Create a subscriptionCOMMENT
MEDIUMwatchman/integration/test_subscribe.py911 # Create a new subscription with the same name from a different client,COMMENT
MEDIUMwatchman/integration/test_subscribe.py968 # Create a subscriptionCOMMENT
MEDIUMwatchman/integration/test_since.py27 # Create a cursor for this stateCOMMENT
MEDIUMwatchman/integration/test_nodejs.py45 # Define a new class that derives from the input class.COMMENT
MEDIUMwatchman/integration/eden/test_eden_pathgen.py69 # Create the file that we want to removeCOMMENT
MEDIUMwatchman/integration/lib/WatchmanTestCase.py564 # Define a new class that derives from the input classCOMMENT
Excessive Try-Catch Wrapping27 hits · 33 pts
SeverityFileLineSnippetContext
LOWwatchman/runtests.py52except Exception:CODE
LOWwatchman/runtests.py457 except Exception as e:CODE
LOWwatchman/runtests.py478 except Exception as exc:CODE
LOWwatchman/runtests.py486 except Exception:CODE
LOWwatchman/runtests.py497 except Exception as e:CODE
LOWwatchman/runtests.py517 except Exception as e:CODE
LOWwatchman/python/pywatchman_aio/__init__.py286 except Exception as ex:CODE
LOWwatchman/python/pywatchman_aio/__init__.py325 except Exception as ex:CODE
MEDIUMwatchman/python/pywatchman_aio/__init__.py281def do_if_done(fut):CODE
LOWwatchman/python/tests/tests.py96 except Exception as e:CODE
LOWwatchman/python/tests/tests.py438 except Exception:CODE
MEDIUMwatchman/python/tests/tests.py45def test_exception_handling(self):CODE
LOWwatchman/python/pywatchman/__init__.py380 except Exception as e:CODE
LOWwatchman/python/pywatchman/__init__.py830 except Exception as e:CODE
MEDIUMwatchman/python/pywatchman/__init__.py303def readBytes(self, size):CODE
LOWwatchman/integration/test_local_saved_state.py21 except Exception:CODE
MEDIUMwatchman/integration/test_local_saved_state.py16def is_ubuntu() -> bool:CODE
MEDIUMwatchman/integration/test_fork.py46 print("Error in child process: %s" % exc)CODE
LOWwatchman/integration/test_sock_perms.py68 except Exception:CODE
LOWwatchman/integration/test_scm.py22 except Exception:CODE
MEDIUMwatchman/integration/test_scm.py17def is_ubuntu() -> bool:CODE
LOWwatchman/integration/test_trigger_chdir.py41 except Exception:CODE
LOWwatchman/integration/lib/WatchmanTestCase.py161 except Exception:CODE
LOWwatchman/integration/lib/WatchmanTestCase.py195 except Exception:CODE
LOWwatchman/integration/lib/WatchmanTestCase.py264 except Exception:CODE
LOWwatchman/integration/lib/WatchmanSCMTestCase.py68 except Exception as e:CODE
LOWwatchman/integration/lib/WatchmanEdenTestCase.py106 except Exception:CODE
Cross-Language Confusion3 hits · 18 pts
SeverityFileLineSnippetContext
HIGHwatchman/integration/test_fishy.py37 "mv foo bar && ln -s bar foo",CODE
HIGHwatchman/integration/test_fishy.py57 "touch a && mkdir d1 d2 && mv d1 d2 && mv d2/d1 . && mv a d1",CODE
HIGHwatchman/integration/lib/WatchmanInstance.py246 # pyre-fixme[61]: `val` is undefined, or not always defined.COMMENT
Verbosity Indicators8 hits · 16 pts
SeverityFileLineSnippetContext
LOWwatchman/LRUCache.h364 // The purpose of this function is to reduce the exposure toCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs658 // Step 1: serialize into a bser byte bufferCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs666 // Step 2: ask the client task to send it for usCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs676 // Step 3: wait for the client task to give us the responseCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs682 // Step 4: sniff for an error response in the deserialized dataCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs690 // Step 5: deserialize into the caller-desired formatCOMMENT
LOWwatchman/root/iothread.cpp704 // Step 1: Process readDir results.COMMENT
LOWwatchman/root/iothread.cpp768 // Step 2: Handle errors.COMMENT
Structural Annotation Overuse7 hits · 14 pts
SeverityFileLineSnippetContext
LOWwatchman/rust/watchman_client/src/lib.rs658 // Step 1: serialize into a bser byte bufferCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs666 // Step 2: ask the client task to send it for usCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs676 // Step 3: wait for the client task to give us the responseCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs682 // Step 4: sniff for an error response in the deserialized dataCOMMENT
LOWwatchman/rust/watchman_client/src/lib.rs690 // Step 5: deserialize into the caller-desired formatCOMMENT
LOWwatchman/root/iothread.cpp704 // Step 1: Process readDir results.COMMENT
LOWwatchman/root/iothread.cpp768 // Step 2: Handle errors.COMMENT
Deep Nesting14 hits · 14 pts
SeverityFileLineSnippetContext
LOWwatchman/runtests.py297CODE
LOWwatchman/runtests.py439CODE
LOWwatchman/python/pywatchman/pybser.py47CODE
LOWwatchman/python/pywatchman/pybser.py94CODE
LOWwatchman/python/pywatchman/pybser.py110CODE
LOWwatchman/python/pywatchman/pybser.py161CODE
LOWwatchman/python/pywatchman/pybser.py307CODE
LOWwatchman/python/pywatchman/pybser.py413CODE
LOWwatchman/python/pywatchman/__init__.py395CODE
LOWwatchman/python/pywatchman/__init__.py860CODE
LOWwatchman/integration/test_restrictions.py30CODE
LOWwatchman/integration/test_watch_project.py24CODE
LOWwatchman/integration/test_trigger.py71CODE
LOWwatchman/integration/test_trigger.py75CODE
AI Slop Vocabulary4 hits · 10 pts
SeverityFileLineSnippetContext
MEDIUMwatchman/IgnoreSet.cpp63 // Definitely ignoring this portion of the treeCOMMENT
MEDIUMwatchman/python/pywatchman/__init__.py605 # The test harness sets WATCHMAN_BINARY to the binary under test,COMMENT
LOWwatchman/integration/test_saved_state.py19 # This test does not require much so just create a super simple repoCOMMENT
MEDIUMwatchman/query/dirname.cpp152 // We could leverage the depth parameter to generate a depth bound, e.g. `*`COMMENT
Decorative Section Separators2 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMwatchman/python/publish-pypi.sh8# ===============================COMMENT
MEDIUMwatchman/python/publish-pypi.sh10# ===============================COMMENT
TODO Padding2 hits · 3 pts
SeverityFileLineSnippetContext
LOWwatchman/stream_win.cpp620 // TODO: implement this for WindowsCOMMENT
LOWwatchman/test/lib/FakeFileSystem.cpp173 // TODO: implement strict case checkingCOMMENT
AI Structural Patterns2 hits · 2 pts
SeverityFileLineSnippetContext
LOWwatchman/test/async/AsyncWatchmanTestCase.py52CODE
LOWwatchman/python/pywatchman/__init__.py860CODE
Modern Structural Boilerplate1 hit · 1 pts
SeverityFileLineSnippetContext
LOWwatchman/integration/lib/TempDir.py68 def set_keep(self, value) -> None:CODE