Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# EditorConfig is awesome:
http://EditorConfig.org
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true
Expand All @@ -12,6 +11,8 @@ trim_trailing_whitespace = true

# C# files
[*.cs]
charset = utf-8

# New line preferences
csharp_new_line_before_open_brace = none
csharp_new_line_before_catch = false
Expand All @@ -21,6 +22,13 @@ csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_within_query_expression_clauses = true

# use file-scoped namespaces
csharp_style_namespace_declarations = file_scoped
dotnet_diagnostic.IDE0161.severity = error

# use ValueTasks correctly
dotnet_diagnostic.CA2012.severity = error

Comment on lines +29 to +31
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

CA2012 as error—ensure analyzers are enabled repo-wide.

This rule only triggers if .NET analyzers are enabled. Also expect breakages where ValueTask is incorrectly consumed; consider staging as warning first.

Verify analyzer settings:


🏁 Script executed:

#!/bin/bash
# Look for EnableNETAnalyzers / AnalysisLevel
fd -t f '*.csproj' -x bash -lc 'echo "== {} =="; rg -n "EnableNETAnalyzers|AnalysisLevel|CodeAnalysisTreatWarningsAsErrors|TreatWarningsAsErrors" {} -N || true'
# Also check Directory.Build.props/targets
fd -t f 'Directory.Build.*' -x bash -lc 'echo "== {} =="; cat {}'

Length of output: 518


🏁 Script executed:

#!/bin/bash
# Correctly search all .csproj files for analyzer settings
fd --glob '*.csproj' -t f -x bash -lc '
  echo "== {} =="
  grep -nE "EnableNETAnalyzers|AnalysisLevel|CodeAnalysisTreatWarningsAsErrors|TreatWarningsAsErrors" "{}" || true
'

# List Directory.Build.props and Directory.Build.targets contents
fd --glob 'Directory.Build.*' -t f -x bash -lc '
  echo "== {} =="
  cat "{}"
'

Length of output: 695


Enable .NET analyzers globally before elevating CA2012 to error.
Projects only have <TreatWarningsAsErrors>true</TreatWarningsAsErrors> in individual .csproj files; there’s no <EnableNETAnalyzers> or <AnalysisLevel> defined in a shared Directory.Build.props/targets. Add to Directory.Build.props:

<PropertyGroup>
  <EnableNETAnalyzers>true</EnableNETAnalyzers>
  <AnalysisLevel>latest</AnalysisLevel>
</PropertyGroup>

Then consider staging dotnet_diagnostic.CA2012.severity = warning before switching to error to minimize initial breakages.

🤖 Prompt for AI Agents
.editorconfig around lines 29-31: the repo sets
dotnet_diagnostic.CA2012.severity = error but .NET analyzers aren’t enabled
globally, so add EnableNETAnalyzers=true and AnalysisLevel=latest to the shared
Directory.Build.props (create or update it at repo root) to ensure analyzers run
consistently across projects; after enabling analyzers, consider changing the
.editorconfig entry to dotnet_diagnostic.CA2012.severity = warning first to
catch and fix issues gradually before promoting it back to error.

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
Expand Down
27 changes: 0 additions & 27 deletions .github/workflows/qodana.yml

This file was deleted.

11 changes: 9 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
push:
tags:
- "v*"

permissions:
contents: read
packages: write

jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -17,12 +22,14 @@ jobs:

- name: Get the version
id: get_version
run: echo "version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
run: |
echo "version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT
echo "version: ${{ steps.get_version.outputs.version }}"

- name: Build, Pack and Publish
run: |
dotnet pack /p:Version=${{ steps.get_version.outputs.version }} -o artefacts -c Release src/EventStore.Plugins/EventStore.Plugins.csproj
dotnet nuget push artefacts/EventStore.Plugins.${{ steps.get_version.outputs.version }}.nupkg -k ${{ secrets.nugetkey }} -s https://api.nuget.org/v3/index.json
dotnet nuget push artefacts/EventStore.Plugins.${{ steps.get_version.outputs.version }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/TrogonStack/index.json
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ipch/
*.DotSettings
*.DotSettings.user
*.DotSettings.personal/Logs
*.md

!CHANGELOG.md
/Data
/src/Public/v8/
Expand Down
1 change: 0 additions & 1 deletion EventStore.Plugins.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitignore = .gitignore
LICENSE.md = LICENSE.md
NOTICE.md = NOTICE.md
qodana.yaml = qodana.yaml
README.md = README.md
EndProjectSection
Expand Down
13 changes: 9 additions & 4 deletions src/EventStore.Plugins/EventStore.Plugins.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Nullable>enable</Nullable>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

<PropertyGroup>
<PackageId>EventStore.Plugins</PackageId>
<Authors>Event Store Ltd</Authors>
Expand All @@ -21,19 +21,24 @@
<Copyright>Copyright 2012-2024 Event Store Ltd</Copyright>
<PackageTags>eventstore plugins</PackageTags>
</PropertyGroup>


<PropertyGroup>
<RepositoryUrl>https://github.com/TrogonStack/TrogonEventStore.Plugins</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.0" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
<PackageReference Include="YamlDotNet" Version="15.1.4" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="System.Reactive" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="\" />
<None Include="..\..\ouro.png" Pack="true" PackagePath="\" />
Expand Down
21 changes: 17 additions & 4 deletions src/EventStore.Plugins/Transforms/ChunkDataReadStream.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.Runtime.CompilerServices;

namespace EventStore.Plugins.Transforms;

Expand All @@ -10,12 +9,26 @@ public class ChunkDataReadStream(Stream chunkFileStream) : Stream {
public sealed override bool CanSeek => true;
public sealed override bool CanWrite => false;
public sealed override void Write(byte[] buffer, int offset, int count) => throw new InvalidOperationException();
public override void Write(ReadOnlySpan<byte> buffer) => throw new InvalidOperationException();
public sealed override void WriteByte(byte value) => throw new InvalidOperationException();

public sealed override void Flush() => throw new InvalidOperationException();
public sealed override void SetLength(long value) => throw new InvalidOperationException();
public override long Length => throw new NotSupportedException();

// reads must always return exactly `count` bytes as we never read past the (flushed) writer checkpoint
public override int Read(byte[] buffer, int offset, int count) => ChunkFileStream.Read(buffer, offset, count);
public sealed override int Read(byte[] buffer, int offset, int count) {
ValidateBufferArguments(buffer, offset, count);

return Read(buffer.AsSpan(offset, count));
}

// reads must always return exactly `Span<byte>.Length` bytes as we never read past the (flushed) writer checkpoint
public override int Read(Span<byte> buffer) => ChunkFileStream.Read(buffer);

public sealed override int ReadByte() {
Unsafe.SkipInit(out byte value);
return Read(new(ref value)) is 1 ? value : -1;
}

// seeks need to support only `SeekOrigin.Begin`
public override long Seek(long offset, SeekOrigin origin) {
Expand Down
7 changes: 6 additions & 1 deletion src/EventStore.Plugins/Transforms/ChunkDataWriteStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class ChunkDataWriteStream(Stream chunkFileStream, HashAlgorithm checksum
public sealed override bool CanSeek => false;
public sealed override bool CanWrite => true;
public sealed override int Read(byte[] buffer, int offset, int count) => throw new InvalidOperationException();
public sealed override int Read(Span<byte> buffer) => throw new InvalidOperationException();
public sealed override int ReadByte() => throw new InvalidOperationException();

public sealed override long Seek(long offset, SeekOrigin origin) => throw new InvalidOperationException();

public override void Write(byte[] buffer, int offset, int count) {
Expand All @@ -22,6 +25,7 @@ public override void Write(byte[] buffer, int offset, int count) {
public override void Flush() => ChunkFileStream.Flush();
public override void SetLength(long value) => ChunkFileStream.SetLength(value);
public override long Length => ChunkFileStream.Length;

public override long Position {
get => ChunkFileStream.Position;
set {
Expand All @@ -31,7 +35,8 @@ public override long Position {
ReadAndChecksum(value);

if (ChunkFileStream.Position != value)
throw new Exception($"Writer's position ({ChunkFileStream.Position:N0}) is not at the expected position ({value:N0})");
throw new Exception(
$"Writer's position ({ChunkFileStream.Position:N0}) is not at the expected position ({value:N0})");
}
}

Expand Down