Repository Analysis

facebook/watchman

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

3.6 Likely human-written View on GitHub
3.6
Adjusted Score
3.6
Raw Score
100%
Time Factor
2026-05-30
Last Push
13,594
Stars
C++
Language
95,675
Lines of Code
584
Files
279
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 3MEDIUM 25LOW 251

Pattern Findings

279 matches across 9 categories. Click a row to expand file-level details.

Over-Commented Block153 hits · 150 pts
SeverityFileLineSnippet
LOWCMakeLists.txt61# Determine whether we are the git repo produced by shipit, a staging
LOWrun-tests.sh1#!/bin/bash -e
LOWinstall-system-packages.sh1#!/bin/bash -e
LOWwatchman/PathUtils.cpp1/*
LOWwatchman/XattrUtils.cpp21// The following are lifted from sys/acl.h and inlined to avoid that
LOWwatchman/XattrUtils.cpp41
LOWwatchman/watchman_string.h81
LOWwatchman/ChildProcess.h1/*
LOWwatchman/ChildProcess.h161 // If stdin is a pipe and stdout and stderr aren't, then it's safe to extract
LOWwatchman/bser.cpp21
LOWwatchman/PerfSample.cpp1/*
LOWwatchman/LRUCache.h221 // This owns the nodes in the map
LOWwatchman/LRUCache.h361 // If the key is present and satisfied, return a Future that will
LOWwatchman/Client.cpp1/*
LOWwatchman/Logging.cpp261 // msvcrt abort() ultimately calls exit(3), so we shortcut that.
LOWwatchman/ThreadPool.h21// tasks that are executed in the thread pool. Contrast with
LOWwatchman/watchman_system.h1/*
LOWwatchman/watchman_system.h21// is included before this header, so we pull it in early.
LOWwatchman/watchman_system.h41#include <errno.h>
LOWwatchman/watchman_system.h61#define STDOUT_FILENO 1
LOWwatchman/watchman_system.h81#define WATCHMAN_BUILD_INFO BuildInfo_kUpstreamRevision
LOWwatchman/watchman_system.h101#include <grp.h>
LOWwatchman/watchman_system.h121#ifdef HAVE_EXECINFO_H
LOWwatchman/watchman_system.h141 (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ >= 5)) && \
LOWwatchman/watchman_system.h161// configuration. These are helpers to make this work
LOWwatchman/watchman_system.h201 } while (0)
LOWwatchman/ProcessLock.cpp61 "Failed to lock pidfile {}: process {} owns it: {}, and my pid = {}",
LOWwatchman/ProcessLock.cpp81 // for the name.
LOWwatchman/state.cpp1/*
LOWwatchman/ContentHash.cpp1/*
LOWwatchman/Errors.h61}
LOWwatchman/string.cpp1/*
LOWwatchman/TriggerCommand.cpp1/*
LOWwatchman/Logging.h161 __FILE__, \
LOWwatchman/stream_unix.cpp1/*
LOWwatchman/stream_unix.cpp21#ifdef HAVE_SYS_UCRED_H
LOWwatchman/PendingCollection.cpp161}
LOWwatchman/InMemoryView.cpp1/*
LOWwatchman/watchman_preprocessor.h1/*
LOWwatchman/watchman_preprocessor.h21#endif
LOWwatchman/watchman_cmd.h21} // namespace watchman
LOWwatchman/listener.cpp1/*
LOWwatchman/listener.cpp21#include "watchman/GroupLookup.h"
LOWwatchman/UserDir.cpp1/*
LOWwatchman/main.cpp1/*
LOWwatchman/main.cpp21
LOWwatchman/main.cpp41#include "watchman/fs/FileSystem.h"
LOWwatchman/main.cpp881
LOWwatchman/InMemoryView.h1/*
LOWwatchman/watcher/kqueue.cpp1/*
LOWwatchman/watcher/win32.cpp1/*
LOWwatchman/watcher/kqueue_and_fsevents.cpp1/*
LOWwatchman/watcher/inotify.cpp1/*
LOWwatchman/watcher/eden.cpp1/*
LOWwatchman/watcher/eden.cpp21#include <thrift/lib/cpp2/async/RocketClientChannel.h>
LOWwatchman/test/PathUtilsTest.cpp1/*
LOWwatchman/test/BserTest.cpp1/*
LOWwatchman/test/run.sh1#!/bin/bash
LOWwatchman/test/FailsToStartViewTest.cpp1/*
LOWwatchman/test/InMemoryViewTest.cpp1/*
93 more matches not shown…
Hyper-Verbose Identifiers54 hits · 54 pts
SeverityFileLineSnippet
LOWwatchman/test/async/test_dead_socket.py33 def test_subscription_dead_socket(self):
LOWwatchman/python/pywatchman_aio/__init__.py217 async def receive_bilateral_response(self):
LOWwatchman/python/pywatchman_aio/__init__.py352 def _ensure_subscription_queue_exists(self, name, root):
LOWwatchman/python/pywatchman_aio/__init__.py357 async def _process_unilateral_response(self, response):
LOWwatchman/python/tests/tests.py101 def test_missing_socket_file_raises_connect_error(self):
LOWwatchman/python/tests/tests.py116 def make_deleted_windows_socket_path(self):
LOWwatchman/python/tests/tests.py119 def make_deleted_unix_socket_path(self):
LOWwatchman/python/pywatchman/__init__.py393def _get_overlapped_result_ex_impl(pipe, olap, nbytes, millis, alertable):
LOWwatchman/integration/test_command.py16 def test_unknown_commands_print_json_error(self) -> None:
LOWwatchman/integration/test_ignore.py46 def test_ignore_overlap_vcs_ignore(self) -> None:
LOWwatchman/integration/test_invalid_expr.py41 def test_invalid_sync_timeout(self) -> None:
LOWwatchman/integration/test_sock_perms.py131 def test_user_not_in_sock_group(self) -> None:
LOWwatchman/integration/test_sock_perms.py163 def test_user_previously_in_sock_group(self) -> None:
LOWwatchman/integration/test_sock_perms.py222 def test_custom_sock_access_group(self) -> None:
LOWwatchman/integration/test_sock_perms.py230 def test_custom_sock_access_others(self) -> None:
LOWwatchman/integration/test_sock_perms.py248 def test_sock_access_downgrade(self) -> None:
LOWwatchman/integration/test_sock_perms.py258 def test_sock_access_group_change(self) -> None:
LOWwatchman/integration/test_sock_perms.py281 def test_sock_access_via_acl_user_not_in_sock_group(self) -> None:
LOWwatchman/integration/test_nice.py22 def test_failing_to_start_when_nice(self) -> None:
LOWwatchman/integration/test_nice.py31 def test_failing_to_start_when_nice_foreground(self) -> None:
LOWwatchman/integration/test_subscribe.py622 def test_subscription_cleanup(self) -> None:
LOWwatchman/integration/test_subscribe.py759 def test_resubscribe_same_name_no_error(self) -> None:
LOWwatchman/integration/test_subscribe.py796 def test_resubscribe_same_name_no_warning(self) -> None:
LOWwatchman/integration/test_subscribe.py836 def test_multi_client_same_name(self) -> None:
LOWwatchman/integration/test_watch_project.py17def make_empty_watchmanconfig(dir) -> None:
LOWwatchman/integration/test_glob.py162 def test_glob_generator_empty(self) -> None:
LOWwatchman/integration/test_glob.py173 def test_glob_generator_absolute(self) -> None:
LOWwatchman/integration/test_path_generator.py60 def test_path_generator_relative_root(self) -> None:
LOWwatchman/integration/test_path_generator.py103 def test_path_generator_empty(self) -> None:
LOWwatchman/integration/test_suffix_generator.py60 def test_suffix_generator_empty(self) -> None:
LOWwatchman/integration/eden/test_eden_since.py58 def test_eden_empty_relative_root(self) -> None:
LOWwatchman/integration/eden/test_eden_since.py255 def test_eden_since_across_update(self) -> None:
LOWwatchman/integration/eden/test_eden_since.py296 def test_eden_since_over_threshold(self) -> None:
LOWwatchman/integration/eden/test_eden_since.py356 def test_eden_since_dotfiles_change(self) -> None:
LOWwatchman/integration/eden/test_eden_since.py386 def test_eden_since_fresh_instance_dotfiles(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py44 def test_eden_since_upper_bound(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py91 def test_eden_since_empty_upper_bound(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py116 def test_eden_since_upper_bound_case_insensitive(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py146 def test_eden_since_upper_bound_includedotfiles(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py176 def test_eden_since_upper_bound_name_escaping(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py203 def test_eden_since_upper_bound_name_normalization(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py228 def test_eden_since_upper_bound_name_set_normalization(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py255 def test_eden_since_upper_bound_match_noescape(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py279 def test_eden_since_upper_bound_match_escape(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py303 def test_eden_since_upper_bound_dirname_escaping(self) -> None:
LOWwatchman/integration/eden/test_eden_glob_upper_bound.py326 def test_eden_since_upper_bound_match_complex_pattern(self) -> None:
LOWwatchman/integration/eden/test_eden_journal.py103 def test_two_rapid_checkouts_show_briefly_changed_files(self) -> None:
LOWwatchman/integration/eden/test_eden_journal.py160 def test_aba_checkouts_show_briefly_changed_files(self) -> None:
LOWwatchman/integration/eden/test_eden_journal.py213 def test_querying_with_truncated_journal_returns_fresh_instance(self) -> None:
LOWwatchman/integration/eden/test_eden_pathgen.py291 def test_path_and_glob_dotfiles(self):
LOWwatchman/integration/eden/test_eden_shutdown.py13 def test_shutdown_and_restart(self) -> None:
LOWwatchman/integration/lib/path_utils.py32 def get_canonical_filesystem_path(name):
LOWwatchman/integration/lib/path_utils.py63 def get_canonical_filesystem_path(name):
LOWwatchman/integration/lib/path_utils.py75 def get_canonical_filesystem_path(name):
Self-Referential Comments14 hits · 42 pts
SeverityFileLineSnippet
MEDIUMwatchman/python/tests/tests.py141 # Define a new class that derives from the input class
MEDIUMwatchman/integration/test_big.py21 # Create a huge query. We're shooting for more than 2MB; the server buffer
MEDIUMwatchman/integration/test_subscribe.py734 # Create a subscription
MEDIUMwatchman/integration/test_subscribe.py768 # Create a subscription
MEDIUMwatchman/integration/test_subscribe.py783 # Create a new subscription with the same name
MEDIUMwatchman/integration/test_subscribe.py805 # Create a subscription
MEDIUMwatchman/integration/test_subscribe.py820 # Create a new subscription with the same name
MEDIUMwatchman/integration/test_subscribe.py848 # Create a subscription
MEDIUMwatchman/integration/test_subscribe.py860 # Create a new subscription with the same name from a different client,
MEDIUMwatchman/integration/test_subscribe.py909 # Create a subscription
MEDIUMwatchman/integration/test_since.py27 # Create a cursor for this state
MEDIUMwatchman/integration/test_nodejs.py45 # Define a new class that derives from the input class.
MEDIUMwatchman/integration/eden/test_eden_pathgen.py68 # Create the file that we want to remove
MEDIUMwatchman/integration/lib/WatchmanTestCase.py563 # Define a new class that derives from the input class
Excessive Try-Catch Wrapping27 hits · 33 pts
SeverityFileLineSnippet
LOWwatchman/runtests.py52except Exception:
LOWwatchman/runtests.py457 except Exception as e:
LOWwatchman/runtests.py478 except Exception as exc:
LOWwatchman/runtests.py486 except Exception:
LOWwatchman/runtests.py497 except Exception as e:
LOWwatchman/runtests.py517 except Exception as e:
LOWwatchman/python/pywatchman_aio/__init__.py285 except Exception as ex:
LOWwatchman/python/pywatchman_aio/__init__.py324 except Exception as ex:
MEDIUMwatchman/python/pywatchman_aio/__init__.py280def do_if_done(fut):
LOWwatchman/python/tests/tests.py96 except Exception as e:
LOWwatchman/python/tests/tests.py438 except Exception:
MEDIUMwatchman/python/tests/tests.py45def test_exception_handling(self):
LOWwatchman/python/pywatchman/__init__.py378 except Exception as e:
LOWwatchman/python/pywatchman/__init__.py826 except Exception as e:
MEDIUMwatchman/python/pywatchman/__init__.py302def readBytes(self, size):
LOWwatchman/integration/test_local_saved_state.py21 except Exception:
MEDIUMwatchman/integration/test_local_saved_state.py16def is_ubuntu() -> bool:
MEDIUMwatchman/integration/test_fork.py40 print("Error in child process: %s" % exc)
LOWwatchman/integration/test_sock_perms.py68 except Exception:
LOWwatchman/integration/test_scm.py22 except Exception:
MEDIUMwatchman/integration/test_scm.py17def is_ubuntu() -> bool:
LOWwatchman/integration/test_trigger_chdir.py41 except Exception:
LOWwatchman/integration/lib/WatchmanTestCase.py161 except Exception:
LOWwatchman/integration/lib/WatchmanTestCase.py194 except Exception:
LOWwatchman/integration/lib/WatchmanTestCase.py263 except Exception:
LOWwatchman/integration/lib/WatchmanSCMTestCase.py68 except Exception as e:
LOWwatchman/integration/lib/WatchmanEdenTestCase.py105 except Exception:
Cross-Language Confusion3 hits · 18 pts
SeverityFileLineSnippet
HIGHwatchman/integration/test_fishy.py37 "mv foo bar && ln -s bar foo",
HIGHwatchman/integration/test_fishy.py57 "touch a && mkdir d1 d2 && mv d1 d2 && mv d2/d1 . && mv a d1",
HIGHwatchman/integration/lib/WatchmanInstance.py238 # pyre-fixme[61]: `val` is undefined, or not always defined.
Verbosity Indicators8 hits · 16 pts
SeverityFileLineSnippet
LOWwatchman/LRUCache.h364 // The purpose of this function is to reduce the exposure to
LOWwatchman/rust/watchman_client/src/lib.rs658 // Step 1: serialize into a bser byte buffer
LOWwatchman/rust/watchman_client/src/lib.rs666 // Step 2: ask the client task to send it for us
LOWwatchman/rust/watchman_client/src/lib.rs676 // Step 3: wait for the client task to give us the response
LOWwatchman/rust/watchman_client/src/lib.rs682 // Step 4: sniff for an error response in the deserialized data
LOWwatchman/rust/watchman_client/src/lib.rs690 // Step 5: deserialize into the caller-desired format
LOWwatchman/root/iothread.cpp704 // Step 1: Process readDir results.
LOWwatchman/root/iothread.cpp768 // Step 2: Handle errors.
Deep Nesting14 hits · 14 pts
SeverityFileLineSnippet
LOWwatchman/runtests.py297
LOWwatchman/runtests.py439
LOWwatchman/python/pywatchman/pybser.py47
LOWwatchman/python/pywatchman/pybser.py94
LOWwatchman/python/pywatchman/pybser.py110
LOWwatchman/python/pywatchman/pybser.py161
LOWwatchman/python/pywatchman/pybser.py307
LOWwatchman/python/pywatchman/pybser.py413
LOWwatchman/python/pywatchman/__init__.py393
LOWwatchman/python/pywatchman/__init__.py856
LOWwatchman/integration/test_restrictions.py30
LOWwatchman/integration/test_watch_project.py24
LOWwatchman/integration/test_trigger.py71
LOWwatchman/integration/test_trigger.py75
AI Slop Vocabulary4 hits · 10 pts
SeverityFileLineSnippet
MEDIUMwatchman/IgnoreSet.cpp63 // Definitely ignoring this portion of the tree
MEDIUMwatchman/python/pywatchman/__init__.py602 # The test harness sets WATCHMAN_BINARY to the binary under test,
LOWwatchman/integration/test_saved_state.py19 # This test does not require much so just create a super simple repo
MEDIUMwatchman/query/dirname.cpp152 // We could leverage the depth parameter to generate a depth bound, e.g. `*`
Decorative Section Separators2 hits · 6 pts
SeverityFileLineSnippet
MEDIUMwatchman/python/publish-pypi.sh8# ===============================
MEDIUMwatchman/python/publish-pypi.sh10# ===============================