Skip to content
Merged
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
5 changes: 1 addition & 4 deletions .github/workflows/dotnet-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ jobs:
dotnet-version: "8.0.x"

# xUnit conformance harness against the shared vectors.
- run: dotnet test tests/Altium.Auth.Tests -c Release

# The same vectors via the dependency-free console runner (also runs offline).
- run: dotnet run --project tests/Altium.Auth.Conformance -c Release -- ../../spec/conformance/vectors.json
- run: dotnet test Altium.Auth.sln -c Release

# Build the live E2E tool so API changes can't silently break it (it isn't a test).
- run: dotnet build tools/SignInTest -c Release
6 changes: 2 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ libs/
cd libs/typescript && npm ci && npm run lint && npm run typecheck \
&& npm test && npm run test:conformance && npm run build && cd ../..

# .NET
dotnet test libs/dotnet/tests/Altium.Auth.Tests -c Release
# offline / no-NuGet fallback for the same vectors:
sh libs/dotnet/build-offline.sh
# .NET (solution-level; the src project builds with analyzers as errors)
dotnet test libs/dotnet/Altium.Auth.sln -c Release
```

Live end-to-end (needs network + a browser — never in CI): each library ships a
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ Then work inside the library you're changing:

| Command | What it does |
|---------|--------------|
| `dotnet test tests/Altium.Auth.Tests -c Release` | xUnit conformance over the shared vectors |
| `sh build-offline.sh` | Same vectors with no NuGet (locked-down environments) |
| `dotnet build Altium.Auth.sln -c Release` | Build the whole solution (analyzers gate the library) |
| `dotnet test Altium.Auth.sln -c Release` | xUnit conformance over the shared vectors |
| `dotnet run --project tools/SignInTest -- <clientId>` | Live sign-in (needs network + browser) |

## Changing behavior (the contract)
Expand Down
108 changes: 108 additions & 0 deletions libs/dotnet/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# EditorConfig + Roslyn analyzer rules for the .NET library — the analog of the
# TypeScript library's ESLint config. The shipped library (src/Altium.Auth) builds
# with TreatWarningsAsErrors, so these rules are enforced at build time and in CI.
root = true

[*.cs]
indent_style = space
indent_size = 4
tab_width = 4
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

# ── Language conventions ────────────────────────────────────────
csharp_style_namespace_declarations = file_scoped:warning
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
csharp_using_directive_placement = outside_namespace:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members:warning
csharp_prefer_braces = when_multiline:silent
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_expression_bodied_methods = true:silent
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_readonly_field = true:warning
dotnet_diagnostic.IDE0005.severity = warning # remove unnecessary usings

# ── Naming conventions (enforced) ───────────────────────────────
dotnet_diagnostic.IDE1006.severity = warning

# Symbol groups
dotnet_naming_symbols.types.applicable_kinds = class, struct, enum, delegate
dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_symbols.type_members.applicable_kinds = method, property, event, field
dotnet_naming_symbols.type_members.applicable_accessibilities = public, internal, protected, protected_internal
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_symbols.const_fields.applicable_kinds = field
dotnet_naming_symbols.const_fields.required_modifiers = const
dotnet_naming_symbols.parameters.applicable_kinds = parameter
dotnet_naming_symbols.locals.applicable_kinds = local

# Styles
dotnet_naming_style.pascal.capitalization = pascal_case
dotnet_naming_style.camel.capitalization = camel_case
dotnet_naming_style.i_prefixed.capitalization = pascal_case
dotnet_naming_style.i_prefixed.required_prefix = I
dotnet_naming_style.under_camel.capitalization = camel_case
dotnet_naming_style.under_camel.required_prefix = _

# Rules
dotnet_naming_rule.interfaces_are_i_prefixed.symbols = interfaces
dotnet_naming_rule.interfaces_are_i_prefixed.style = i_prefixed
dotnet_naming_rule.interfaces_are_i_prefixed.severity = warning

dotnet_naming_rule.types_are_pascal.symbols = types
dotnet_naming_rule.types_are_pascal.style = pascal
dotnet_naming_rule.types_are_pascal.severity = warning

dotnet_naming_rule.members_are_pascal.symbols = type_members
dotnet_naming_rule.members_are_pascal.style = pascal
dotnet_naming_rule.members_are_pascal.severity = warning

dotnet_naming_rule.const_fields_are_pascal.symbols = const_fields
dotnet_naming_rule.const_fields_are_pascal.style = pascal
dotnet_naming_rule.const_fields_are_pascal.severity = silent

dotnet_naming_rule.private_fields_are_under_camel.symbols = private_fields
dotnet_naming_rule.private_fields_are_under_camel.style = under_camel
dotnet_naming_rule.private_fields_are_under_camel.severity = silent

dotnet_naming_rule.parameters_are_camel.symbols = parameters
dotnet_naming_rule.parameters_are_camel.style = camel
dotnet_naming_rule.parameters_are_camel.severity = warning

dotnet_naming_rule.locals_are_camel.symbols = locals
dotnet_naming_rule.locals_are_camel.style = camel
dotnet_naming_rule.locals_are_camel.severity = silent

# ── Analyzer tuning ─────────────────────────────────────────────
# Endpoints/redirect URIs are modeled as strings on purpose (parity with the TS
# library and how they're configured/registered). Don't require System.Uri.
dotnet_diagnostic.CA1054.severity = none # URI parameters should not be strings
dotnet_diagnostic.CA1056.severity = none # URI properties should not be strings
dotnet_diagnostic.CA2234.severity = none # pass System.Uri instead of a string

# ── StyleCop.Analyzers (src only) ───────────────────────────────
# Keep StyleCop quiet by default — the built-in analyzers + rules above already
# cover style/naming/quality. Enable ONLY the two structural rules the SDK lacks.
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpecialRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpacingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.ReadabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.NamingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
dotnet_diagnostic.SA1402.severity = error # one type per file
dotnet_diagnostic.SA1649.severity = error # file name matches the first type

# Test / tool projects: relax rules that don't matter outside the shipped library.
[**/tests/**.cs]
dotnet_diagnostic.IDE0005.severity = suggestion

[**/tools/**.cs]
dotnet_diagnostic.IDE0005.severity = suggestion
8 changes: 8 additions & 0 deletions libs/dotnet/.idea/.idea.Altium.Auth/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 116 additions & 0 deletions libs/dotnet/.idea/.idea.Altium.Auth/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions libs/dotnet/Altium.Auth.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Altium.Auth", "src\Altium.Auth\Altium.Auth.csproj", "{A3C9B6F1-F558-41D2-8B11-A21791B05F9F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Altium.Auth.Tests", "tests\Altium.Auth.Tests\Altium.Auth.Tests.csproj", "{E76227C5-B85E-451D-8697-730FC86A5C28}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{07C2787E-EAC7-C090-1BA3-A61EC2A24D84}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SignInTest", "tools\SignInTest\SignInTest.csproj", "{7470BCEF-3CD3-4332-B994-26241C91ACD6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A3C9B6F1-F558-41D2-8B11-A21791B05F9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A3C9B6F1-F558-41D2-8B11-A21791B05F9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3C9B6F1-F558-41D2-8B11-A21791B05F9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3C9B6F1-F558-41D2-8B11-A21791B05F9F}.Release|Any CPU.Build.0 = Release|Any CPU
{E76227C5-B85E-451D-8697-730FC86A5C28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E76227C5-B85E-451D-8697-730FC86A5C28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E76227C5-B85E-451D-8697-730FC86A5C28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E76227C5-B85E-451D-8697-730FC86A5C28}.Release|Any CPU.Build.0 = Release|Any CPU
{7470BCEF-3CD3-4332-B994-26241C91ACD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7470BCEF-3CD3-4332-B994-26241C91ACD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7470BCEF-3CD3-4332-B994-26241C91ACD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7470BCEF-3CD3-4332-B994-26241C91ACD6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A3C9B6F1-F558-41D2-8B11-A21791B05F9F} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
{E76227C5-B85E-451D-8697-730FC86A5C28} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{7470BCEF-3CD3-4332-B994-26241C91ACD6} = {07C2787E-EAC7-C090-1BA3-A61EC2A24D84}
EndGlobalSection
EndGlobal
14 changes: 10 additions & 4 deletions libs/dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,20 @@ behavior-identical. Spec: [`spec/SPEC.md`](https://github.com/AltiumDeveloper/a3

## Development

Open `Altium.Auth.sln` in your IDE (library, tests, and tools grouped into `src`/`tests`/`tools` folders), or from the CLI:

```bash
# Conformance (xUnit) over the shared vectors
dotnet test tests/Altium.Auth.Tests -c Release
# Build / test the whole solution
dotnet build Altium.Auth.sln -c Release
dotnet test Altium.Auth.sln -c Release # runs the xUnit conformance suite

# Same vectors without NuGet (locked-down environments)
sh build-offline.sh
# Or target a single project:
dotnet test tests/Altium.Auth.Tests -c Release
```

The shipped library (`src/Altium.Auth`) builds with analyzers + `TreatWarningsAsErrors`
(see `.editorconfig`), so `dotnet build` is the style/quality gate.

### Live E2E against a real environment

`tools/SignInTest` runs the *real* flow (ActionWait sign-in, workspace exchange, refresh,
Expand Down
40 changes: 0 additions & 40 deletions libs/dotnet/build-offline.sh

This file was deleted.

Loading
Loading