Repository navigation
Conversation
…points languages/csharp.py scores methods with a body (a block or `=> expression`), property, indexer, and event accessors under the compiler's names (`get_Count`, `set_Item`, `add_Changed`), top-level statements as `<Main>$` in `Program`, and each endpoint lambda registered with MapGet/MapPost/MapPut/MapPatch/MapDelete/ Map/MapMethods as its own entry named `GET /path`, the Express rule. Lambdas and local functions stay inside the enclosing entry; constructors, operators, and finalizers are omitted as crap4java omits constructors. Decisions are crap4java's spelled in C#, plus `??`, `?.`, `when` filters and guards, switch-expression arms, and `and` / `or` in patterns. discover: `.cs` is csharp, `obj/` holds generated sources and is skipped, and `*Tests.cs`, `*Test.cs`, and files inside a `*.Tests` project are test code. runners: `dotnet test --collect:"XPlat Code Coverage"` with coverlet's LCOV format, per solution at the root or per test project, written under target/coverage/csharp and renamed from coverage.info to lcov.info for the loader. claim_name moves from typescript.py to treesitter.py so both route rules share it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C# joins the languages crapper scores
tree-sitter-language-packalready ships the C# grammar, so this is a language module, discovery, and a coverage runner, with no new dependency.What is an entry
=> expression. Abstract methods,extern, and interface signatures are not.get_Count,set_Item,add_Changed.<Main>$, keyed under the project's root namespace (RootNamespacein the nearest.csproj, else the project file's name) so two projects'Program.csdo not share a key.MapGet,MapPost,MapPut,MapPatch,MapDelete,Map,MapMethods) is its own entry namedGET /users, with#2for a second lambda on the same route, and its decisions are not charged to the enclosing entry. This is the Express rule fromtypescript.py;_claimmoved totreesitter.pyasclaim_nameso both share it.What is a decision
crap4java's set spelled in C#:
if,for,foreach,while,do,catchand itswhenfilter,?:, eachswitchsection and itswhenguard, each switch-expression arm,&&/||; plus??,?., andand/orinside a pattern.Discovery
.csiscsharp.obj/is skipped (generatedAssemblyInfo.cs,GlobalUsings.cs).*Tests.cs,*Test.cs, and any.csinside a*.Tests/*.Testdirectory are test code.Coverage
dotnet test <target> --collect:"XPlat Code Coverage" --results-directory target/coverage/csharp -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov, once per.slnat the root, else once per test project. coverlet writescoverage.info; the runner renames it tolcov.infofor the existing LCOV loader. A missingcoverlet.collectorreference is reported and scores 0%, like the other languages' missing tools.Verification
tests/test_csharp.py(10 tests) pins every rule above against small sources, plus the obj/test-file discovery;test_runners.pygains 5 tests for targets, the command vector, the rename, and the warnings;test_languages.pyandtest_cli.pygain the C# rows.pytest: 161 passed (the Babashka-dependent snapshot test was not run on this machine).<Main>$and 25 endpoint lambdas scored. One lambda's CC was checked by hand against the source (3if, 1?:, 4catch, 1||→ 10).Note
mutator finds functions through
crapper.discoverandcrapper.languages, so with this change it will see.csfiles but has no test plan for them; a C# plan there would compile per mutant, which is what Stryker.NET exists to avoid. Happy to add a "skip csharp" guard in mutator if you prefer.🤖 Generated with Claude Code