C#, Ruby, PHP, Swift and C docs drift
Rimfe parses C#, Ruby, PHP, Swift, C and C++ files without building them and records public declarations: classes, methods, functions, properties, constants and enums with their parameters and defaults, plus environment variable reads and Ruby and PHP dependencies. Web routes and CLI options are not read as such in these languages; their handlers count as methods.
What Rimfe reads
These languages share one page because Rimfe reads the same layer in each: the declared public surface, compared between the base and head of a pull request. A renamed method, a new required parameter or a changed default is a change Rimfe can name.
| Language | What is read |
|---|---|
| C# | Classes, structs, records, interfaces, enums, delegates, methods, constructors, operators, properties, const and static readonly fields, attributes and namespaces, file-scoped included. Interface members are public. Environment.GetEnvironmentVariable. [Obsolete] marks a name deprecated. |
| Ruby | Modules, classes, methods and self. methods, private and protected sections, attr_reader, attr_writer and attr_accessor, constants, keyword and optional parameters. ENV["X"] and ENV.fetch("X", default). Gemfile, Gemfile.lock and .gemspec dependencies. |
| PHP | Classes, interfaces, traits, enums with their cases, functions, constants and define(), properties and attributes. Public is the default. getenv, $_ENV and $_SERVER. composer.json dependencies. PHPDoc @deprecated. |
| Swift | public and open declarations only, since internal is the default: types, protocols, extensions, enum cases with raw values and parameter defaults. environment["X"] reads. |
| C and C++ | Headers are the public surface; in source files, non-static definitions. Functions, #define macros (include guards skipped), structs, enums and typedefs. C++ adds namespaces, classes with access sections, templates, scoped enums and out-of-line members. getenv and secure_getenv. [[deprecated]]. |
Example: a C# method gains a required parameter
docs/sdk/dotnet.md shows await client.PlaceOrderAsync(request);. A snippet that misses a new required parameter is outdated, so Rimfe reports an Outdated code sample on that line.
- public Task<Order> PlaceOrderAsync(OrderRequest request)+ public Task<Order> PlaceOrderAsync(OrderRequest request, string idempotencyKey)Example: a Ruby env default changes
docs/configuration.md says ACME_TIMEOUT defaults to 30 seconds. Rimfe reads the default from ENV.fetch and posts a Docs conflict on that line, with an edit to 10.
- TIMEOUT = Integer(ENV.fetch("ACME_TIMEOUT", 30))+ TIMEOUT = Integer(ENV.fetch("ACME_TIMEOUT", 10))Example: a C function is renamed
The README's C sample still calls acme_init. The finding reads: Outdated code sample: README.md line 18 uses acme_init, renamed in this pull request. A .h file with C++ syntax, such as a namespace or ::, is read as C++.
- int acme_init(const char *path);+ int acme_open(const char *path, int flags);Docs tools beside these languages
Reference that Doxygen, DocFX or YARD builds from comments at build time is not a file Rimfe can read. The pages that go stale are the written ones: the README, install and configuration guides, and SDK quickstarts. Rimfe reads them as Markdown, MDX, reST or AsciiDoc in any docs framework.
Set up the repository
Map the SDK or library folders to the pages that describe them, so those pages are read first. surface lists env vars and config keys to count in docs coverage. The file applies when Documentation scope is set to .rimfe.json at the PR base.
{ "$schema": "https://rimfe.com/schema/rimfe.json", "docsGlobs": ["README.md", "docs/**/*.md"], "codeMappings": [ { "source": "src/Acme.Sdk/**", "target": "docs/sdk/dotnet.md" }, { "source": "lib/acme/config.rb", "target": "docs/configuration.md" } ], "surface": ["ACME_TIMEOUT"]}Limits
- No route facts for Rails, ASP.NET, Laravel or Vapor, and no command facts for Thor, System.CommandLine, Symfony Console or Swift Argument Parser. Their handlers are read as methods.
- Config files such as
appsettings.jsonorconfig/*.ymlare not read as config keys. - Ruby methods made with
define_methodormethod_missing, and code a C macro expands to, are not seen. - A Swift module without
publicdeclarations, such as an app target, has no public surface to compare.
Try it on your next pull request.
Free for public repositories, with unlimited members.
Start free with GitHub