Code Judge
this code is ass, session terminated
An editor extension for VS Code and Zed that judges your code while you write it. If the code is ass, it throws away your unsaved changes, shows you a giant red verdict and closes the editor.
And if you type 67 anywhere, it is ass. Immediately. (six seven, sechs sieben, 6 7 and 0x43 too.)

[!WARNING]
This is a joke extension that does exactly what it says. With the default settings it really discards unsaved changes in all open files and quits the editor. Start with the safe mode described below.
Contents
Install in VS Code
- Install it from the Visual Studio Marketplace: search for Code Judge in the Extensions view, or run
code --install-extension djheintzschel.code-judge.
Without the Marketplace: download code-judge-<version>.vsix from the latest release and run Extensions: Install from VSIX... (or code --install-extension code-judge-<version>.vsix).
- Start in safe mode. Open your settings (
Cmd+Shift+P → Preferences: Open User Settings (JSON)) and add:
"codeJudge.action": "messageOnly"
Now Code Judge only shows its verdict and never closes anything.
- Open any file in a supported language. The status bar shows the current score, e.g.
⚖ 2/10. Click it for the full report, or run Code Judge: Judge This File to see the verdict screen (the command never closes anything).
- Type
67 somewhere. After one second the verdict screen appears (in safe mode only once per file, and nothing is closed).
- Arm it: remove the
"codeJudge.action" line again (default is "quit"). From now on, 67 or saving ass code (Cmd+S) discards all unsaved changes and quits VS Code.
Install in Zed
Zed extensions are built from source, so you need Node.js and Rust via rustup.
- Get the code and build the language server:
git clone https://github.com/DJHeintzschel/code-judge.git
cd code-judge
npm install
npm run build:zed
rustup target add wasm32-wasip2
- In Zed open the Command Palette (
Cmd+Shift+P), run zed: install dev extension and pick the folder code-judge/zed. Zed compiles the extension, which takes a moment the first time.
- Start in safe mode. Open the settings (
Cmd+,) and add:
"lsp": {
"code-judge": {
"initialization_options": { "action": "messageOnly" }
}
}
- Open any code file. Findings show up as squiggles and in the problems panel. If the file is ass, line 1 says
THIS CODE IS ASS.
- Type
67. The verdict screen opens in your browser.
- Arm it: remove the
"action": "messageOnly" line and run editor: restart language server. From now on, 67 or saving ass code discards unsaved changes and terminates Zed.
More details, all Zed settings and how it works under the hood: zed/README.md.
Turn it off again
|
VS Code |
Zed |
| Only show the verdict, never close |
"codeJudge.action": "messageOnly" |
"action": "messageOnly" in initialization_options |
| Ignore some languages |
"codeJudge.excludedLanguages": ["yaml"] |
"excludedLanguages": ["yaml"] |
| Disable completely |
Extensions view → Code Judge → Disable |
Extensions view (zed: extensions) → Code Judge → Uninstall |
When is code ass?
67 anywhere in the file means instant ass: in code, in strings, in comments, in 1967 or 0x67. Its variants count too: 0x43 (67 in hex), 6 7, six seven and sechs sieben, also as SixSeven, SIX_SEVEN or six-seven. Lookalikes like 0x431, [5, 6, 7] or sixteen seven do not.
- Otherwise penalty points are added up. From
maxScore points (default 10) on, the code is ass:
| Rule |
Points |
Max |
| Error from a language extension (rust-analyzer, Pylance, ...), VS Code only |
3 each |
unlimited |
| Warning from a language extension, VS Code only |
1 each |
unlimited |
Line longer than maxLineLength (default 120) |
1 each |
5 |
| Nesting too deep (braces or indentation, depending on the language) |
1 per line |
5 |
| Mixed tabs and spaces for indentation |
2 |
2 |
| File longer than 1000 lines |
3 |
3 |
Comment: TODO, FIXME, HACK, XXX |
1 each |
5 |
Comment: desperate (idk, wtf, magic, don't touch, keine Ahnung, quick fix, ...) |
2 each |
6 |
Comment: commented-out code (// x = foo();, # print(x), -- import Data.List) |
1 per line |
6 |
| Comment: more than 60 lines of code with no comments at all |
3 |
3 |
When it strikes: only when you make things worse. A file that was already ass before you touched it (an old 1967 somewhere, a legacy file full of TODOs) can still be edited, improved and saved. The status bar still tells you it is ass.
- While typing: a new
67 ends the session one second after you stop typing. The other rules wait for a save, because half-typed code is often briefly broken.
- On save: if the save adds a
67 or pushes the score to the limit or higher than it was on disk, the code is never written to disk. VS Code swaps the content before the save. Zed cannot be stopped from saving, so Code Judge writes the previous bytes back right after.
- Auto save only counts for a
67; other bad code may be auto saved.
- Never for changes that come from outside (git checkout, git pull, npm install), and never for files over 500 KB (generated code, bundles), notebook cells or other virtual documents.
- Files keep their encoding and line endings: discarding a save restores the exact previous content.
Comments and strings are recognized per language, including the nasty cases: // inside strings, regex literals like /\/\// in JavaScript, nested /* /* */ */ in Rust, Swift and Kotlin, raw strings, Python docstrings, Haskell operators like -->, ${#arr} in shell, Lua [[ ]], LaTeX \%. Doc comments (///, /** */, docstrings) may contain code examples, so they never count as commented-out code.
Languages
54 language groups, 124 language ids, including Rust, Python, Haskell, Java, C/C++, JavaScript, TypeScript, Go, C#, Kotlin, Swift, PHP, Ruby, Shell, SQL, Lua, HTML, CSS and YAML. Config and markup files (YAML, TOML, HTML, CSS, Dockerfile, ...) do not need comments and are not checked for nesting.
All languages
| Language |
Language ids |
| Rust |
rust |
| Python |
python |
| Haskell |
haskell |
| Java |
java |
| C |
c |
| C++ / Objective-C / CUDA / Shader |
cpp, cuda-cpp, objective-c, objective-cpp, hlsl, glsl, shaderlab |
| JavaScript / TypeScript |
javascript, javascriptreact, typescript, typescriptreact |
| Vue / Svelte / Astro |
vue, svelte, astro |
| HTML / XML |
html, xml, xsl, svg |
| CSS |
css |
| SCSS / Less |
scss, less, stylus |
| PHP |
php |
| Go |
go |
| C# |
csharp |
| Kotlin |
kotlin |
| Scala |
scala |
| Groovy |
groovy |
| Swift |
swift |
| Dart |
dart |
| Zig / Odin / V / Gleam / Haxe / Solidity / Verilog / D |
zig, odin, v, gleam, haxe, solidity, verilog, systemverilog, d, apex |
| Protocol Buffers |
proto, proto3 |
| Cython / Mojo / Starlark / GDScript |
cython, mojo, starlark, bazel, gdscript |
| Elm / PureScript / Idris / Agda |
elm, purescript, idris, agda |
| Shell |
shellscript, zsh, bash, fish |
| Ruby |
ruby |
| Crystal |
crystal |
| Perl |
perl, perl6, raku |
| R |
r |
| Julia |
julia |
| Elixir |
elixir |
| Nim |
nim |
| CoffeeScript |
coffeescript |
| PowerShell |
powershell |
| Makefile / CMake |
makefile, cmake |
| Dockerfile |
dockerfile |
| YAML / TOML / INI |
yaml, toml, ini, properties, dotenv |
| GraphQL |
graphql |
| Nix |
nix |
| Terraform / HCL |
terraform, hcl |
| SQL |
sql, plsql, mysql, postgres, pgsql |
| Lua |
lua |
| Ada / VHDL |
ada, vhdl |
| Lisp / Clojure / Scheme / Racket |
clojure, lisp, commonlisp, scheme, racket, fennel, emacs-lisp |
| OCaml / SML |
ocaml, sml, reason |
| F# |
fsharp |
| Pascal / Delphi |
pascal, objectpascal, delphi |
| Erlang |
erlang |
| MATLAB / Octave |
matlab, octave |
| Prolog |
prolog |
| LaTeX |
latex, tex, bibtex |
| Visual Basic |
vb, vba |
| Batch |
bat |
| Fortran |
fortran, fortran-modern, FortranFreeForm, fortran_free-form |
| Assembly |
asm, nasm, arm, riscv, mips |
In Zed the extension registers for the Zed names of these languages. Unknown names fall back to the file extension.
Settings
VS Code (settings.json):
| Setting |
Default |
Meaning |
codeJudge.action |
"quit" |
quit, closeWindow (current window only) or messageOnly |
codeJudge.enabled |
true |
false behaves like messageOnly |
codeJudge.instantSixtySeven |
true |
Terminate as soon as 67 is typed |
codeJudge.judgeOnSave |
true |
Judge on save |
codeJudge.countdownSeconds |
4 |
How long the verdict screen is shown before the editor closes |
codeJudge.maxScore |
10 |
Score from which code counts as ass |
codeJudge.checkComments |
true |
Run the comment rules (the 67 rule applies to comments regardless) |
codeJudge.useDiagnostics |
true |
Count errors and warnings from language extensions |
codeJudge.maxLineLength |
120 |
Maximum line length |
codeJudge.excludedLanguages |
[] |
Language ids that are never judged |
Zed uses the same names without the codeJudge. prefix inside lsp.code-judge.initialization_options, see zed/README.md.
Build from source
npm install
npm test # unit tests: lexer, rules, verdict screen
npm run test:server # language server tests, talks LSP like Zed does
npm run package # builds code-judge-<version>.vsix
npm run build:zed # bundles the language server for the Zed extension
VSCODE_PATH="/path/to/Visual Studio Code.app/Contents/MacOS/Code" npm run test:integration
# runs a real VS Code: typing 67, Cmd+S, Save All, external changes
This repository's own tests are full of 67s, so .vscode/settings.json and .zed/settings.json put Code Judge into messageOnly mode for this folder. Otherwise working on Code Judge with Code Judge installed would end on the first keystroke.
To try changes in VS Code, open the folder and press F5. A second window (Extension Development Host) opens with the samples/ folder; only that window gets closed.
Project layout
| Path |
What it is |
src/languages.ts |
The language table: comment and string syntax, nesting, commented-out code patterns |
src/lexer.ts |
Finds comments and literals |
src/judge.ts |
The rules and the score |
src/screen.ts |
The verdict screen |
src/extension.ts |
VS Code extension |
src/server/ |
Language server used by Zed |
zed/ |
Zed extension (Rust, compiled to WebAssembly) |
License
MIT
| |