Skip to content

Publish only the names from AUTHORS.md as Authors and Company [patch] - #97

Open
matt-edmondson wants to merge 1 commit into
mainfrom
fix/90-clean-authors
Open

matt-edmondson wants to merge 1 commit into
mainfrom
fix/90-clean-authors

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #90

What was wrong

Sdk.props set Authors to all of AUTHORS.md, trimmed, and Company defaulted to that value. A conventional heading-over-contributor-list file therefore put # Authors, the bullets and every contributor's email address into the nuspec <authors> and into AssemblyCompanyAttribute. A published package can't be taken back.

Change (Sdk/Sdk.props)

  • After AuthorsNamespace is derived (it still reads the raw text, so prefixes are unchanged), Authors read from AUTHORS.md is cleaned:
    • heading lines are dropped
    • leading list markers (-, *, +, 1., 1)) are dropped
    • <email> suffixes are dropped
    • the remaining non-blank lines are joined with ;
  • The joined value is passed through [MSBuild]::Unescape. A property function's result is escaped, so without this NuGet received %3B and published a single author named Jane Doe;John Smith.
  • Company defaults to the same names joined with , , because it is a display string.
  • A single-line AUTHORS.md (the ktsu convention) comes through exactly as written. An Authors that a consumer sets in Directory.Build.props with no AUTHORS.md is not touched.
  • README and CLAUDE.md now describe the derivation.

Tests

New AuthorsMetadataTests (6 tests):

  • evaluation cases: heading plus list, other list markers, a single line, a single line with punctuation, and a consumer-set value
  • a pack test that checks the nuspec <authors> is Jane Doe,John Smith and that the generated AssemblyCompanyAttribute is Jane Doe, John Smith and contains no email address

With the Sdk.props change reverted, the 3 heading/list tests fail: Actual:<# Authors .... The other 3 cover behaviour that must not change, so they pass either way. AuthorsNamespaceTests still passes unchanged.

Full Sdk.Examples.Tests suite on this branch (Linux): 112 passed, 0 failed.


Generated by Claude Code

Sdk.props set Authors to the whole AUTHORS.md, so the conventional heading
over a contributor list put the markdown and every contributor's email
address into the nuspec and AssemblyCompanyAttribute. Drop heading lines,
list markers and <email> suffixes, join the names with NuGet's ';'
separator (unescaped, so NuGet sees a list), and derive Company from the
cleaned names. A single-line AUTHORS.md is unchanged, and AuthorsNamespace
still reads the raw text.

Fixes #90

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017vfJW5RdbhA7TAMDQD8QTG
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

Assert.IsNotNull(authors, $"Packed nuspec has no <authors>.{Environment.NewLine}{nuspec}");
Assert.AreEqual("Jane Doe,John Smith", authors.Value, "nuspec <authors>");

string assemblyInfo = Directory.EnumerateFiles(Path.Combine(workspace.Root, "Alpha", "obj"), "*.AssemblyInfo.cs", SearchOption.AllDirectories)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this one. Path.Combine discards earlier arguments only when a later argument is rooted. Here the later arguments are the literals "Alpha" and "obj", which are never rooted, so workspace.Root can't be dropped. The rest of this test project builds paths the same way: ExampleWorkspace.ResolveForWrite, RepoLayout.Demo and ExampleWorkspace.Pack all use Path.Combine(root, ...). Switching only this call to Path.Join would make it inconsistent with them without fixing anything.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants