From f72141bfa28bf81c1e62d8b2aad066af97048f2a Mon Sep 17 00:00:00 2001 From: rameel Date: Mon, 16 Nov 2026 18:59:55 +0500 Subject: [PATCH] repo: add contribution guidelines --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 1 + CONTRIBUTING.md | 129 ++++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9af5a44..631a3e1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,7 +19,7 @@ jobs: - name: Install .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: 9.0.x + dotnet-version: 10.0.x - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb762c3..bdf51bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: 7.x 8.x 9.x + 10.x - name: Checkout uses: actions/checkout@v4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..003515d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,129 @@ +# Contributing + +Bug reports, fixes, and documentation improvements are welcome, including small ones. + +## Reporting bugs + +Tell us what happened and what you expected. +Include the ExpressionParser and .NET versions, the expression being parsed, and any custom binder or context. +A small example showing the expected result and the actual result or error helps. + +## Development setup + +Use the .NET 10 SDK or later to build from source, and install the .NET 6 runtime to run the tests. + +Run the commands below from the repository root. + +## Building and testing + +Build the solution and run the tests in both configurations: + +```console +dotnet test -c Debug +dotnet test -c Release +``` + +## Code style + +Follow [.editorconfig](.editorconfig) and the style of the surrounding code. +Keep formatting changes limited to the code you're working on. + +## Pull requests + +- Keep each pull request focused on one goal. Its commits can use different scopes when they serve that goal. + Do not mix unrelated changes into it. +- Several cleanups that do not change behavior, such as formatting, comment fixes, and readability improvements, + can share one pull request when each is a separate commit. Send behavior changes found along the way + as separate pull requests. +- Explain what changed and why, and link to related issues if there are any. +- When fixing a reproducible bug, add a regression test. Add tests for new behavior where appropriate. +- Update the documentation if your change affects how people use the library. +- Keep changes compatible with the target frameworks declared in the project files. + +For major public API changes, open an issue first so we can agree on the approach before you spend time on it. + +Use the [scoped commit style](#commit-messages) for pull request titles. Choose the scope with the +[same rules](#choosing-a-scope) as for a commit, treating the whole pull request as one change. +The title does not need to summarize every supporting commit. + +## Commit messages + +Use scoped commit messages: + +```text +: +``` + +The scope identifies the part of the project that changed. Write the description in the imperative mood, +starting with a lowercase letter and without a trailing period. Describe what the change does rather than +just naming its type. + +```text +parser: report an incomplete conditional expression +parser: preserve short-circuit evaluation +binding: resolve context members without case sensitivity +``` + +Do not prefix messages with conventional commit types such as `feat`, `fix`, `refactor`, or `chore`, +and do not use ticket numbers as scopes. The description should make the type of change clear when it matters. +Put ticket references and implementation details in the message body when needed. + +### Scopes + +Use the smallest stable area that describes the outcome. Start with these root scopes; +add a subscope only when the history of a root scope becomes difficult to navigate. + +| Scope | Area | +|-----------|-------------------------------------------------------------------------------------------| +| `parser` | Grammar, syntax errors, expression nodes, operators, tree construction, and evaluation | +| `binding` | Type, member, and method resolution, including default and context-aware binders | +| `docs` | General project documentation | +| `tests` | Shared test infrastructure | +| `build` | Build, CI, dependencies, development tooling, and NuGet packaging | +| `repo` | Repository structure and metadata, contribution and code style rules, cross-area cleanups | + +Use the product area's scope for its tests, documentation, and examples, even when a commit changes only +those files. Reserve `tests` and `docs` for their own infrastructure or for related changes across multiple product areas. + +Use `binding` for method resolution even when the implementation lives in `Internal/`. +For other shared helpers in `Internal/`, such as `Error`, `ReflectionExtensions`, and `TypeUtils`, +use the scope of the area the change serves. + +### Choosing a scope + +Most commits change one area; use its scope from the table. When a commit touches several scopes, +use the first rule that applies: + +1. **It changes behavior, public API, performance, or debugging experience.** Use the scope of the area + where the change is visible, even if the implementation spans other areas. If several areas change, + use the one whose documentation describes the change, or the one the change mainly serves + when it is not documented, such as an optimization. +2. **It introduces or updates one thing that the rest of the commit adopts.** Use the scope of that thing: + `build: enable analyzers and treat warnings as errors`, `repo: define formatting rules`. +3. **It only changes comments or documentation.** Use `docs`. +4. **Anything else**, such as formatting, renames, or file moves. Use `repo` for a general cleanup, even when + only product code changes. Use the product area's scope when the work targets that area's code itself, + such as simplifying expression tree construction. + +Make each commit one logical change. Split logically separate changes into separate commits, even when they +share a scope: if the description needs "and" to join unrelated changes, the commit should be split. +Do not split a single change only to give each part its own scope, and do not list several scopes. + +## Issue titles + +Use a clear, descriptive issue title. Scope prefixes are optional; when used, choose from the same scopes +as commits and pull requests. Describe the problem or proposed capability; the imperative mood is not required. + +## Test names + +Prefer `Method_Condition_ExpectedResult` when adding or renaming tests. This is a recommendation, +not a strict requirement: choose a clearer name when the pattern does not fit naturally. +Use PascalCase within each part and describe the expected observable behavior. + +```text +Parse_IncompleteConditional_ReturnsError +Evaluate_ShortCircuit_DoesNotEvaluateRightOperand +``` + +For parameterized tests, describe the common scenario and let the arguments distinguish individual cases. +There is no need to rename existing tests solely to follow this convention.