Skip to content

Commit 1859dee

Browse files
committed
Merge branch 'main' into feature/elastic-client
2 parents bafe678 + 899c537 commit 1859dee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+922
-242
lines changed

.github/copilot-instructions.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copilot AI Coding Agent Instructions for Foundatio.Parsers
2+
3+
## Key Principles
4+
5+
All contributions must respect existing formatting and conventions specified in the `.editorconfig` file. You are a distinguished engineer and are expected to deliver high-quality code that adheres to the guidelines in the instruction files.
6+
7+
Let's keep pushing for clarity, usability, and excellence—both in code and user experience.
8+
9+
**See also:**
10+
- [General Coding Guidelines](instructions/general.instructions.md)
11+
- [Testing Guidelines](instructions/testing.instructions.md)
12+
13+
## Key Directories & Files
14+
- `src/Foundatio.Parsers/` — Main library code for Parsers integration.
15+
- `tests/Foundatio.Parsers.Tests/` — Unit and integration tests for Parsers features.
16+
- `build/` — Shared build props, strong naming key, and assets.
17+
- `Foundatio.Parsers.slnx` — Solution file for development.
18+
19+
## Developer Workflows
20+
- **Build:** Use the VS Code task `build` or run `dotnet build` at the repo root.
21+
- **Test:** Use the VS Code task `test` or run `dotnet test tests/Foundatio.Parsers.Tests`.
22+
- **Docker Compose:** For integration tests, run `docker compose up`.
23+
24+
## References & Further Reading
25+
- [README.md](../README.md) — Full documentation, usage samples, and links to upstream Foundatio docs.
26+
- [FoundatioFx/Foundatio](https://github.com/FoundatioFx/Foundatio) — Core abstractions and additional implementations.
27+
28+
---
29+
30+
**If you are unsure about a pattern or workflow, check the README or look for similar patterns in the `src/` and `tests/` folders.**

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,17 @@ updates:
55
directory: "/"
66
schedule:
77
interval: weekly
8+
9+
- package-ecosystem: "docker-compose"
10+
directory: "/"
11+
schedule:
12+
interval: quarterly
13+
ignore:
14+
- dependency-name: "elasticsearch/elasticsearch"
15+
versions:
16+
- "<8.0.0"
17+
- ">=9.0.0"
18+
- dependency-name: "kibana/kibana"
19+
versions:
20+
- "<8.0.0"
21+
- ">=9.0.0"
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
description: "General coding guidelines"
3+
applyTo: "**"
4+
---
5+
6+
# General Coding Guidelines
7+
8+
You are a distinguished engineer and are expected to deliver high-quality code that adheres to the guidelines below.
9+
All contributions must respect existing formatting and conventions specified in the `.editorconfig` file and
10+
Microsoft's [coding conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions).
11+
12+
Code can be formatted with `dotnet format` and checked for errors with `dotnet build`.
13+
14+
Use context7 for documentation
15+
16+
## Code Style & Minimal Diffs
17+
18+
- Match the file's existing style; use `.editorconfig` when unsure.
19+
- Preserve extra spaces, comments, and minimize diffs.
20+
- Always ask before creating new files, directories, or changing existing structures.
21+
- Always look at existing usages before refactoring or changing code to prevent new code from breaking existing code.
22+
- Assume any existing uncommitted code is correct and ask before changing it.
23+
- Don't add code comments unless necessary. Code should be self-explanatory.
24+
- Don't use deprecated or insecure libraries, algorithms or features.
25+
26+
## Modern Code Practices
27+
28+
- Write complete, runnable code—no placeholders or TODOs.
29+
- Use modern language features, clear naming conventions, and defensive coding when necessary.
30+
- Follow SOLID, DRY, and clean code principles. Remove unused code.
31+
32+
## Behavior Management
33+
34+
- Flag any user-visible changes for review.
35+
- Deliver exactly what's requested—avoid adding unnecessary features unless explicitly instructed.
36+
37+
## Security Guidelines
38+
39+
- Sanitize all user inputs and rigorously validate data.
40+
- Follow OWASP guidelines and implement a robust Content Security Policy.
41+
- Adopt Shift-Left security practices to identify vulnerabilities early.
42+
43+
## Developer Planning & Reflection
44+
45+
### Pre-Coding Reflection
46+
47+
1. Identify the problem or feature you're solving.
48+
2. Consider three possible approaches.
49+
3. Choose the simplest approach that satisfies all requirements.
50+
4. Clarify:
51+
- Can the solution be modularized into smaller functions?
52+
- Are there unnecessary abstractions?
53+
- Will the implementation be clear to a junior developer?
54+
55+
### Post-Coding Reflection
56+
57+
1. Review for refactor opportunities—can clarity or maintainability be improved?
58+
2. Identify potential edge cases or areas prone to bugs.
59+
3. Verify robust error handling and validation mechanisms.
60+
61+
## Code Reviews
62+
63+
- Ensure adherence to complexity, consistency, and clean code standards.
64+
- Validate robust error handling and defensive coding practices.
65+
- Check for duplication and maintainable solutions.
66+
67+
## Debugging Guidelines
68+
69+
1. **Reproduce** the issue with minimal steps and code.
70+
2. **Understand** the underlying problem thoroughly.
71+
3. **Form Hypotheses** about the cause.
72+
4. **Test & Verify** potential solutions.
73+
5. **Document** fixes and adjustments clearly for future reference.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
description: "C# testing guidelines"
3+
applyTo: "tests/**/*.cs"
4+
---
5+
6+
# Testing Guidelines (C#)
7+
8+
## Framework & Best Practices
9+
10+
- Follow Microsoft's [unit testing best practices](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices).
11+
- Use xUnit as the primary testing framework.
12+
13+
## Test Principles
14+
15+
- **Fast & Isolated**: Tests should execute quickly and not depend on external factors or the order of execution.
16+
- **Repeatable & Self-Checking**: Tests must be consistent and validate their own outcomes without manual checks.
17+
- **Timely**: Write tests alongside your code to ensure relevance and improve design.
18+
19+
## Test Structure & Naming
20+
21+
- Write complete, runnable tests—no placeholders or TODOs.
22+
- Use clear, descriptive naming conventions for test methods:
23+
- `MethodName_StateUnderTest_ExpectedBehavior`
24+
- Follow AAA pattern (Arrange, Act, Assert).
25+
26+
## Test Organization
27+
28+
- Use `[Theory]` and `[InlineData]` for parameterized tests.
29+
- Implement proper setup and teardown using constructors and `IDisposable`.
30+
- Tests are organized to mirror the main code structure (e.g., `Storage/` in both `src` and `tests`).
31+
32+
## Integration Testing
33+
34+
- Inject `ITestOutputHelper` into the test class constructor to get access to the test output.
35+
- Isolate dependencies using test containers, in-memory providers, or stubs to ensure reliable test execution.
36+
- Verify data persistence and side effects.

.idea/.idea.Foundatio.Parsers/.idea/projectSettingsUpdater.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM mcr.microsoft.com/mssql/server:2022-latest
2+
3+
ARG SSID_PID=Developer
4+
5+
ENV ACCEPT_EULA=Y
6+
ENV SSID_PID=${SSID_PID}
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
ENV DEBCONF_NONINTERACTIVE_SEEN=true
9+
10+
USER root
11+
12+
RUN apt-get update && \
13+
apt-get upgrade -y && \
14+
apt-get install -yq gnupg gnupg2 gnupg1 curl apt-transport-https && \
15+
curl https://packages.microsoft.com/keys/microsoft.asc -o /var/opt/mssql/ms-key.cer && \
16+
gpg --dearmor -o /etc/apt/trusted.gpg.d/microsoft.gpg /var/opt/mssql/ms-key.cer && \
17+
curl https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list -o /etc/apt/sources.list.d/mssql-server-2022.list && \
18+
apt-get update && \
19+
apt-get install -y mssql-server-fts && \
20+
apt-get clean && \
21+
rm -rf /var/lib/apt/lists
22+
23+
ENTRYPOINT [ "/opt/mssql/bin/sqlservr" ]

Foundatio.Parsers.sln

Lines changed: 0 additions & 66 deletions
This file was deleted.

Foundatio.Parsers.slnx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path=".editorconfig" />
4+
<File Path=".github/workflows/build.yml" />
5+
<File Path="build/common.props" />
6+
<File Path="docker-compose.yml" />
7+
<File Path="NuGet.config" />
8+
<File Path="README.md" />
9+
<File Path="tests/Directory.Build.props" />
10+
</Folder>
11+
<Project Path="src/Foundatio.Parsers.ElasticQueries/Foundatio.Parsers.ElasticQueries.csproj" />
12+
<Project Path="src/Foundatio.Parsers.LuceneQueries/Foundatio.Parsers.LuceneQueries.csproj" />
13+
<Project Path="src/Foundatio.Parsers.SqlQueries/Foundatio.Parsers.SqlQueries.csproj" />
14+
<Project Path="tests/Foundatio.Parsers.ElasticQueries.Tests/Foundatio.Parsers.ElasticQueries.Tests.csproj" />
15+
<Project Path="tests/Foundatio.Parsers.LuceneQueries.Tests/Foundatio.Parsers.LuceneQueries.Tests.csproj" />
16+
<Project Path="tests/Foundatio.Parsers.SqlQueries.Tests/Foundatio.Parsers.SqlQueries.Tests.csproj" />
17+
</Solution>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A lucene style query parser that is extensible and allows additional syntax feat
1212
[This package](https://www.nuget.org/packages/Foundatio.Parsers.LuceneQueries/) can be installed via the [NuGet package manager](https://docs.nuget.org/consume/Package-Manager-Dialog). If you need help, please contact us via in-app support or [open an issue](https://github.com/exceptionless/Foundatio.Parsers/issues/new). We’re always here to help if you have any questions!
1313

1414
1. You will need to have [Visual Studio Code](https://code.visualstudio.com) installed.
15-
2. Open the `Foundatio.Parsers.sln` Visual Studio solution file.
15+
2. Open the `Foundatio.Parsers.slnx` Visual Studio solution file.
1616

1717
## Using LuceneQueryParser
1818

@@ -82,5 +82,5 @@ System.Diagnostics.Debug.Assert(query == generatedQuery);
8282
- Supports both root and inner field name aliases
8383

8484
## Thanks to all the people who have contributed
85-
85+
8686
[![contributors](https://contributors-img.web.app/image?repo=FoundatioFx/Foundatio.Parsers)](https://github.com/FoundatioFx/Foundatio.Parsers/graphs/contributors)

build/common.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
4+
<TargetFrameworks>net8.0</TargetFrameworks>
55
<Product>Foundatio.Parsers</Product>
66
<Description>A lucene style query parser that is extensible and allows additional syntax features.</Description>
77
<PackageProjectUrl>https://github.com/FoundatioFx/Foundatio.Parsers</PackageProjectUrl>
@@ -10,7 +10,7 @@
1010
<MinVerTagPrefix>v</MinVerTagPrefix>
1111
<ReferenceFoundatioSource Condition="$(SolutionName.Contains('All')) Or !$(SolutionName.Contains('Foundatio'))">true</ReferenceFoundatioSource>
1212

13-
<Copyright>Copyright (c) 2024 Foundatio. All rights reserved.</Copyright>
13+
<Copyright>Copyright (c) 2025 Foundatio. All rights reserved.</Copyright>
1414
<Authors>FoundatioFx</Authors>
1515
<NoWarn>$(NoWarn);CS1591</NoWarn>
1616
<WarningsAsErrors>true</WarningsAsErrors>
@@ -36,7 +36,7 @@
3636
</PropertyGroup>
3737

3838
<ItemGroup>
39-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
39+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
4040
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
4141
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="All" />
4242
</ItemGroup>

0 commit comments

Comments
 (0)