Update project for initial Apache release (#1)

* Upgrade NuGet packages, add Sample project and enable debugging, remove VSIX, fix unit tests and analyser warnings

* Add remaining samples

* Add github action file

* Fix comment generation in Resources.Designer.cs, remove from source control

* Rename unit test project

* Add more detail to analyzer titles

* Rename GitHub workflow file

* Change GitHub Actions triggers

* Add strong name key signing

* Add README and Diagnostic IDs reservations file

* Fix NuGet pack output path and settings

* Added Dirctory.Build.props, Directory.Build.targets. and Directory.Packages.props files to share common settings and enable Central Package Management.

* Added version.json file for Nerdbank.GitVersioning

* Added Lucene.Net.CodeAnalysis.Dev.Package project to provide centralized packaging for analyzers, code fixes, and the sample project

* Added Lucene.Net.CodeAnalysis.Dev.Vsix project for Visual Studio live debugging

* Renamed Helpers namespace to Utility

* Migrated DiagnosticDescriptor declarations to their own Descriptors class

* SWEEP: Converted all tests to use Microsoft.CodeAnalysis.Analyzer.Testing

* Lucene.Net.CodeAnalysis.Dev.sln: Added Solution Items folder

* Lucene.Net.CodeAnalysis.Dev.sln: Added .github, docs, and eng folders as .folderproj (NoTargets) projects that allow the IDE to edit the underlying file structure

* Moved Lucene.Net.snk file to the eng directory

* Lucene.Net.CodeAnalysis.Dev.sln: Added Directory.Build.targets and Directory.Build.props files to src and tests folders

* Added GitHub workflows for build/release automation

* docs: Added building-and-testing, make-release, and visual-studio-debugging documentation

* Added Powershell script to run the Release Audit Tool

* rat.ps1: Changed RAT version to 0.13, since that is what we know works

* SWEEP: Ran the Apache Release Audit Tool to add missing license headers

* docs/make-release.md: Added section for Release Audit Tool

* Added .editorconfig and .gitattributes for most often hand-edited files

* Added Lucene.Net.CodeAnalysis.Dev.CodeFixes project and Lucene.Net.CodeAnalysis.Dev.CodeFixes.Tests

* Lucene.Net.CodeAnalysis.Dev.CodeFixes: Fixed CodeFixResources.resx code generation so it is not a committed file

* LuceneDev1001_FloatingPointFormattingCSCodeFixProvider: Dynamically build title based off of localized resource and actual code element.

* LuceneDev1001_FloatingPointFormattingCSCodeFixProvider: Refactored to make use of shared TryGetJ2NTypeAndMember() method to reduce duplicated code.

* Lucene.Net.CodeAnalysis.Dev.CodeFixes.csproj: Removed unnecessary PackageReference on Microsoft.CodeAnalysis.CSharp

* tests/Directory.Build.targets: Set IsPublishable=true if IsTestProject is true

* Lucene.Net.CodeAnalysis.Dev.Tests.csproj: Enabled nullable reference type support

* Lucene.Net.CodeAnalysis.Dev.Utilty.Descriptors: Use static fields instead of properties for DiagnosticDescriptors or the AnalyzerReleases release management analyzers do not recognize the diagnositic ids as being implemented.

* Lucene.Net.CodeAnalysis.Dev: Cleaned up usings

* Lucene.Net.CodeAnalysis.Dev: Removed AnalyzerReleases from AdditionalFiles, as it is only necessary if these are needed within one of our analyzers

* SWEEP: Moved all analyzers, code fixes, and analyzer/code fix tests into organizational LuceneDev1xxx folders.

* SWEEP: Added Apache 2.0 license headers to all .props, .targets, and .*proj files

* SWEEP: Added Apache 2.0 license headers to all .yml and .ps1 files

* SWEEP: Added Apache 2.0 license headers to all .md files (except AnalyzerReleases which require a specific format to be parsed)

* eng/nuget.props: Added LICENSE.txt and NOTICE.txt to the NuGet package.

* eng/nuget.props: Resolved conflict - cannot specify PackageLicenseExpression and PackageLicenseFile at the same time. Removed the PackageLicenseFile property, but kept the automation to pack the file into the NuGet package.

* Lucene.Net.CodeAnalysis.Dev.sln: Added .editorconfig and .gitattributes files to Solution Items

* Added Git commit hook to insert the current NuGetPackageVersion into a placeholder token {{vnext}} in the AnalyzerReleases.Shipped.md file, only if preceeded by "## Release ".

* docs/make-release.md: Simplified release procedure and included step to update AnalyzerReleases documents.

* version.json: Updated version.json to enforce 3-component release branch numbers.

* docs/make-release: Added workflow for release build outcomes. Also corrected release branching info to show branches with 3 version components.

* docs/make-release.md: Added info about deciding between major, minor, patch, and prerelease when choosing a version number.

* release-build-outcomes.md: Updated Mermaid markup to reflect the same state as the release-build-outcomes.svg file.

* Markdown-Formatting.Tests.ps1: Removed stray assert

* .github/workflows/ci.yml: Removed x86 tests and SDK setup

* docs/make-release.md: Corrected slash in release branch notes

* docs/make-release.md: Added info about how to check the version of the current commit

* nuget.props: Converted to nuget.targets and added target to set <PackageReleaseNotes> after Nerdbank.GitVersioning injects the PackageVersion into the pipeline.

* renovate.json: Disabled dependency dashboard issue and enabled fork processing for Forking Renovate

* .github/workflows/renovate-dependencies.yml: deleted, since we will be using Forking Renovate and we probably won't be able to run this workflow, anyway.

* Lucene.Net.CodeAnalysis.Dev.Package.csproj: Removed conditions for CodeFixes project and fixed paths to include (future) code fix resource files in the package if we ever localize it.

* Lucene.Net.CodeAnalysis.Dev.Vsix/source.extension.vsixmanifest: Changed Publisher attribute to Apache Software Foundation

---------

Co-authored-by: Shad Storhaug <shad@shadstorhaug.com>
110 files changed
tree: 707b0281d78ab62351d5f389a6dbea1ee777d455
  1. .github/
  2. branding/
  3. docs/
  4. eng/
  5. src/
  6. tests/
  7. .editorconfig
  8. .gitattributes
  9. .gitignore
  10. .rat-excludes
  11. DiagnosticCategoryAndIdRanges.txt
  12. Directory.Build.props
  13. Directory.Build.targets
  14. Directory.Packages.props
  15. global.json
  16. LICENSE.txt
  17. Lucene.Net.CodeAnalysis.Dev.ChildProcessDbgSettings
  18. Lucene.Net.CodeAnalysis.Dev.sln
  19. NOTICE.txt
  20. rat.ps1
  21. README.md
  22. renovate.json
  23. version.json
README.md

Apache Lucene.NET Dev Analyzers

This repo contains custom Roslyn analyzers that are used by the Apache Lucene.NET project to enforce code quality and consistency, as well as provide automated code fixes.

These analyzers are intended for use by contributors to the Lucene.NET project only. They are not intended for public use outside of this project. Therefore, any releases or NuGet packages produced from this repository are not official Apache Lucene.NET project artifacts, and are not subject to the same quality control or testing as the official Lucene.NET releases. They are also not subject to the release policy or voting process, as these are not intended to be used “beyond the group that owns it.”

Building

To build the analyzers, you will need to have the .NET 8 SDK installed.

To build from the repo root, run the following command:

dotnet build

To run the tests, you can use the following command:

dotnet test

IDE Support and Debugging

These analyzers have been tested with Visual Studio 2022 and JetBrains Rider. They should work with any IDE that supports Roslyn analyzers, but your mileage may vary. Importantly, they also work with MSBuild, so they can be used in our CI pipelines, or to help validate your changes when you build before submitting a pull request.

A Lucene.Net.CodeAnalysis.Dev.Sample project has been provided to demonstrate and debug the analyzers and code fixes in the IDE during development of them. After building, you should notice the analyzers producing the expected warnings in the Sample project. You can also debug the analyzers by setting a breakpoint in your analyzer and launching the DebugRoslynAnalyzers target of the Lucene.Net.CodeAnalysis.Dev project. You can also debug them by debugging the unit tests.

Contributing

Please read and follow the Apache Lucene.NET Contributor's Guide first before proceeding further.

Reserving a Diagnostic ID

Before creating any analyzers, you'll need a reserved diagnostic ID for your analyzer(s). To avoid multiple contributors attempting to use the same ID at the same time, we have created a simple process to follow. It is important that you follow this process to avoid rework of your PR.

  1. Make sure there is an issue on the main Apache Lucene.NET repo for the analyzer(s) needed, that has been approved by the Lucene.NET team as indicated by having the approved-rule label.
  2. Reserve your diagnostic ID(s) before implementing the analyzer(s):
    • If you are a Lucene.NET committer, you can reserve one yourself. Modify the DiagnosticCategoryAndIdRanges.txt file (following the instructions in that file) to reserve your ID(s). Commit and push the change to this file directly to the main branch, as the only file in the commit. DO NOT include any other code or changes in this commit. In the event of a conflict, do not merge this file; discard your changes, pull latest, and try again. Include the issue number in your commit message.
    • If you are not a Lucene.NET committer, request in the discussion for the GitHub issue that a committer do the steps above for you for your desired number of diagnostic IDs. Please make sure to mention which category the ID(s) should belong to.
  3. Once you have the reserved ID(s), you can proceed with implementing your analyzer and submitting a pull request. Make sure to include your analyzer in the AnalyzerReleases.Unshipped.md file.

Requirements

Before submitting a pull request to this repo, ensure that each analyzer you're adding:

  1. Has a reserved ID (see above)
  2. Has an entry in the AnalyzerReleases.Unshipped.md file, reflowing the table if needed
  3. Matches existing analyzer naming conventions and code styles
  4. Has a title, description, and message format resource in the Resources.resx file (currently English only)
  5. Has a working, sample violation in the Lucene.Net.CodeAnalysis.Dev.Sample project
  6. Has good unit test coverage in the Lucene.Net.CodeAnalysis.Dev.Tests project, using existing styles and practices per the other unit tests there