Showing preview only (284K chars total). Download the full file or copy to clipboard to get everything.
Repository: olsh/resharper-structured-logging
Branch: master
Commit: 2c05392577cb
Files: 220
Total size: 225.9 KB
Directory structure:
gitextract_1ugkx01o/
├── .editorconfig
├── .gitattributes
├── .github/
│ └── dependabot.yml
├── .gitignore
├── .nuke/
│ ├── build.schema.json
│ └── parameters.json
├── Directory.Build.props
├── LICENSE
├── README.md
├── appveyor.yml
├── build/
│ ├── .editorconfig
│ ├── Build.cs
│ ├── Directory.Build.props
│ ├── Directory.Build.targets
│ ├── ReSharper.Structured.Logging.nuspec
│ ├── _build.csproj
│ └── _build.csproj.DotSettings
├── build.cmd
├── build.gradle
├── build.ps1
├── build.sh
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── rules/
│ ├── AnonymousObjectDestructuringProblem.md
│ ├── ComplexObjectDestructuringProblem.md
│ ├── ComplexObjectInContextDestructuringProblem.md
│ ├── ContextualLoggerProblem.md
│ ├── ExceptionPassedAsTemplateArgumentProblem.md
│ ├── InconsistentContextLogPropertyNaming.md
│ ├── InconsistentLogPropertyNaming.md
│ ├── LogMessageIsSentenceProblem.md
│ ├── PositionalPropertyUsedProblem.md
│ ├── TemplateDuplicatePropertyProblem.md
│ └── TemplateIsNotCompileTimeConstantProblem.md
├── settings.gradle
├── src/
│ ├── .idea/
│ │ └── .idea.ReSharper.Structured.Logging/
│ │ └── .idea/
│ │ ├── .gitignore
│ │ ├── .name
│ │ ├── encodings.xml
│ │ ├── indexLayout.xml
│ │ └── vcs.xml
│ ├── .run/
│ │ ├── Pack ReSharper.run.xml
│ │ ├── Pack Rider.run.xml
│ │ ├── Test ReSharper.run.xml
│ │ └── Test Rider.run.xml
│ ├── ReSharper.Structured.Logging/
│ │ ├── Analyzer/
│ │ │ ├── AnonymousTypeDestructureAnalyzer.cs
│ │ │ ├── CompileTimeConstantTemplateAnalyzer.cs
│ │ │ ├── ComplexObjectDestructureAnalyzer.cs
│ │ │ ├── ContextualLoggerConstructorAnalyzer.cs
│ │ │ ├── ContextualLoggerSerilogFactoryAnalyzer.cs
│ │ │ ├── CorrectExceptionPassingAnalyzer.cs
│ │ │ ├── DuplicatePropertiesTemplateAnalyzer.cs
│ │ │ ├── LogMessageIsSentenceAnalyzer.cs
│ │ │ ├── PositionalPropertiesUsageAnalyzer.cs
│ │ │ └── PropertiesNamingAnalyzer.cs
│ │ ├── Caching/
│ │ │ └── TemplateParameterNameAttributeProvider.cs
│ │ ├── Extensions/
│ │ │ └── PsiExtensions.cs
│ │ ├── Highlighting/
│ │ │ ├── AnonymousObjectWithoutDestructuringWarning.cs
│ │ │ ├── ComplexObjectDestructuringInContextWarning.cs
│ │ │ ├── ComplexObjectDestructuringWarning.cs
│ │ │ ├── ComplexObjectDestructuringWarningBase.cs
│ │ │ ├── ContextualLoggerWarning.cs
│ │ │ ├── DuplicateTemplatePropertyWarning.cs
│ │ │ ├── ExceptionPassedAsTemplateArgumentWarning.cs
│ │ │ ├── InconsistentContextLogPropertyNamingWarning.cs
│ │ │ ├── InconsistentLogPropertyNamingWarning.cs
│ │ │ ├── InconsistentLogPropertyNamingWarningBase.cs
│ │ │ ├── LogMessageIsSentenceWarning.cs
│ │ │ ├── PositionalPropertyUsedWarning.cs
│ │ │ ├── TemplateFormatStringNonExistingArgumentWarning.cs
│ │ │ └── TemplateIsNotCompileTimeConstantWarning.cs
│ │ ├── Models/
│ │ │ └── MessageTemplateTokenInformation.cs
│ │ ├── QuickFixes/
│ │ │ ├── AddDestructuringToMessageTemplatePropertyFix.cs
│ │ │ ├── RemoveTrailingPeriodFix.cs
│ │ │ ├── RenameContextLogPropertyFix.cs
│ │ │ ├── RenameLogPropertyFix.cs
│ │ │ └── TemplateIsNotCompileTimeConstantFix.cs
│ │ ├── ReSharper.Structured.Logging.Rider.csproj
│ │ ├── ReSharper.Structured.Logging.csproj
│ │ ├── Serilog/
│ │ │ ├── Core/
│ │ │ │ └── IMessageTemplateParser.cs
│ │ │ ├── Events/
│ │ │ │ └── MessageTemplate.cs
│ │ │ └── Parsing/
│ │ │ ├── Alignment.cs
│ │ │ ├── AlignmentDirection.cs
│ │ │ ├── Destructuring.cs
│ │ │ ├── MessageTemplateParser.cs
│ │ │ ├── MessageTemplateToken.cs
│ │ │ ├── PropertyToken.cs
│ │ │ └── TextToken.cs
│ │ ├── Settings/
│ │ │ ├── PropertyNamingType.cs
│ │ │ ├── StructuredLoggingGroup.cs
│ │ │ ├── StructuredLoggingOptionsPage.cs
│ │ │ ├── StructuredLoggingSettings.cs
│ │ │ └── StructuredLoggingSettingsAccessor.cs
│ │ ├── Utils/
│ │ │ └── PropertyNameProvider.cs
│ │ ├── Wiki/
│ │ │ └── StructuredLoggingWikiDataProvider.cs
│ │ ├── ZoneMarker.cs
│ │ └── app.config
│ ├── ReSharper.Structured.Logging.sln
│ └── rider/
│ └── main/
│ ├── kotlin/
│ │ └── com/
│ │ └── jetbrains/
│ │ └── rider/
│ │ └── settings/
│ │ ├── StructuredLoggingBundle.kt
│ │ └── StructuredLoggingPluginOptionsPage.kt
│ └── resources/
│ ├── META-INF/
│ │ └── plugin.xml
│ └── messages/
│ └── StructuredLoggingBundle.properties
└── test/
├── data/
│ ├── Analyzers/
│ │ ├── AnonymousTypeDestructure/
│ │ │ ├── SerilogWithComplexPropertyWithoutDestructure.cs
│ │ │ ├── SerilogWithComplexPropertyWithoutDestructure.cs.gold
│ │ │ ├── SerilogWithoutDestructure.cs
│ │ │ └── SerilogWithoutDestructure.cs.gold
│ │ ├── ComplexTypeDestructure/
│ │ │ ├── SerilogContextExplicitDestructure.cs
│ │ │ ├── SerilogContextExplicitDestructure.cs.gold
│ │ │ ├── SerilogContextNumericWithoutDestructure.cs
│ │ │ ├── SerilogContextNumericWithoutDestructure.cs.gold
│ │ │ ├── SerilogContextWithoutDestructure.cs
│ │ │ ├── SerilogContextWithoutDestructure.cs.gold
│ │ │ ├── SerilogCustomExceptionWithoutDestructure.cs
│ │ │ ├── SerilogCustomExceptionWithoutDestructure.cs.gold
│ │ │ ├── SerilogDictionaryWithoutDestructure.cs
│ │ │ ├── SerilogDictionaryWithoutDestructure.cs.gold
│ │ │ ├── SerilogEnumerableWithoutDestructure.cs
│ │ │ ├── SerilogEnumerableWithoutDestructure.cs.gold
│ │ │ ├── SerilogForceStringWithoutDestructure.cs
│ │ │ ├── SerilogForceStringWithoutDestructure.cs.gold
│ │ │ ├── SerilogNullableWithoutDestructure.cs
│ │ │ ├── SerilogNullableWithoutDestructure.cs.gold
│ │ │ ├── SerilogNumericWithoutDestructure.cs
│ │ │ ├── SerilogNumericWithoutDestructure.cs.gold
│ │ │ ├── SerilogParentWithOverriddenToString.cs
│ │ │ ├── SerilogParentWithOverriddenToString.cs.gold
│ │ │ ├── SerilogWithoutDestructure.cs
│ │ │ └── SerilogWithoutDestructure.cs.gold
│ │ ├── ContextualLoggerConstructor/
│ │ │ ├── MicrosoftCorrectContextType.cs
│ │ │ ├── MicrosoftCorrectContextType.cs.gold
│ │ │ ├── MicrosoftWrongContextType.cs
│ │ │ ├── MicrosoftWrongContextType.cs.gold
│ │ │ ├── MicrosoftWrongContextTypeMultipleNamespaces.cs
│ │ │ ├── MicrosoftWrongContextTypeMultipleNamespaces.cs.gold
│ │ │ ├── MicrosoftWrongContextTypeMultipleParameters.cs
│ │ │ └── MicrosoftWrongContextTypeMultipleParameters.cs.gold
│ │ ├── ContextualLoggerSerilogFactory/
│ │ │ ├── SerilogCorrectContextType.cs
│ │ │ ├── SerilogCorrectContextType.cs.gold
│ │ │ ├── SerilogWrongContextType.cs
│ │ │ └── SerilogWrongContextType.cs.gold
│ │ ├── CorrectExceptionPassing/
│ │ │ ├── SerilogCorrectExceptionPassing.cs
│ │ │ ├── SerilogCorrectExceptionPassing.cs.gold
│ │ │ ├── SerilogIncorrectExceptionPassing.cs
│ │ │ ├── SerilogIncorrectExceptionPassing.cs.gold
│ │ │ ├── SerilogIncorrectExceptionPassingDynamicTemplate.cs
│ │ │ ├── SerilogIncorrectExceptionPassingDynamicTemplate.cs.gold
│ │ │ ├── SerilogMultipleExceptionPassing.cs
│ │ │ └── SerilogMultipleExceptionPassing.cs.gold
│ │ ├── DuplicatePropertiesTemplate/
│ │ │ ├── SerilogDuplicateNamedProperty.cs
│ │ │ └── SerilogDuplicateNamedProperty.cs.gold
│ │ ├── LogMessageIsSentence/
│ │ │ ├── SerilogNotSentenceMessage.cs
│ │ │ ├── SerilogNotSentenceMessage.cs.gold
│ │ │ ├── SerilogSentenceMessage.cs
│ │ │ └── SerilogSentenceMessage.cs.gold
│ │ ├── PositionalPropertiesUsage/
│ │ │ ├── SerilogPositionProperty.cs
│ │ │ └── SerilogPositionProperty.cs.gold
│ │ ├── PropertiesNamingAnalyzer/
│ │ │ ├── SerilogContextInterpolatedStringProperty.cs
│ │ │ ├── SerilogContextInterpolatedStringProperty.cs.gold
│ │ │ ├── SerilogContextInvalidNamedProperty.cs
│ │ │ ├── SerilogContextInvalidNamedProperty.cs.gold
│ │ │ ├── SerilogIgnoredInvalidNamedProperty.cs
│ │ │ ├── SerilogIgnoredInvalidNamedProperty.cs.gold
│ │ │ ├── SerilogInvalidElasticNamedProperty.cs
│ │ │ ├── SerilogInvalidElasticNamedProperty.cs.gold
│ │ │ ├── SerilogInvalidNamedProperty.cs
│ │ │ ├── SerilogInvalidNamedProperty.cs.gold
│ │ │ ├── SerilogInvalidNamedPropertyWithDot.cs
│ │ │ ├── SerilogInvalidNamedPropertyWithDot.cs.gold
│ │ │ ├── SerilogInvalidNamedPropertyWithSpace.cs
│ │ │ ├── SerilogInvalidNamedPropertyWithSpace.cs.gold
│ │ │ ├── SerilogInvalidSyntax.cs
│ │ │ ├── SerilogInvalidSyntax.cs.gold
│ │ │ ├── SerilogValidDestructuredNamedProperty.cs
│ │ │ ├── SerilogValidDestructuredNamedProperty.cs.gold
│ │ │ ├── SerilogValidNamedProperty.cs
│ │ │ └── SerilogValidNamedProperty.cs.gold
│ │ └── PropertiesNamingAnalyzerDotNet6/
│ │ ├── ZLoggerInvalidNamedProperty.cs
│ │ └── ZLoggerInvalidNamedProperty.cs.gold
│ ├── QuickFixes/
│ │ ├── AddDestructuringFix/
│ │ │ ├── SerilogEscapedString.cs
│ │ │ ├── SerilogEscapedString.cs.gold
│ │ │ ├── SerilogNewAnonymousObject.cs
│ │ │ ├── SerilogNewAnonymousObject.cs.gold
│ │ │ ├── SerilogNewComplexObject.cs
│ │ │ └── SerilogNewComplexObject.cs.gold
│ │ ├── RemoveTrailingPeriodFix/
│ │ │ ├── SerilogTrailingPeriod.cs
│ │ │ └── SerilogTrailingPeriod.cs.gold
│ │ ├── RenameContextLogPropertyFix/
│ │ │ ├── SerilogContextProperty.cs
│ │ │ └── SerilogContextProperty.cs.gold
│ │ └── RenameLogPropertyFix/
│ │ ├── SerilogDestructuredProperty.cs
│ │ ├── SerilogDestructuredProperty.cs.gold
│ │ ├── SerilogProperty.cs
│ │ ├── SerilogProperty.cs.gold
│ │ ├── SerilogPropertyConcatenated.cs
│ │ └── SerilogPropertyConcatenated.cs.gold
│ └── nuget.config
└── src/
├── Analyzer/
│ ├── AnonymousTypeDestructureAnalyzerTests.cs
│ ├── ComplexObjectDestructureAnalyzerTests.cs
│ ├── ContextualLoggerConstructorAnalyzerTests.cs
│ ├── ContextualLoggerSerilogFactoryAnalyzerTests.cs
│ ├── CorrectExceptionPassingAnalyzerTests.cs
│ ├── DuplicatePropertiesTemplateAnalyzerTests.cs
│ ├── LogMessageIsSentenceAnalyzerTests.cs
│ ├── MessageTemplateTests.cs
│ ├── PositionalPropertiesUsageAnalyzerTests.cs
│ ├── PropertiesElasticNamingAnalyzerTests.cs
│ ├── PropertiesIgnoredRegexNamingAnalyzerTests.cs
│ ├── PropertiesNamingAnalyzerDotNet6Tests.cs
│ └── PropertiesNamingAnalyzerTests.cs
├── Constants/
│ └── NugetPackages.cs
├── QuickFixes/
│ ├── AddDestructuringToMessageTemplatePropertyFixTests.cs
│ ├── QuickFixTestBase.cs
│ ├── RemoveTrailingPeriodFixTests.cs
│ ├── RenameContextLogPropertyFixTests.cs
│ └── RenameLogPropertyFixTests.cs
├── ReSharper.Structured.Logging.Rider.Tests.csproj
├── ReSharper.Structured.Logging.Tests.csproj
├── TestEnvironment.cs
└── app.config
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
root = true
[*]
charset = utf-8
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
indent_size = 4
[{*.csproj,*.json,*.yml,*.xml,*.props,*.nuspec,*.config}]
indent_size = 2
================================================
FILE: .gitattributes
================================================
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "nuget"
directory: "/build/"
schedule:
interval: "monthly"
================================================
FILE: .gitignore
================================================
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# Rider Plugins
*.zip
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# SonarQube
.sonarqube/
# Cake
tools/
# Temp build folder
temp/
# Nuke temp files
.nuke/temp
# Gradle
.gradle/
gradle-build/
build/classes/
# Test data
/test/data/NuGetLocks/
================================================
FILE: .nuke/build.schema.json
================================================
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"Host": {
"type": "string",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Pack",
"PackRiderPlugin",
"Sonar",
"SonarBegin",
"Test",
"UpdateBuildVersion",
"UploadReSharperArtifact",
"UploadRiderArtifact"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
},
"Help": {
"type": "boolean",
"description": "Shows the help text for this build assembly"
},
"Host": {
"description": "Host for execution. Default is 'automatic'",
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
},
"Plan": {
"type": "boolean",
"description": "Shows the execution plan (HTML)"
},
"Profile": {
"type": "array",
"description": "Defines the profiles to load",
"items": {
"type": "string"
}
},
"Root": {
"type": "string",
"description": "Root directory during build execution"
},
"Skip": {
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"description": "Logging verbosity during build execution. Default is 'Normal'",
"$ref": "#/definitions/Verbosity"
}
}
}
},
"allOf": [
{
"properties": {
"Configuration": {
"type": "string"
},
"IsRiderHost": {
"type": "boolean"
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
}
}
},
{
"$ref": "#/definitions/NukeBuild"
}
]
}
================================================
FILE: .nuke/parameters.json
================================================
{
"$schema": "./build.schema.json",
"Solution": "src/ReSharper.Structured.Logging.sln"
}
================================================
FILE: Directory.Build.props
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SdkVersion>2025.1.0</SdkVersion>
</PropertyGroup>
<!-- https://jetbrains.slack.com/archives/CBZ36NH7C/p1628090127002200 -->
<PropertyGroup>
<MSBuildWarningsAsMessages>$(MSBuildWarningsAsMessages);MSB3277;MSB3270</MSBuildWarningsAsMessages>
</PropertyGroup>
</Project>
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2019 Oleg Shevchenko
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# ReSharper Structured Logging
[](https://ci.appveyor.com/project/olsh/resharper-structured-logging)
[](https://sonarcloud.io/dashboard?id=resharper-structured-logging)
An extension for ReSharper and Rider IDE that highlights structured logging templates and contains some useful analyzers
> [The highlighting is a built-in feature starting from R#/Rider 2021.2](https://github.com/olsh/resharper-structured-logging/issues/35#issuecomment-900883583),
> but the extension still contains some useful analyzers that are not (yet) implemented by JetBrains team
At the moment it supports Serilog, NLog, Microsoft.Extensions.Logging and ZLogger
## Installation ReSharper
Look for `Structured Logging` in ReSharper -> Extension manager.
[JetBrains Plugins Repository](https://plugins.jetbrains.com/plugin/12083-structured-logging)
## Installation Rider
Look for `Structured Logging` in Settings -> Plugins -> Browse repositories.
[JetBrains Plugins Repository](https://plugins.jetbrains.com/plugin/12832-structured-logging)
## Highlighting

## Analyzers
* [Anonymous object is not destructured](rules/AnonymousObjectDestructuringProblem.md)
* [Complex object is not destructured](rules/ComplexObjectDestructuringProblem.md)
* [Complex object is not destructured in context](rules/ComplexObjectInContextDestructuringProblem.md)
* [Contextual logger mismatch](rules/ContextualLoggerProblem.md)
* [Exception passed as a template argument](rules/ExceptionPassedAsTemplateArgumentProblem.md)
* [Duplicate properties in a template](rules/TemplateDuplicatePropertyProblem.md)
* [Template should be a compile-time constant](rules/TemplateIsNotCompileTimeConstantProblem.md)
* [Prefer named properties instead of positional ones](rules/PositionalPropertyUsedProblem.md)
* [Inconsistent log property naming](rules/InconsistentLogPropertyNaming.md)
* [Inconsistent log property naming in context](rules/InconsistentContextLogPropertyNaming.md)
* [Log event messages should be fragments, not sentences](rules/LogMessageIsSentenceProblem.md)
## Turning Off Analyzers
Individual analyzers can be disabled as needed either through code comments or by adding a line to a project's
`.editorconfig` file.
### Turning Off Via Comments
The analyzer name can be used as-is in a ReSharper comment to disable an analyzer on a per-file or per-line basis.
For example:
```csharp
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
```
### Turning Off Via `.editorconfig`
To disable an analyzer for an entire directory, you can add a line to a `.editorconfig` file
([learn more](https://editorconfig.org)). In this case, the analyzer name needs to be converted to `snake_case`, prefixed
with `resharper_` and suffixed with `_highlighting`. For example:
```editorconfig
resharper_template_is_not_compile_time_constant_problem_highlighting = none
```
## Credits
Inspired by [SerilogAnalyzer](https://github.com/Suchiman/SerilogAnalyzer)
================================================
FILE: appveyor.yml
================================================
image: Visual Studio 2022
skip_branch_with_pr: true
skip_tags: true
install:
- SET JAVA_HOME=C:\Program Files\Java\jdk17
- SET PATH=%JAVA_HOME%\bin;%PATH%
build_script:
- cmd: >-
build.cmd update-build-version
build.cmd upload-resharper-artifact --configuration Release
build.cmd upload-rider-artifact --configuration Release --is-rider-host
build.cmd sonar --configuration Release
test: false
cache:
- '%USERPROFILE%\.sonar\cache'
- '.gradle -> build.gradle'
================================================
FILE: build/.editorconfig
================================================
[*.cs]
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_property = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_event = false:warning
dotnet_style_require_accessibility_modifiers = never:warning
csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_properties = true:warning
csharp_style_expression_bodied_indexers = true:warning
csharp_style_expression_bodied_accessors = true:warning
================================================
FILE: build/Build.cs
================================================
using System.Text.RegularExpressions;
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.CI.AppVeyor;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.NuGet;
using Nuke.Common.Tools.NUnit;
using Nuke.Common.Tools.SonarScanner;
using static Nuke.Common.EnvironmentInfo;
using static Nuke.Common.Tools.NUnit.NUnitTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.SonarScanner.SonarScannerTasks;
using static Nuke.Common.Tools.NuGet.NuGetTasks;
[ShutdownDotNetAfterServerBuild]
class Build : NukeBuild
{
public static int Main() => Execute<Build>(x => x.Pack);
protected override void OnBuildInitialized()
{
SdkVersion = Project.GetProperty("SdkVersion");
SdkVersion.NotNull("Unable to detect SDK version");
var versionMatch = Regex.Match(SdkVersion, @"(?<version>[\d\.]+)(?<suffix>-.*)?");
SdkVersionWithoutSuffix = versionMatch.Groups["version"].ToString();
SdkVersionSuffix = versionMatch.Groups["suffix"].ToString();
ExtensionVersion = AppVeyor == null ? SdkVersion : $"{versionMatch.Groups["version"]}.{AppVeyor.BuildNumber}{versionMatch.Groups["suffix"]}";
var sdkMatch = Regex.Match(SdkVersion, @"\d{2}(\d{2}).(\d).*");
WaveMajorVersion = int.Parse(sdkMatch.Groups[1]
.Value + sdkMatch.Groups[2]
.Value);
WaveVersionsRange = $"{WaveMajorVersion}.0";
base.OnBuildInitialized();
}
[CI] readonly AppVeyor AppVeyor;
[Parameter] readonly string Configuration = "Release";
[Parameter] readonly bool IsRiderHost;
[Solution] readonly Solution Solution;
[LocalPath("./gradlew.bat")] readonly Tool Gradle;
[NuGetPackage(
packageId: "dotnet-cleanup",
packageExecutable: "cleanup.dll")]
readonly Tool DotNetCleanup;
string NuGetPackageFileName => $"{Project.Name}.{ExtensionVersion}.nupkg";
string NuGetPackagePath => RootDirectory / NuGetPackageFileName;
string RiderPackagePath => RootDirectory / "rider-structured-logging.zip";
string SonarQubeApiKey => GetVariable<string>("sonar:apikey");
Project Project => IsRiderHost
? Solution.GetProject("ReSharper.Structured.Logging.Rider")
: Solution.GetProject("ReSharper.Structured.Logging");
Project TestProject => Solution.GetProject($"{Project.Name}.Tests");
AbsolutePath OutputDirectory => Project.Directory / "bin" / Project.Name / Configuration;
AbsolutePath TestProjectOutputDirectory => TestProject.Directory / "bin" / TestProject.Name / Configuration;
string ExtensionVersion { get; set; }
string SdkVersion { get; set; }
string SdkVersionSuffix { get; set; }
string SdkVersionWithoutSuffix { get; set; }
string WaveVersionsRange { get; set; }
int WaveMajorVersion { get; set; }
Target UpdateBuildVersion => _ => _
.Requires(() => AppVeyor)
.Executes(() =>
{
AppVeyor.Instance.UpdateBuildVersion(ExtensionVersion);
});
Target Clean => _ => _
.Executes(() =>
{
DotNetCleanup($"{Solution.Path} -y -v");
});
Target Compile => _ => _
.DependsOn()
.Executes(() =>
{
DotNetBuild(s => s
.SetProjectFile(Project.Path)
.SetConfiguration(Configuration)
.SetVersionPrefix(ExtensionVersion)
.SetOutputDirectory(OutputDirectory));
});
Target Test => _ => _
.Executes(() =>
{
DotNetBuild(s => s
.SetProjectFile(TestProject.Path)
.SetConfiguration(Configuration)
.SetOutputDirectory(TestProjectOutputDirectory));
NUnit3(s => s.SetInputFiles(TestProjectOutputDirectory / $"{TestProject.Name}.dll"));
});
Target Pack => _ => _
.DependsOn(Compile)
.Requires(() => !IsRiderHost)
.Executes(() =>
{
NuGetPack(s => s
.SetTargetPath(BuildProjectDirectory / "ReSharper.Structured.Logging.nuspec")
.SetVersion(ExtensionVersion)
.SetBasePath(OutputDirectory)
.AddProperty("project", Project.Name)
.AddProperty("waveVersion", WaveVersionsRange)
.SetOutputDirectory(RootDirectory));
});
Target PackRiderPlugin => _ => _
.DependsOn(Compile)
.Requires(() => IsRiderHost)
.Executes(() =>
{
// JetBrains is not very consistent in versioning
// https://github.com/olsh/resharper-structured-logging/issues/35#issuecomment-892764206
var productVersion = SdkVersionWithoutSuffix.TrimEnd('.', '0');
if (!string.IsNullOrEmpty(SdkVersionSuffix))
{
productVersion += $"{SdkVersionSuffix.Replace("0", string.Empty).ToUpper()}-SNAPSHOT";
}
Gradle($"buildPlugin -PPluginVersion={ExtensionVersion} -PProductVersion={productVersion} -PDotNetOutputDirectory={OutputDirectory} -PDotNetProjectName={Project.Name}", logger:
(_, s) =>
{
// Gradle writes warnings to stderr
// By default logger will write stderr as errors
// AppVeyor writes errors as special messages and stops the build if such messages more than 500
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem
Serilog.Log.Debug(s);
});
(RootDirectory / "gradle-build" / "distributions" / $"rider-structured-logging-{ExtensionVersion}.zip").Copy(RiderPackagePath, ExistsPolicy.FileOverwrite);
});
Target SonarBegin => _ => _
.Unlisted()
.Before(Compile)
.Executes(() =>
{
SonarScannerBegin(s =>
{
s = s
.SetServer("https://sonarcloud.io")
.SetFramework("net5.0")
.SetLogin(SonarQubeApiKey)
.SetProjectKey("resharper-structured-logging")
.SetName("ReSharper Structured Logging")
.SetOrganization("olsh")
.SetVersion("1.0.0.0");
if (AppVeyor != null)
{
if (AppVeyor.PullRequestNumber != null)
{
s = s
.SetPullRequestKey(AppVeyor.PullRequestNumber.ToString())
.SetPullRequestBase(AppVeyor.RepositoryBranch)
.SetPullRequestBranch(AppVeyor.PullRequestHeadRepositoryBranch);
}
else
{
s = s
.SetBranchName(AppVeyor.RepositoryBranch);
}
}
return s;
});
});
Target Sonar => _ => _
.DependsOn(SonarBegin, Compile)
.Requires(() => !IsRiderHost)
.Executes(() =>
{
SonarScannerEnd(s => s
.SetLogin(SonarQubeApiKey)
.SetFramework("net5.0"));
});
Target UploadReSharperArtifact => _ => _
.DependsOn(Test, Pack)
.Requires(() => AppVeyor)
.Requires(() => !IsRiderHost)
.Executes(() =>
{
AppVeyor.PushArtifact(NuGetPackagePath);
});
Target UploadRiderArtifact => _ => _
.DependsOn(Test, PackRiderPlugin)
.Requires(() => AppVeyor)
.Requires(() => IsRiderHost)
.Executes(() =>
{
AppVeyor.PushArtifact(RiderPackagePath);
});
}
================================================
FILE: build/Directory.Build.props
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.props file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
</Project>
================================================
FILE: build/Directory.Build.targets
================================================
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This file prevents unintended imports of unrelated MSBuild files -->
<!-- Uncomment to include parent Directory.Build.targets file -->
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
</Project>
================================================
FILE: build/ReSharper.Structured.Logging.nuspec
================================================
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>$project$</id>
<version>1.0.0</version>
<title>Structured Logging</title>
<authors>Oleg Shevchenko</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<projectUrl>https://github.com/olsh/resharper-structured-logging</projectUrl>
<description>Contains some useful analyzers for structured logging. Supports Serilog, NLog, and Microsoft.Extensions.Logging.</description>
<releaseNotes>https://github.com/olsh/resharper-structured-logging/releases</releaseNotes>
<tags>resharper serilog nlog templates logging structuredlogging</tags>
<dependencies>
<dependency id="Wave" version="$waveVersion$" />
</dependencies>
</metadata>
<files>
<file src="$project$.dll" target="dotFiles" />
<file src="$project$.pdb" target="dotFiles" />
</files>
</package>
================================================
FILE: build/_build.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nuke.Common" Version="9.0.4" />
</ItemGroup>
<ItemGroup>
<PackageDownload Include="dotnet-sonarscanner" Version="[6.2.0]" />
<PackageDownload Include="NuGet.CommandLine" Version="[6.9.1]" />
<PackageDownload Include="NUnit.ConsoleRunner" Version="[3.17.0]" />
<PackageDownload Include="dotnet-cleanup" Version="[0.6.1]" />
</ItemGroup>
</Project>
================================================
FILE: build/_build.csproj.DotSettings
================================================
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=HeapView_002EDelegateAllocation/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VariableHidesOuterVariable/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ClassNeverInstantiated_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBeMadeStatic_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_INTERNAL_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/DEFAULT_PRIVATE_MODIFIER/@EntryValue">Implicit</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/METHOD_OR_OPERATOR_BODY/@EntryValue">ExpressionBody</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">0</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/MAX_ATTRIBUTE_LENGTH_FOR_SAME_LINE/@EntryValue">120</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">IF_OWNER_IS_SINGLE_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">WRAP_IF_LONG</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue"><Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy></s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue"><Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy></s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
================================================
FILE: build.cmd
================================================
:; set -eo pipefail
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
:; ${SCRIPT_DIR}/build.sh "$@"
:; exit $?
@ECHO OFF
powershell -ExecutionPolicy ByPass -NoProfile "%~dp0build.ps1" %*
================================================
FILE: build.gradle
================================================
plugins {
id 'org.jetbrains.kotlin.jvm' version '2.3.10'
id 'org.jetbrains.intellij.platform' version '2.11.0'
}
buildDir = 'gradle-build'
version = ext.PluginVersion
compileKotlin {
kotlinOptions {
jvmTarget = "17"
}
}
sourceSets {
main {
java.srcDir 'src/rider/main/kotlin'
resources.srcDir 'src/rider/main/resources'
}
}
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}
dependencies {
intellijPlatform {
rider(ProductVersion, false)
jetbrainsRuntime()
}
}
intellijPlatform {
pluginConfiguration {
name = rootProject.name
}
}
prepareSandbox {
def dotNetFiles = [
"${DotNetOutputDirectory}/${DotNetProjectName}.dll",
"${DotNetOutputDirectory}/${DotNetProjectName}.pdb",
]
dotNetFiles.forEach { f ->
def file = file(f)
from(file) {
into "${rootProject.name}/dotnet"
}
}
doLast {
dotNetFiles.forEach { f ->
if (!file(f).exists()) {
throw new RuntimeException("File $f does not exist")
}
}
}
}
wrapper {
gradleVersion = '8.13'
distributionType = Wrapper.DistributionType.ALL
distributionUrl = "https://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}
================================================
FILE: build.ps1
================================================
[CmdletBinding()]
Param(
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$BuildArguments
)
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
###########################################################################
# CONFIGURATION
###########################################################################
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj"
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0
###########################################################################
# EXECUTION
###########################################################################
function ExecSafe([scriptblock] $cmd) {
& $cmd
if ($LASTEXITCODE) { exit $LASTEXITCODE }
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
# If global.json exists, load expected version
if (Test-Path $DotNetGlobalFile) {
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
$DotNetVersion = $DotNetGlobal.sdk.version
}
}
# Install by channel or version
$DotNetDirectory = "$TempDirectory\dotnet-win"
if (!(Test-Path variable:DotNetVersion)) {
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
} else {
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
}
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
================================================
FILE: build.sh
================================================
#!/usr/bin/env bash
bash --version 2>&1 | head -n 1
set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
###########################################################################
# CONFIGURATION
###########################################################################
BUILD_PROJECT_FILE="$SCRIPT_DIR/build/_build.csproj"
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="Current"
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0
###########################################################################
# EXECUTION
###########################################################################
function FirstJsonValue {
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
}
# If dotnet CLI is installed globally and it matches requested version, use for execution
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
export DOTNET_EXE="$(command -v dotnet)"
else
# Download install script
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
mkdir -p "$TEMP_DIRECTORY"
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
chmod +x "$DOTNET_INSTALL_FILE"
# If global.json exists, load expected version
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
if [[ "$DOTNET_VERSION" == "" ]]; then
unset DOTNET_VERSION
fi
fi
# Install by channel or version
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
if [[ -z ${DOTNET_VERSION+x} ]]; then
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
fi
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-8.13-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
================================================
FILE: gradle.properties
================================================
# Any property can be overwritten from command-line via
# -P<propertyName>=<value>
PluginVersion=_PLACEHOLDER_
ProductVersion=_PLACEHOLDER_
DotNetOutputDirectory=./src/ReSharper.Structured.Logging/bin/ReSharper.Structured.Logging.Rider/Debug
DotNetProjectName=ReSharper.Structured.Logging.Rider
# We need to disable Gradle daemon after build otherwise the build hangs on build server
# https://github.com/appveyor/ci/issues/1745
org.gradle.daemon=false
# We need it to avoid bundle Kotlin jars into plugin
kotlin.stdlib.default.dependency=false
================================================
FILE: gradlew
================================================
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
================================================
FILE: gradlew.bat
================================================
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: rules/AnonymousObjectDestructuringProblem.md
================================================
#### Anonymous objects must be destructured
Noncompliant Code Examples:
```csharp
Log.Error("Processed {Position}", new { x = 4, y = 2});
```
Compliant Solution:
```csharp
Log.Error("Processed {@Position}", new { x = 4, y = 2});
```
================================================
FILE: rules/ComplexObjectDestructuringProblem.md
================================================
#### Complex objects with default `ToString()` implementation probably need to be destructured
Noncompliant Code Example:
```csharp
class User
{
public int Age { get; set; }
}
...
Log.Information("The user is {MyUser}", new User());
```
Compliant Solution:
```csharp
class User
{
public int Age { get; set; }
}
...
Log.Information("The user is {@MyUser}", new User());
// or
Log.Information("The user is {$MyUser}", new User());
```
================================================
FILE: rules/ComplexObjectInContextDestructuringProblem.md
================================================
#### Complex objects with default `ToString()` implementation probably need to be destructured
Noncompliant Code Example:
```csharp
class User
{
public int Age { get; set; }
}
...
LogContext.PushProperty("User", new User());
```
Compliant Solution:
```csharp
class User
{
public int Age { get; set; }
}
...
LogContext.PushProperty("User", new User(), true);
// or
LogContext.PushProperty("User", new User(), false);
```
================================================
FILE: rules/ContextualLoggerProblem.md
================================================
#### Incorrect type is used for contextual logger
Noncompliant Code Examples:
```csharp
class A
{
private static readonly ILogger Logger = Logger.ForContext<B>();
}
class B {}
```
```csharp
class A
{
ILogger<B> _log;
public A(ILogger<B> log)
{
_log = log;
}
}
class B { }
```
Compliant Solution:
```csharp
class A
{
private static readonly ILogger Logger = Logger.ForContext<A>();
}
class B {}
```
```csharp
class A
{
ILogger<A> _log;
public A(ILogger<A> log)
{
_log = log;
}
}
class B {}
```
================================================
FILE: rules/ExceptionPassedAsTemplateArgumentProblem.md
================================================
#### Exception passed as a template argument
Noncompliant Code Example:
```csharp
catch (Exception exception)
{
Log.Error(ex, "Disk quota {Quota} MB exceeded {Exception}", quota, exception);
}
```
Compliant Solution:
```csharp
catch (Exception exception)
{
Log.Error(exception, "Disk quota {Quota} MB exceeded", quota);
}
```
================================================
FILE: rules/InconsistentContextLogPropertyNaming.md
================================================
#### Inconsistent log property naming in context (can be configured in the extension settings)
Noncompliant Code Examples:
```csharp
LogContext.PushProperty("property_name", 1);
```
Compliant Solution:
```csharp
LogContext.PushProperty("PropertyName", 1);
```
================================================
FILE: rules/InconsistentLogPropertyNaming.md
================================================
#### Inconsistent log property naming (can be configured in the extension settings)
Noncompliant Code Examples:
```csharp
Log.Error("Processed {property_name}", 1);
```
Compliant Solution:
```csharp
Log.Error("Processed {PropertyName}", 1);
```
================================================
FILE: rules/LogMessageIsSentenceProblem.md
================================================
#### Log event messages should be fragments, not sentences
[https://benfoster.io/blog/serilog-best-practices/#message-template-recommendations](https://benfoster.io/blog/serilog-best-practices/#message-template-recommendations)
Noncompliant Code Examples:
```csharp
Log.Error("Disk quota {Quota} MB exceeded by {User}.", quota, user);
```
Compliant Solution:
```csharp
Log.Error("Disk quota {Quota} MB exceeded by {User}", quota, user);
```
================================================
FILE: rules/PositionalPropertyUsedProblem.md
================================================
#### Prefer named properties instead of positional ones
Noncompliant Code Examples:
```csharp
Log.Error("Disk quota {0} MB exceeded by {1}", quota, user);
```
Compliant Solution:
```csharp
Log.Error("Disk quota {Quota} MB exceeded by {User}", quota, user);
```
================================================
FILE: rules/TemplateDuplicatePropertyProblem.md
================================================
#### Duplicate template property
Noncompliant Code Example:
```csharp
Log.Error("Disk quota {Quota} MB exceeded by {Quota}", quota, user);
```
Compliant Solution:
```csharp
Log.Error("Disk quota {Quota} MB exceeded by {User}", quota, user);
```
================================================
FILE: rules/TemplateIsNotCompileTimeConstantProblem.md
================================================
#### Message template is not a compile time constant
Noncompliant Code Examples:
```csharp
Log.Error($"Disk quota {quota} MB exceeded by {user}");
```
```csharp
Log.Error(string.Format("Disk quota {0} MB exceeded by {1}", quota, user));
```
Compliant Solution:
```csharp
Log.Error("Disk quota {Quota} MB exceeded by {User}", quota, user);
```
================================================
FILE: settings.gradle
================================================
rootProject.name = 'rider-structured-logging'
================================================
FILE: src/.idea/.idea.ReSharper.Structured.Logging/.idea/.gitignore
================================================
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
/.idea.ReSharper.Structured.Logging.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# GitHub Copilot persisted chat sessions
/copilot/chatSessions
================================================
FILE: src/.idea/.idea.ReSharper.Structured.Logging/.idea/.name
================================================
ReSharper.Structured.Logging
================================================
FILE: src/.idea/.idea.ReSharper.Structured.Logging/.idea/encodings.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>
================================================
FILE: src/.idea/.idea.ReSharper.Structured.Logging/.idea/indexLayout.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
================================================
FILE: src/.idea/.idea.ReSharper.Structured.Logging/.idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
================================================
FILE: src/.run/Pack ReSharper.run.xml
================================================
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Pack ReSharper" type="NukeBuildTarget" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/../build/bin/Debug/_build.exe" />
<option name="PROGRAM_PARAMETERS" value="Pack" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/../build/_build.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net6.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
================================================
FILE: src/.run/Pack Rider.run.xml
================================================
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Pack Rider" type="NukeBuildTarget" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/../build/bin/Debug/_build.exe" />
<option name="PROGRAM_PARAMETERS" value="PackRiderPlugin --is-rider-host" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/../build/_build.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net6.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
================================================
FILE: src/.run/Test ReSharper.run.xml
================================================
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test ReSharper" type="NukeBuildTarget" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/../build/bin/Debug/_build.exe" />
<option name="PROGRAM_PARAMETERS" value="Test" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/../build/_build.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net6.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
================================================
FILE: src/.run/Test Rider.run.xml
================================================
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Test Rider" type="NukeBuildTarget" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/../build/bin/Debug/_build.exe" />
<option name="PROGRAM_PARAMETERS" value="Test --is-rider-host" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/../" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/../build/_build.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net6.0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/AnonymousTypeDestructureAnalyzer.cs
================================================
using System;
using System.Linq;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Serilog.Parsing;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class AnonymousTypeDestructureAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private readonly MessageTemplateParser _messageTemplateParser;
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
public AnonymousTypeDestructureAnalyzer(MessageTemplateParser messageTemplateParser, CodeAnnotationsCache codeAnnotationsCache)
{
_messageTemplateParser = messageTemplateParser;
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
protected override void Run(
IInvocationExpression element,
ElementProblemAnalyzerData data,
IHighlightingConsumer consumer)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
if (templateArgument == null)
{
return;
}
var anonymousObjectsArguments = element.ArgumentList.Arguments
.Where(a => a.Value is IAnonymousObjectCreationExpression)
.ToArray();
if (anonymousObjectsArguments.Length == 0)
{
return;
}
var templateText = templateArgument.TryGetTemplateText();
if (templateText == null)
{
return;
}
var messageTemplate = _messageTemplateParser.Parse(templateText);
if (messageTemplate.NamedProperties == null)
{
return;
}
var templateArgumentIndex = templateArgument.IndexOf();
foreach (var argument in anonymousObjectsArguments)
{
var index = argument.IndexOf() - templateArgumentIndex - 1;
if (index < messageTemplate.NamedProperties.Length)
{
var namedProperty = messageTemplate.NamedProperties[index];
if (namedProperty.Destructuring != Destructuring.Default)
{
continue;
}
var tokenInformation = templateArgument.GetTokenInformation(namedProperty);
consumer.AddHighlighting(new AnonymousObjectDestructuringWarning(tokenInformation));
}
}
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/CompileTimeConstantTemplateAnalyzer.cs
================================================
using System;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class CompileTimeConstantTemplateAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
public CompileTimeConstantTemplateAnalyzer(CodeAnnotationsCache codeAnnotationsCache)
{
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
protected override void Run(
IInvocationExpression element,
ElementProblemAnalyzerData data,
IHighlightingConsumer consumer)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
if (templateArgument?.Value == null)
{
return;
}
if (templateArgument.Value.IsConstantValue())
{
return;
}
consumer.AddHighlighting(new TemplateIsNotCompileTimeConstantWarning(element, templateArgument));
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/ComplexObjectDestructureAnalyzer.cs
================================================
using System;
using System.Linq;
using JetBrains.Metadata.Reader.API;
using JetBrains.Metadata.Reader.Impl;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Util;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Serilog.Parsing;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class ComplexObjectDestructureAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private static readonly IClrTypeName GenericDictionaryFqn = new ClrTypeName("System.Collections.Generic.Dictionary`2");
private readonly MessageTemplateParser _messageTemplateParser;
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
public ComplexObjectDestructureAnalyzer(MessageTemplateParser messageTemplateParser, CodeAnnotationsCache codeAnnotationsCache)
{
_messageTemplateParser = messageTemplateParser;
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
protected override void Run(
IInvocationExpression element,
ElementProblemAnalyzerData data,
IHighlightingConsumer consumer)
{
CheckComplexObjectInTemplate(element, consumer);
CheckComplexObjectInContext(element, consumer);
}
private void CheckComplexObjectInContext(IInvocationExpression element, IHighlightingConsumer consumer)
{
if (!element.IsSerilogContextPushPropertyMethod())
{
return;
}
// Skip the analysis if explicit destructuring specified > 2 parameters
if (element.ArgumentList.Arguments.Count != 2)
{
return;
}
var valueArgument = element.ArgumentList.Arguments[1];
if (!CheckIfDestructureNeeded(valueArgument))
{
return;
}
consumer.AddHighlighting(new ComplexObjectDestructuringInContextWarning(element));
}
private void CheckComplexObjectInTemplate(IInvocationExpression element, IHighlightingConsumer consumer)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
if (templateArgument == null)
{
return;
}
var templateText = templateArgument.TryGetTemplateText();
if (templateText == null)
{
return;
}
var messageTemplate = _messageTemplateParser.Parse(templateText);
if (messageTemplate.NamedProperties == null)
{
return;
}
var templateArgumentIndex = templateArgument.IndexOf();
var complexObject = element.ArgumentList.Arguments
.Where(a => a.IndexOf() > templateArgumentIndex)
.Where(CheckIfDestructureNeeded)
.ToArray();
if (complexObject.Length == 0)
{
return;
}
foreach (var argument in complexObject)
{
var index = argument.IndexOf() - templateArgumentIndex - 1;
if (index < messageTemplate.NamedProperties.Length)
{
var namedProperty = messageTemplate.NamedProperties[index];
if (namedProperty.Destructuring != Destructuring.Default)
{
continue;
}
consumer.AddHighlighting(
new ComplexObjectDestructuringWarning(templateArgument.GetTokenInformation(namedProperty)));
}
}
}
// ReSharper disable once CognitiveComplexity
private static bool CheckIfDestructureNeeded(ICSharpArgument argument)
{
bool CheckIfBaseToStringUsed(IType type, bool initialCheck = true)
{
// If we go through entire hierarchy and if didn't find overriden `ToString()` then this is an issue.
// But if the analyzed class is `object` itself, then this is not an issue.
if (type.IsObject())
{
return !initialCheck;
}
if (type.IsPredefinedNumeric())
{
return false;
}
if (type.IsString())
{
return false;
}
if (type.IsGuid())
{
return false;
}
var classType = type.GetClassType();
if (classType == null)
{
return false;
}
if (classType.Methods.Any(m => m.IsOverridesObjectToString()))
{
return false;
}
return CheckIfBaseToStringUsed(classType.GetBaseClassType(), false);
}
// ReSharper disable once StyleCop.SA1305
var iType = argument.GetExpressionType().ToIType();
if (iType == null)
{
return false;
}
if (iType.IsNullable())
{
var nullable = iType.GetNullableUnderlyingType();
if (nullable == null)
{
return false;
}
return CheckIfBaseToStringUsed(nullable);
}
if (iType is IDeclaredType declaredType)
{
if (Equals(declaredType.GetClrName(), GenericDictionaryFqn))
{
var argumentType = declaredType.GetFirstGenericArgumentType();
return argumentType != null && CheckIfBaseToStringUsed(argumentType);
}
var genericType = CollectionTypeUtil.GetElementTypesForGenericEnumerable(declaredType, false);
if (genericType.Count == 1)
{
return CheckIfBaseToStringUsed(genericType.Single());
}
}
return CheckIfBaseToStringUsed(iType);
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/ContextualLoggerConstructorAnalyzer.cs
================================================
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.Psi.Util;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IConstructorDeclaration))]
public class ContextualLoggerConstructorAnalyzer : ElementProblemAnalyzer<IConstructorDeclaration>
{
// ReSharper disable once CognitiveComplexity
protected override void Run(IConstructorDeclaration element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer)
{
if (element.Params?.ParameterDeclarations == null)
{
return;
}
foreach (var declaration in element.Params.ParameterDeclarations)
{
if (!(declaration.Type is IDeclaredType declaredType))
{
continue;
}
if (!declaredType.IsGenericMicrosoftExtensionsLogger())
{
continue;
}
var argumentType = declaredType.GetFirstGenericArgumentType();
if (argumentType == null)
{
continue;
}
var containingType = element.DeclaredElement?.GetContainingType();
var className = containingType?.GetClrName().FullName;
if (className == null)
{
continue;
}
if (className.Equals(argumentType.GetClassType()?.GetClrName().FullName))
{
continue;
}
consumer.AddHighlighting(new ContextualLoggerWarning(declaration.TypeUsage.GetDocumentRange()));
}
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/ContextualLoggerSerilogFactoryAnalyzer.cs
================================================
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class ContextualLoggerSerilogFactoryAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
protected override void Run(IInvocationExpression element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer)
{
if (!element.IsSerilogContextFactoryLogger())
{
return;
}
var containingNode = element.GetContainingNode<ITypeDeclaration>();
if (containingNode == null)
{
return;
}
var invocationTypeArgument = element.TypeArguments[0]?.GetScalarType()?.GetClrName();
if (invocationTypeArgument?.FullName == containingNode.CLRName)
{
return;
}
consumer.AddHighlighting(new ContextualLoggerWarning(element.GetDocumentRange()));
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/CorrectExceptionPassingAnalyzer.cs
================================================
using System;
using System.Linq;
using JetBrains.Metadata.Reader.API;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Util;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class CorrectExceptionPassingAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
public CorrectExceptionPassingAnalyzer(CodeAnnotationsCache codeAnnotationsCache)
{
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
// ReSharper disable once CognitiveComplexity
protected override void Run(
IInvocationExpression element,
ElementProblemAnalyzerData data,
IHighlightingConsumer consumer)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
if (templateArgument == null)
{
return;
}
var exceptionType = element.PsiModule.GetPredefinedType().TryGetType(PredefinedType.EXCEPTION_FQN, NullableAnnotation.Unknown);
if (exceptionType == null)
{
return;
}
ICSharpArgument invalidExceptionArgument = FindInvalidExceptionArgument(element, templateArgument, exceptionType);
if (invalidExceptionArgument == null)
{
return;
}
var overloadAvailable = false;
var candidates = element.InvocationExpressionReference.GetCandidates().ToArray();
var invalidArgumentIndex = invalidExceptionArgument.IndexOf();
foreach (var candidate in candidates)
{
if (!(candidate.GetDeclaredElement() is IMethod declaredElement))
{
continue;
}
foreach (var parameter in declaredElement.Parameters)
{
if (invalidArgumentIndex <= parameter.IndexOf())
{
break;
}
if (parameter.Type.IsSubtypeOf(exceptionType))
{
overloadAvailable = true;
break;
}
}
if (overloadAvailable)
{
break;
}
}
if (!overloadAvailable)
{
return;
}
consumer.AddHighlighting(new ExceptionPassedAsTemplateArgumentWarning(invalidExceptionArgument.GetDocumentRange()));
}
private ICSharpArgument FindInvalidExceptionArgument(IInvocationExpression invocationExpression, ICSharpArgument templateArgument, IDeclaredType exceptionType)
{
var templateArgumentIndex = templateArgument.IndexOf();
foreach (var argument in invocationExpression.ArgumentList.Arguments)
{
var argumentType = argument.Value?.Type();
if (!(argumentType is IDeclaredType declaredType))
{
continue;
}
if (!declaredType.IsSubtypeOf(exceptionType))
{
continue;
}
if (templateArgumentIndex > argument.IndexOf())
{
return null;
}
return argument;
}
return null;
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/DuplicatePropertiesTemplateAnalyzer.cs
================================================
using System;
using System.Linq;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Serilog.Parsing;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class DuplicatePropertiesTemplateAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private readonly MessageTemplateParser _messageTemplateParser;
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
public DuplicatePropertiesTemplateAnalyzer(MessageTemplateParser messageTemplateParser, CodeAnnotationsCache codeAnnotationsCache)
{
_messageTemplateParser = messageTemplateParser;
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
protected override void Run(
IInvocationExpression element,
ElementProblemAnalyzerData data,
IHighlightingConsumer consumer)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
var templateText = templateArgument?.TryGetTemplateText();
if (templateText == null)
{
return;
}
var messageTemplate = _messageTemplateParser.Parse(templateText);
if (messageTemplate.NamedProperties == null)
{
return;
}
foreach (var duplicates in messageTemplate.NamedProperties
.GroupBy(n => n.PropertyName)
.Where(g => g.Count() > 1))
{
foreach (var token in duplicates)
{
consumer.AddHighlighting(new DuplicateTemplatePropertyWarning(templateArgument.GetTokenInformation(token)));
}
}
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/LogMessageIsSentenceAnalyzer.cs
================================================
using System;
using System.Text.RegularExpressions;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Util;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression), HighlightingTypes = new[] { typeof(LogMessageIsSentenceWarning) })]
public class LogMessageIsSentenceAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
private static readonly Regex DotAtTheEnd = new Regex(@"(?<!\.)\.$", RegexOptions.Compiled);
public LogMessageIsSentenceAnalyzer(CodeAnnotationsCache codeAnnotationsCache)
{
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
protected override void Run(IInvocationExpression element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
var lastFragmentExpression = templateArgument?.TryCreateLastTemplateFragmentExpression();
if (lastFragmentExpression == null)
{
return;
}
var unquotedText = lastFragmentExpression.Expression.GetUnquotedText();
if (!DotAtTheEnd.IsMatch(unquotedText))
{
return;
}
consumer.AddHighlighting(new LogMessageIsSentenceWarning(lastFragmentExpression, DotAtTheEnd));
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/PositionalPropertiesUsageAnalyzer.cs
================================================
using System;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Serilog.Parsing;
namespace ReSharper.Structured.Logging.Analyzer
{
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class PositionalPropertiesUsageAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private readonly MessageTemplateParser _messageTemplateParser;
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
public PositionalPropertiesUsageAnalyzer(MessageTemplateParser messageTemplateParser, CodeAnnotationsCache codeAnnotationsCache)
{
_messageTemplateParser = messageTemplateParser;
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
protected override void Run(
IInvocationExpression element,
ElementProblemAnalyzerData data,
IHighlightingConsumer consumer)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
var templateText = templateArgument?.TryGetTemplateText();
if (templateText == null)
{
return;
}
var messageTemplate = _messageTemplateParser.Parse(templateText);
if (messageTemplate.PositionalProperties == null)
{
return;
}
foreach (var property in messageTemplate.PositionalProperties)
{
consumer.AddHighlighting(new PositionalPropertyUsedWarning(templateArgument.GetTokenInformation(property)));
}
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Analyzer/PropertiesNamingAnalyzer.cs
================================================
using System;
using System.Text.RegularExpressions;
using JetBrains.Application.Settings;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CodeAnnotations;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Extensions;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Serilog.Parsing;
using ReSharper.Structured.Logging.Services;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Analyzer;
[ElementProblemAnalyzer(typeof(IInvocationExpression))]
public class PropertiesNamingAnalyzer : ElementProblemAnalyzer<IInvocationExpression>
{
private readonly MessageTemplateParser _messageTemplateParser;
private readonly Lazy<TemplateParameterNameAttributeProvider> _templateParameterNameAttributeProvider;
public PropertiesNamingAnalyzer(MessageTemplateParser messageTemplateParser, CodeAnnotationsCache codeAnnotationsCache)
{
_messageTemplateParser = messageTemplateParser;
_templateParameterNameAttributeProvider = codeAnnotationsCache.GetLazyProvider<TemplateParameterNameAttributeProvider>();
}
protected override void Run(
IInvocationExpression element,
ElementProblemAnalyzerData data,
IHighlightingConsumer consumer)
{
var settingsStore = element.GetProject()
?.GetSolution()
.GetSettingsStore();
var ignoreRegexString = settingsStore?.GetValue(StructuredLoggingSettingsAccessor.IgnoredPropertiesRegex);
var ignoredPropertiesRegex = string.IsNullOrWhiteSpace(ignoreRegexString) ? null : new Regex(ignoreRegexString);
CheckPropertiesInTemplate(element, consumer, settingsStore, ignoredPropertiesRegex);
CheckPropertiesInContext(element, consumer, settingsStore, ignoredPropertiesRegex);
}
private void CheckPropertiesInTemplate(
IInvocationExpression element,
IHighlightingConsumer consumer,
IContextBoundSettingsStore settingsStore,
Regex ignoredPropertiesRegex)
{
var templateArgument = element.GetTemplateArgument(_templateParameterNameAttributeProvider.Value);
var templateText = templateArgument?.TryGetTemplateText();
if (templateText == null)
{
return;
}
var messageTemplate = _messageTemplateParser.Parse(templateText);
if (messageTemplate.NamedProperties == null)
{
return;
}
foreach (var property in messageTemplate.NamedProperties)
{
if (string.IsNullOrEmpty(property.PropertyName))
{
continue;
}
var suggestedName = GetSuggestedName(property.PropertyName, settingsStore, ignoredPropertiesRegex);
if (string.Equals(suggestedName, property.PropertyName))
{
continue;
}
consumer.AddHighlighting(
new InconsistentLogPropertyNamingWarning(templateArgument.GetTokenInformation(property), property,
suggestedName));
}
}
private void CheckPropertiesInContext(
IInvocationExpression element,
IHighlightingConsumer consumer,
IContextBoundSettingsStore settingsStore,
Regex ignoredPropertiesRegex)
{
if (!element.IsSerilogContextPushPropertyMethod())
{
return;
}
if (element.ArgumentList.Arguments.Count < 1)
{
return;
}
var propertyArgument = element.ArgumentList.Arguments[0];
var propertyName = string.Empty;
propertyArgument.Value?.ConstantValue.IsString(out propertyName);
if (string.IsNullOrEmpty(propertyName))
{
return;
}
var suggestedName = GetSuggestedName(propertyName, settingsStore, ignoredPropertiesRegex);
if (string.Equals(propertyName, suggestedName))
{
return;
}
consumer.AddHighlighting(new InconsistentContextLogPropertyNamingWarning(propertyArgument, propertyName, suggestedName));
}
private string GetSuggestedName(string propertyName, IContextBoundSettingsStore settingsStore, Regex ignoredPropertiesRegex)
{
if (ignoredPropertiesRegex != null && ignoredPropertiesRegex.IsMatch(propertyName))
{
return propertyName;
}
return PropertyNameProvider.GetSuggestedName(propertyName, settingsStore);
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Caching/TemplateParameterNameAttributeProvider.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Application.Parts;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CodeAnnotations;
namespace ReSharper.Structured.Logging.Caching;
[CodeAnnotationProvider(Instantiation.DemandAnyThreadUnsafe)]
public class TemplateParameterNameAttributeProvider(
AttributeInstancesProvider attributeInstancesProvider,
CodeAnnotationsConfiguration codeAnnotationsConfiguration)
: CodeAnnotationInfoProvider<ITypeMember, string>(attributeInstancesProvider, codeAnnotationsConfiguration, true)
{
private const string MessageTemplateFormatMethodAttribute = "MessageTemplateFormatMethodAttribute";
protected override string CalculateInfo(ITypeMember attributesOwner, IEnumerable<IAttributeInstance> attributeInstances)
{
var templateFormatAttribute = attributeInstances
.FirstOrDefault(a => string.Equals(a.GetAttributeShortName(), MessageTemplateFormatMethodAttribute, StringComparison.Ordinal));
if (templateFormatAttribute != null)
{
return templateFormatAttribute.PositionParameters()
.FirstOrDefault()
?.ConstantValue.StringValue;
}
var className = attributesOwner.ContainingType?.GetClrName().FullName;
if (className == "Microsoft.Extensions.Logging.LoggerExtensions")
{
return attributesOwner.ShortName == "BeginScope" ? "messageFormat" : "message";
}
if (className == "ZLogger.ZLoggerExtensions")
{
return "format";
}
return null;
}
protected override string GetDefaultInfo(ITypeMember attributesOwner)
{
return null;
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Extensions/PsiExtensions.cs
================================================
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using JetBrains.DocumentModel;
using JetBrains.Metadata.Reader.API;
using JetBrains.Metadata.Reader.Impl;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp.Impl.Resolve;
using JetBrains.ReSharper.Psi.CSharp.Parsing;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.Psi.Util;
using JetBrains.Util;
using ReSharper.Structured.Logging.Caching;
using ReSharper.Structured.Logging.Models;
using ReSharper.Structured.Logging.Serilog.Parsing;
namespace ReSharper.Structured.Logging.Extensions
{
public static class PsiExtensions
{
private static readonly IClrTypeName LogContextFqn = new ClrTypeName("Serilog.Context.LogContext");
[CanBeNull]
public static ICSharpArgument GetTemplateArgument(this IInvocationExpression invocationExpression, TemplateParameterNameAttributeProvider templateParameterNameAttributeProvider)
{
if (!(invocationExpression.Reference.Resolve().DeclaredElement is ITypeMember typeMember))
{
return null;
}
var templateParameterName = templateParameterNameAttributeProvider.GetInfo(typeMember);
if (string.IsNullOrEmpty(templateParameterName))
{
return null;
}
foreach (var argument in invocationExpression.ArgumentList.Arguments)
{
if (argument.MatchingParameter?.Element.ShortName == templateParameterName)
{
return argument;
}
}
return null;
}
public static MessageTemplateTokenInformation GetTokenInformation(this ICSharpArgument argument, MessageTemplateToken token)
{
var (tokenTextRange, tokenArgument) = FindTokenTextRange(argument, token);
var tokenDocument = argument.GetDocumentRange().Document;
var documentRange = new DocumentRange(tokenDocument, tokenTextRange);
return new MessageTemplateTokenInformation(documentRange, tokenArgument);
}
// ReSharper disable once CognitiveComplexity
private static (TextRange, IStringLiteralAlterer) FindTokenTextRange(this ICSharpArgument argument, MessageTemplateToken token)
{
if (argument.Value is IAdditiveExpression additiveExpression && additiveExpression.ConstantValue.IsString())
{
var arguments = new LinkedList<ExpressionArgumentInfo>();
FlattenAdditiveExpression(additiveExpression, arguments);
var globalOffset = 0;
foreach (var additiveArgument in arguments)
{
var range = additiveArgument.GetDocumentRange();
var start = range.StartOffset.Offset;
var end = range.EndOffset.Offset;
// Usually there are two quotes in the string expression
// But if it's a verbatim string, we should count @ symbol as well
var isVerbatimString = additiveArgument.Expression.IsVerbatimString();
var nonTemplateTokenCount = isVerbatimString ? 3 : 2;
// The token index is zero-based so we need to subtract 1
if (token.StartIndex < end - start - 1 - nonTemplateTokenCount + globalOffset)
{
var tokenStartIndex = start + token.StartIndex - globalOffset + 1;
if (isVerbatimString)
{
tokenStartIndex++;
}
var tokenEndIndex = tokenStartIndex + token.Length;
return (new TextRange(tokenStartIndex, end > tokenEndIndex ? tokenEndIndex : end), StringLiteralAltererUtil.TryCreateStringLiteralByExpression(additiveArgument.Expression));
}
globalOffset += end - start - nonTemplateTokenCount;
}
}
var startOffset = argument.GetDocumentRange().TextRange.StartOffset + token.StartIndex + 1;
if (argument.Expression.IsVerbatimString())
{
startOffset++;
}
// ReSharper disable once AssignNullToNotNullAttribute
return (new TextRange(startOffset, startOffset + token.Length), StringLiteralAltererUtil.TryCreateStringLiteralByExpression(argument.Expression));
}
public static string TryGetTemplateText(this ICSharpArgument argument)
{
if (argument.Value is IAdditiveExpression additiveExpression && additiveExpression.ConstantValue.IsString())
{
var linkedList = new LinkedList<ExpressionArgumentInfo>();
FlattenAdditiveExpression(additiveExpression, linkedList);
return string.Join(string.Empty, linkedList.Select(l => l.Expression.GetExpressionText()));
}
return argument.Value.GetExpressionText();
}
[CanBeNull]
public static IStringLiteralAlterer TryCreateLastTemplateFragmentExpression(this ICSharpArgument argument)
{
if (argument.Value is IAdditiveExpression additiveExpression && additiveExpression.ConstantValue.IsString())
{
var argumentInfo = additiveExpression.Arguments.Last();
if (argumentInfo is ExpressionArgumentInfo expressionArgumentInfo)
{
return StringLiteralAltererUtil.TryCreateStringLiteralByExpression(expressionArgumentInfo.Expression);
}
return null;
}
return argument.Value == null ? null : StringLiteralAltererUtil.TryCreateStringLiteralByExpression(argument.Value);
}
public static bool IsGenericMicrosoftExtensionsLogger([NotNull]this IDeclaredType declared)
{
return declared.GetClrName().FullName == "Microsoft.Extensions.Logging.ILogger`1";
}
public static bool IsSerilogContextFactoryLogger([NotNull]this IInvocationExpression invocationExpression)
{
if (invocationExpression.TypeArguments.Count != 1)
{
return false;
}
var declaredElement = invocationExpression.Reference.Resolve().DeclaredElement as IClrDeclaredElement;
var containingType = declaredElement?.GetContainingType();
if (containingType == null)
{
return false;
}
if (containingType.GetClrName().FullName == "Serilog.ILogger" && declaredElement.ShortName == "ForContext")
{
return true;
}
return false;
}
public static bool IsSerilogContextPushPropertyMethod(this IInvocationExpression invocationExpression)
{
var typeMember = invocationExpression.Reference.Resolve().DeclaredElement as ITypeMember;
var containingType = typeMember?.GetContainingType();
if (containingType == null)
{
return false;
}
return LogContextFqn.Equals(containingType.GetClrName()) && typeMember.ShortName == "PushProperty";
}
[CanBeNull]
public static IType GetFirstGenericArgumentType([NotNull]this IDeclaredType declared)
{
var substitution = declared.GetSubstitution();
var typeParameter = substitution.Domain.FirstOrDefault();
if (typeParameter == null)
{
return null;
}
return substitution.Apply(typeParameter);
}
private static bool IsVerbatimString([CanBeNull]this IExpression expression)
{
return expression?.FirstChild?.NodeType == CSharpTokenType.STRING_LITERAL_VERBATIM;
}
private static string GetExpressionText(this ICSharpExpression expression)
{
if (expression == null)
{
return null;
}
var stringLiteral = StringLiteralAltererUtil.TryCreateStringLiteralByExpression(expression);
if (stringLiteral == null)
{
return null;
}
var expressionText = stringLiteral.Expression.GetText();
if (expressionText.StartsWith("@"))
{
expressionText = expressionText.Substring(1);
}
return StringUtil.Unquote(expressionText);
}
private static void FlattenAdditiveExpression(IAdditiveExpression additiveExpression, LinkedList<ExpressionArgumentInfo> list)
{
foreach (var argumentInfo in additiveExpression.Arguments)
{
if (argumentInfo is ExpressionArgumentInfo expressionArgumentInfo && expressionArgumentInfo.Expression is IAdditiveExpression additive)
{
FlattenAdditiveExpression(additive, list);
continue;
}
list.AddLast((ExpressionArgumentInfo)argumentInfo);
}
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/AnonymousObjectWithoutDestructuringWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Models;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class AnonymousObjectDestructuringWarning : IHighlighting
{
private const string Message = "Anonymous objects must be destructured";
public const string SeverityId = "AnonymousObjectDestructuringProblem";
public AnonymousObjectDestructuringWarning(MessageTemplateTokenInformation tokenInformation)
{
TokenInformation = tokenInformation;
}
public string ErrorStripeToolTip => ToolTip;
public MessageTemplateTokenInformation TokenInformation { get; }
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return TokenInformation.DocumentRange;
}
public bool IsValid()
{
return TokenInformation.DocumentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringInContextWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class ComplexObjectDestructuringInContextWarning : ComplexObjectDestructuringWarningBase, IHighlighting
{
public const string SeverityId = "ComplexObjectInContextDestructuringProblem";
private readonly IInvocationExpression _invocationExpression;
public ComplexObjectDestructuringInContextWarning(IInvocationExpression invocationExpression)
{
_invocationExpression = invocationExpression;
}
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return _invocationExpression.GetDocumentRange();
}
public bool IsValid()
{
return _invocationExpression.GetDocumentRange().IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Models;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class ComplexObjectDestructuringWarning : ComplexObjectDestructuringWarningBase, IHighlighting
{
public const string SeverityId = "ComplexObjectDestructuringProblem";
public ComplexObjectDestructuringWarning(MessageTemplateTokenInformation tokenInformation)
{
TokenInformation = tokenInformation;
}
public string ErrorStripeToolTip => ToolTip;
public MessageTemplateTokenInformation TokenInformation { get; }
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return TokenInformation.DocumentRange;
}
public bool IsValid()
{
return TokenInformation.DocumentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringWarningBase.cs
================================================
namespace ReSharper.Structured.Logging.Highlighting
{
public abstract class ComplexObjectDestructuringWarningBase
{
protected const string Message = "Complex objects with default ToString() implementation probably need to be destructured";
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/ContextualLoggerWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class ContextualLoggerWarning : IHighlighting
{
private const string Message = "Incorrect type is used for contextual logger";
public const string SeverityId = "ContextualLoggerProblem";
private readonly DocumentRange _range;
public ContextualLoggerWarning(DocumentRange documentRange)
{
_range = documentRange;
}
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return _range;
}
public bool IsValid()
{
return _range.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/DuplicateTemplatePropertyWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Models;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class DuplicateTemplatePropertyWarning : IHighlighting
{
private const string Message = "Duplicate properties in message template";
public const string SeverityId = "TemplateDuplicatePropertyProblem";
private readonly DocumentRange _documentRange;
public DuplicateTemplatePropertyWarning(MessageTemplateTokenInformation tokenInformation)
{
_documentRange = tokenInformation.DocumentRange;
}
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return _documentRange;
}
public bool IsValid()
{
return _documentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/ExceptionPassedAsTemplateArgumentWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class ExceptionPassedAsTemplateArgumentWarning : IHighlighting
{
public const string SeverityId = "ExceptionPassedAsTemplateArgumentProblem";
private const string Message = "Exception should be passed to the exception argument";
private readonly DocumentRange _documentRange;
public ExceptionPassedAsTemplateArgumentWarning(DocumentRange documentRange)
{
_documentRange = documentRange;
}
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return _documentRange;
}
public bool IsValid()
{
return _documentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/InconsistentContextLogPropertyNamingWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class InconsistentContextLogPropertyNamingWarning : InconsistentLogPropertyNamingWarningBase, IHighlighting
{
private readonly string _propertyName;
public const string SeverityId = "InconsistentContextLogPropertyNaming";
public InconsistentContextLogPropertyNamingWarning(ICSharpArgument argument, string propertyName, string suggestedName)
{
_propertyName = propertyName;
Argument = argument;
SuggestedName = suggestedName;
}
public string ErrorStripeToolTip => ToolTip;
public ICSharpArgument Argument { get; }
public string SuggestedName { get; }
public string ToolTip => GetToolTipMessage(_propertyName, SuggestedName);
public DocumentRange CalculateRange()
{
return Argument.GetDocumentRange();
}
public bool IsValid()
{
return Argument.GetDocumentRange().IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/InconsistentLogPropertyNamingWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Models;
using ReSharper.Structured.Logging.Serilog.Parsing;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class InconsistentLogPropertyNamingWarning : InconsistentLogPropertyNamingWarningBase, IHighlighting
{
public const string SeverityId = "InconsistentLogPropertyNaming";
public InconsistentLogPropertyNamingWarning(
MessageTemplateTokenInformation tokenInformation,
PropertyToken namedProperty,
string suggestedName)
{
TokenInformation = tokenInformation;
NamedProperty = namedProperty;
SuggestedName = suggestedName;
}
public string ErrorStripeToolTip => ToolTip;
public MessageTemplateTokenInformation TokenInformation { get; }
public PropertyToken NamedProperty { get; }
public string SuggestedName { get; }
public string ToolTip => GetToolTipMessage(NamedProperty.PropertyName, SuggestedName);
public DocumentRange CalculateRange()
{
return TokenInformation.DocumentRange;
}
public bool IsValid()
{
return TokenInformation.DocumentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/InconsistentLogPropertyNamingWarningBase.cs
================================================
namespace ReSharper.Structured.Logging.Highlighting
{
public class InconsistentLogPropertyNamingWarningBase
{
protected const string Message = "Property name '{0}' does not match naming rules. Suggested name is '{1}'.";
protected string GetToolTipMessage(string propertyName, string suggestedName)
{
return $"Property name '{propertyName}' does not match naming rules. Suggested name is '{suggestedName}'.";
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/LogMessageIsSentenceWarning.cs
================================================
using System.Text.RegularExpressions;
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.Psi.Util;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class LogMessageIsSentenceWarning : IHighlighting
{
private const string Message = "Log event messages should be fragments, not sentences. Avoid a trailing period/full stop.";
public const string SeverityId = "LogMessageIsSentenceProblem";
private readonly DocumentRange _documentRange;
public LogMessageIsSentenceWarning(IStringLiteralAlterer stringLiteral, Regex regex)
{
StringLiteral = stringLiteral;
Regex = regex;
_documentRange = stringLiteral.Expression.GetDocumentRange();
}
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public IStringLiteralAlterer StringLiteral { get; }
public Regex Regex { get; }
public DocumentRange CalculateRange()
{
return _documentRange;
}
public bool IsValid()
{
return _documentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/PositionalPropertyUsedWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Models;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class PositionalPropertyUsedWarning : IHighlighting
{
private readonly MessageTemplateTokenInformation _tokenInformation;
private const string Message = "Prefer named properties instead of positional ones";
public const string SeverityId = "PositionalPropertyUsedProblem";
public PositionalPropertyUsedWarning(MessageTemplateTokenInformation tokenInformation)
{
_tokenInformation = tokenInformation;
}
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return _tokenInformation.DocumentRange;
}
public bool IsValid()
{
return _tokenInformation.DocumentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/TemplateFormatStringNonExistingArgumentWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class TemplateFormatStringNonExistingArgumentWarning : IHighlighting
{
private const string SeverityId = "TemplateFormatStringProblem";
private const string Message = "Non-existing argument in message template";
private readonly DocumentRange _documentRange;
public TemplateFormatStringNonExistingArgumentWarning(DocumentRange documentRange)
{
_documentRange = documentRange;
}
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return _documentRange;
}
public bool IsValid()
{
return _documentRange.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Highlighting/TemplateIsNotCompileTimeConstantWarning.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Feature.Services.Daemon;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Highlighting
{
[RegisterConfigurableSeverity(
SeverityId,
null,
StructuredLoggingGroup.Id,
Message,
Message,
Severity.WARNING)]
[ConfigurableSeverityHighlighting(
SeverityId,
CSharpLanguage.Name,
OverlapResolve = OverlapResolveKind.WARNING,
ToolTipFormatString = Message)]
public class TemplateIsNotCompileTimeConstantWarning : IHighlighting
{
public const string SeverityId = "TemplateIsNotCompileTimeConstantProblem";
private const string Message = "Message template should be compile time constant";
public TemplateIsNotCompileTimeConstantWarning(
IInvocationExpression invocationExpression,
ICSharpArgument messageTemplateArgument)
{
InvocationExpression = invocationExpression;
MessageTemplateArgument = messageTemplateArgument;
}
public IInvocationExpression InvocationExpression { get; }
public ICSharpArgument MessageTemplateArgument { get; }
public string ErrorStripeToolTip => ToolTip;
public string ToolTip => Message;
public DocumentRange CalculateRange()
{
return MessageTemplateArgument.Expression.GetDocumentRange();
}
public bool IsValid()
{
return MessageTemplateArgument.IsValid();
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Models/MessageTemplateTokenInformation.cs
================================================
using JetBrains.DocumentModel;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.Psi.Util;
namespace ReSharper.Structured.Logging.Models
{
public class MessageTemplateTokenInformation
{
public MessageTemplateTokenInformation(
DocumentRange documentRange,
IStringLiteralAlterer stringLiteral)
{
DocumentRange = documentRange;
StringLiteral = stringLiteral;
}
public DocumentRange DocumentRange { get; }
public IStringLiteralAlterer StringLiteral { get; }
public int RelativeStartIndex => DocumentRange.StartOffset - StringLiteral.Expression.GetDocumentRange().StartOffset - 1;
}
}
================================================
FILE: src/ReSharper.Structured.Logging/QuickFixes/AddDestructuringToMessageTemplatePropertyFix.cs
================================================
using System;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
using JetBrains.ReSharper.Psi.Util;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl;
using JetBrains.Util;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Models;
namespace ReSharper.Structured.Logging.QuickFixes
{
[QuickFix]
public class AddDestructuringToMessageTemplatePropertyFix : QuickFixBase
{
private readonly MessageTemplateTokenInformation _tokenInformation;
public AddDestructuringToMessageTemplatePropertyFix([NotNull] AnonymousObjectDestructuringWarning error)
{
_tokenInformation = error.TokenInformation;
}
public AddDestructuringToMessageTemplatePropertyFix([NotNull] ComplexObjectDestructuringWarning error)
{
_tokenInformation = error.TokenInformation;
}
public override string Text => "Add destructuring to property";
public override bool IsAvailable(IUserDataHolder cache)
{
return _tokenInformation.DocumentRange.IsValid();
}
protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
using (WriteLockCookie.Create())
{
var factory = CSharpElementFactory.GetInstance(_tokenInformation.StringLiteral.Expression, false);
var startIndex = _tokenInformation.RelativeStartIndex;
var expression = factory.CreateExpression(
$"\"{_tokenInformation.StringLiteral.Expression.GetUnquotedText().Insert(startIndex + 1, "@")}\"");
// ReSharper disable once AssignNullToNotNullAttribute
ModificationUtil.ReplaceChild(_tokenInformation.StringLiteral.Expression, expression);
}
return null;
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/QuickFixes/RemoveTrailingPeriodFix.cs
================================================
using System;
using System.Text.RegularExpressions;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.Psi.Util;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl;
using JetBrains.Util;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.QuickFixes
{
[QuickFix]
public class RemoveTrailingPeriodFix : ScopedQuickFixBase
{
private readonly IStringLiteralAlterer _stringLiteral;
private readonly Regex _regex;
public RemoveTrailingPeriodFix([NotNull] LogMessageIsSentenceWarning error)
{
_stringLiteral = error.StringLiteral;
_regex = error.Regex;
}
public override string Text => "Remove period";
public override bool IsAvailable(IUserDataHolder cache)
{
return _stringLiteral.Expression.GetDocumentRange().IsValid();
}
/// <inheritdoc />
protected override ITreeNode TryGetContextTreeNode()
{
return _stringLiteral.Expression;
}
protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
using (WriteLockCookie.Create())
{
var factory = CSharpElementFactory.GetInstance(_stringLiteral.Expression, false);
var expression = factory.CreateExpression(
$"\"{_regex.Replace(_stringLiteral.Expression.GetUnquotedText(), string.Empty)}\"");
ModificationUtil.ReplaceChild(_stringLiteral.Expression, expression);
}
return null;
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/QuickFixes/RenameContextLogPropertyFix.cs
================================================
using System;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl;
using JetBrains.Util;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.QuickFixes
{
[QuickFix]
public class RenameContextLogPropertyFix : QuickFixBase
{
private readonly ICSharpArgument _argument;
private readonly string _suggestedName;
public RenameContextLogPropertyFix([NotNull] InconsistentContextLogPropertyNamingWarning error)
{
_suggestedName = error.SuggestedName;
_argument = error.Argument;
}
public override string Text => $"Rename property to '{_suggestedName}'";
public override bool IsAvailable(IUserDataHolder cache)
{
return _argument.IsValid();
}
protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
using (WriteLockCookie.Create())
{
// ReSharper disable once AssignNullToNotNullAttribute
var factory = CSharpElementFactory.GetInstance(_argument.Expression, false);
var expression = factory.CreateExpression($"\"{_suggestedName}\"");
ModificationUtil.ReplaceChild(_argument.Expression, expression);
}
return null;
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/QuickFixes/RenameLogPropertyFix.cs
================================================
using System;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
using JetBrains.ReSharper.Psi.Util;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.TextControl;
using JetBrains.Util;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Models;
using ReSharper.Structured.Logging.Serilog.Parsing;
namespace ReSharper.Structured.Logging.QuickFixes
{
[QuickFix]
public class RenameLogPropertyFix : QuickFixBase
{
private readonly PropertyToken _namedProperty;
private readonly MessageTemplateTokenInformation _tokenInformation;
private readonly string _suggestedName;
public RenameLogPropertyFix([NotNull] InconsistentLogPropertyNamingWarning error)
{
_namedProperty = error.NamedProperty;
_suggestedName = error.SuggestedName;
_tokenInformation = error.TokenInformation;
}
public override string Text => $"Rename property to '{_suggestedName}'";
public override bool IsAvailable(IUserDataHolder cache)
{
return _tokenInformation.DocumentRange.IsValid();
}
protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
using (WriteLockCookie.Create())
{
var factory = CSharpElementFactory.GetInstance(_tokenInformation.StringLiteral.Expression, false);
var relativeStartIndex = _tokenInformation.RelativeStartIndex;
var startIndex = _namedProperty.Destructuring == Destructuring.Default
? relativeStartIndex + 1
: relativeStartIndex + 2;
var length = _namedProperty.Destructuring == Destructuring.Default
? _namedProperty.Length - 2
: _namedProperty.Length - 3;
var expression = factory.CreateExpression(
$"\"{_tokenInformation.StringLiteral.Expression.GetUnquotedText().Remove(startIndex, length).Insert(startIndex, _suggestedName)}\"");
ModificationUtil.ReplaceChild(_tokenInformation.StringLiteral.Expression, expression);
}
return null;
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/QuickFixes/TemplateIsNotCompileTimeConstantFix.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JetBrains.Annotations;
using JetBrains.Application.Progress;
using JetBrains.DocumentModel;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Feature.Services.Bulbs;
using JetBrains.ReSharper.Feature.Services.LiveTemplates.Hotspots;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Parsing;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Naming;
using JetBrains.ReSharper.Psi.Naming.Elements;
using JetBrains.ReSharper.Psi.Naming.Extentions;
using JetBrains.ReSharper.Psi.Naming.Impl;
using JetBrains.ReSharper.Psi.Naming.Settings;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.Resources.Shell;
using JetBrains.ReSharper.TestRunner.Abstractions.Extensions;
using JetBrains.TextControl;
using JetBrains.Util;
using ReSharper.Structured.Logging.Highlighting;
using ReSharper.Structured.Logging.Services;
namespace ReSharper.Structured.Logging.QuickFixes
{
[QuickFix]
public class TemplateIsNotCompileTimeConstantFix : QuickFixBase
{
public TemplateIsNotCompileTimeConstantFix([NotNull] TemplateIsNotCompileTimeConstantWarning error)
{
InvocationExpression = error.InvocationExpression;
MessageTemplateArgument = error.MessageTemplateArgument;
}
public override string Text => "Convert to compile-time constant message template";
public IInvocationExpression InvocationExpression { get; set; }
public ICSharpArgument MessageTemplateArgument { get; set; }
public override bool IsAvailable(IUserDataHolder cache)
{
return InvocationExpression.IsValid() && MessageTemplateArgument.Expression is IInterpolatedStringExpression;
}
// ReSharper disable once CognitiveComplexity
protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
{
var interpolatedExpression = (IInterpolatedStringExpression)MessageTemplateArgument.Expression.NotNull();
var elementFactory = CSharpElementFactory.GetInstance(interpolatedExpression);
var hotspots = new List<(int Start, int End, List<string> Suggestions)>();
var namingManager = solution.GetPsiServices().Naming;
var nameSuggestionManager = namingManager.Suggestion;
var namingLanguageService = NamingManager.GetNamingLanguageService(interpolatedExpression.Language);
var entryOptions = new EntryOptions(
PluralityKinds.Unknown,
SubrootPolicy.Decompose,
PredefinedPrefixPolicy.Remove);
var settingsStore = interpolatedExpression.GetSettingsStoreWithEditorConfig();
var suggestionOptions = new SuggestionOptions();
var sourceFile = interpolatedExpression.GetSourceFile()
.NotNull("interpolatedExpression.GetSourceFile() != null");
using (WriteLockCookie.Create())
{
var hotspotsRegistry = new HotspotsRegistry(interpolatedExpression.GetPsiServices());
var builder = new StringBuilder();
foreach (var treeNode in interpolatedExpression.Children())
{
if (treeNode is ITokenNode token)
{
if (treeNode.GetTokenType() == CSharpTokenType.INTERPOLATED_STRING_REGULAR_START)
builder.Append(token.GetText().Substring(2));
else if (treeNode.GetTokenType() == CSharpTokenType.INTERPOLATED_STRING_VERBATIM_START)
builder.Append(token.GetText().Substring(3));
else if (treeNode.GetTokenType() == CSharpTokenType.INTERPOLATED_STRING_REGULAR_END ||
treeNode.GetTokenType() == CSharpTokenType.INTERPOLATED_STRING_VERBATIM_END)
builder.Append(token.GetText().Substring(0, token.GetText().Length - 1));
else
builder.Append(token.GetText());
continue;
}
var insert = (IInterpolatedStringInsert)treeNode;
var namesCollection = nameSuggestionManager.CreateEmptyCollection(
PluralityKinds.Unknown,
treeNode.Language,
longerNamesFirst: true,
sourceFile);
var suggestRoots = namingLanguageService.SuggestRoots(
insert.Expression,
useExpectedTypes: false,
namesCollection.PolicyProvider);
foreach (var suggestRoot in suggestRoots)
namesCollection.Add(suggestRoot, entryOptions);
var defaultRule = namingManager.Policy.GetDefaultRule(
sourceFile,
interpolatedExpression.Language,
settingsStore,
NamedElementKinds.Property,
ElementKindOfElementType.PROPERTY);
var namesSuggestion = namesCollection.Prepare(defaultRule, ScopeKind.Common, suggestionOptions);
var firstName = PropertyNameProvider.GetSuggestedName(namesSuggestion.FirstName(), settingsStore);
hotspots.Add((
builder.Length + 1,
builder.Length + 1 + firstName.Length,
namesSuggestion.AllNames().Select(c => PropertyNameProvider.GetSuggestedName(c, settingsStore)).ToList()));
builder.Append(firstName);
var argument = elementFactory.CreateArgument(ParameterKind.VALUE, insert.Expression);
InvocationExpression.AddArgumentAfter(argument, InvocationExpression.Arguments.Last());
}
var literalExpression = elementFactory.CreateStringLiteralExpression(builder.ToString());
var literalExpressionArgument = InvocationExpression.AddArgumentAfter(
elementFactory.CreateArgument(ParameterKind.VALUE, literalExpression),
MessageTemplateArgument);
InvocationExpression.RemoveArgument(MessageTemplateArgument);
foreach (var (start, end, suggestions) in hotspots)
{
var documentRange = new DocumentRange(
literalExpressionArgument.GetDocumentStartOffset().Shift(start),
literalExpressionArgument.GetDocumentStartOffset().Shift(end));
hotspotsRegistry.Register(documentRange.CreateRangeMarker(), new TextHotspotExpression(suggestions));
}
var endSelectionRange = ExpressionStatementNavigator.GetByExpression(
InvocationExpressionNavigator.GetByArgument(literalExpressionArgument))
.GetDocumentEndOffset();
return BulbActionUtils.ExecuteHotspotSession(hotspotsRegistry, endSelectionRange);
}
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/ReSharper.Structured.Logging.Rider.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<!-- Exclude the project from analysis to prvent duplications -->
<SonarQubeExclude>true</SonarQubeExclude>
<SonarQubeTestProject>false</SonarQubeTestProject>
<RootNamespace>ReSharper.Structured.Logging</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Rider.SDK" Version="$(SdkVersion)" PrivateAssets="all" />
</ItemGroup>
</Project>
================================================
FILE: src/ReSharper.Structured.Logging/ReSharper.Structured.Logging.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<SonarQubeTestProject>false</SonarQubeTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="$(SdkVersion)" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<Folder Include="Utils\" />
</ItemGroup>
<PropertyGroup>
<OutputPath>bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
</PropertyGroup>
</Project>
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Core/IMessageTemplateParser.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using ReSharper.Structured.Logging.Serilog.Events;
namespace ReSharper.Structured.Logging.Serilog.Core
{
public interface IMessageTemplateParser
{
MessageTemplate Parse(string messageTemplate);
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Events/MessageTemplate.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Linq;
using ReSharper.Structured.Logging.Serilog.Parsing;
namespace ReSharper.Structured.Logging.Serilog.Events
{
/// <summary>
/// Represents a message template passed to a log method. The template
/// can subsequently render the template in textual form given the list
/// of properties.
/// </summary>
public class MessageTemplate
{
/// <summary>
/// Represents the empty message template.
/// </summary>
public static MessageTemplate Empty { get; } = new MessageTemplate(Enumerable.Empty<MessageTemplateToken>());
readonly MessageTemplateToken[] _tokens;
/// <summary>
/// Construct a message template using manually-defined text and property tokens.
/// </summary>
/// <param name="tokens">The text and property tokens defining the template.</param>
public MessageTemplate(IEnumerable<MessageTemplateToken> tokens)
// ReSharper disable PossibleMultipleEnumeration
: this(string.Join("", tokens), tokens)
// ReSharper enable PossibleMultipleEnumeration
{
}
/// <summary>
/// Construct a message template using manually-defined text and property tokens.
/// </summary>
/// <param name="text">The full text of the template; used by Serilog internally to avoid unneeded
/// string concatenation.</param>
/// <param name="tokens">The text and property tokens defining the template.</param>
public MessageTemplate(string text, IEnumerable<MessageTemplateToken> tokens)
{
if (text == null) throw new ArgumentNullException(nameof(text));
if (tokens == null) throw new ArgumentNullException(nameof(tokens));
Text = text;
_tokens = tokens.ToArray();
var propertyTokens = GetElementsOfTypeToArray<PropertyToken>(_tokens);
if (propertyTokens.Length != 0)
{
var allPositional = true;
var anyPositional = false;
foreach (var propertyToken in propertyTokens)
{
if (propertyToken.IsPositional)
anyPositional = true;
else
allPositional = false;
}
if (allPositional)
{
PositionalProperties = propertyTokens;
}
else
{
if (anyPositional)
IsMixedTemplate = true;
NamedProperties = propertyTokens;
}
}
}
/// <summary>
/// Similar to <see cref="Enumerable.OfType{TResult}"/>, but faster.
/// </summary>
static TResult[] GetElementsOfTypeToArray<TResult>(MessageTemplateToken[] tokens)
where TResult: class
{
var result = new List<TResult>(tokens.Length / 2);
for (var i = 0; i < tokens.Length; i++)
{
var token = tokens[i] as TResult;
if (token != null)
{
result.Add(token);
}
}
return result.ToArray();
}
/// <summary>
/// The raw text describing the template.
/// </summary>
public string Text { get; }
/// <summary>
/// Render the template as a string.
/// </summary>
/// <returns>The string representation of the template.</returns>
public override string ToString()
{
return Text;
}
/// <summary>
/// The tokens parsed from the template.
/// </summary>
public IEnumerable<MessageTemplateToken> Tokens => _tokens;
internal MessageTemplateToken[] TokenArray => _tokens;
internal PropertyToken[] NamedProperties { get; }
internal PropertyToken[] PositionalProperties { get; }
public bool IsMixedTemplate { get; }
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/Alignment.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace ReSharper.Structured.Logging.Serilog.Parsing
{
/// <summary>
/// A structure representing the alignment settings to apply when rendering a property.
/// </summary>
public struct Alignment
{
/// <summary>
/// Initializes a new instance of <see cref="Alignment"/>.
/// </summary>
/// <param name="direction">The text alignment direction.</param>
/// <param name="width">The width of the text, in characters.</param>
public Alignment(AlignmentDirection direction, int width)
{
Direction = direction;
Width = width;
}
/// <summary>
/// The text alignment direction.
/// </summary>
public AlignmentDirection Direction { get; }
/// <summary>
/// The width of the text.
/// </summary>
public int Width { get; }
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/AlignmentDirection.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace ReSharper.Structured.Logging.Serilog.Parsing
{
/// <summary>
/// Defines the direction of the alignment.
/// </summary>
public enum AlignmentDirection
{
/// <summary>
/// Text will be left-aligned.
/// </summary>
Left,
/// <summary>
/// Text will be right-aligned.
/// </summary>
Right
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/Destructuring.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace ReSharper.Structured.Logging.Serilog.Parsing
{
/// <summary>
/// Instructs the logger on how to store information about provided
/// parameters.
/// </summary>
public enum Destructuring
{
/// <summary>
/// Convert known types and objects to scalars, arrays to sequences.
/// </summary>
Default,
/// <summary>
/// Convert all types to scalar strings. Prefix name with '$'.
/// </summary>
Stringify,
/// <summary>
/// Convert known types to scalars, destructure objects and collections
/// into sequences and structures. Prefix name with '@'.
/// </summary>
Destructure
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/MessageTemplateParser.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Text;
using JetBrains.Application.Parts;
using JetBrains.ProjectModel;
using ReSharper.Structured.Logging.Serilog.Core;
using ReSharper.Structured.Logging.Serilog.Events;
namespace ReSharper.Structured.Logging.Serilog.Parsing
{
/// <summary>
/// Parses message template strings into sequences of text or property
/// tokens.
/// </summary>
#if RIDER
[SolutionComponent]
#else
[SolutionComponent(Instantiation.DemandAnyThreadSafe)]
#endif
public class MessageTemplateParser : IMessageTemplateParser
{
/// <summary>
/// Parse the supplied message template.
/// </summary>
/// <param name="messageTemplate">The message template to parse.</param>
/// <returns>A sequence of text or property tokens. Where the template
/// is not syntactically valid, text tokens will be returned. The parser
/// will make a best effort to extract valid property tokens even in the
/// presence of parsing issues.</returns>
/// <exception cref="ArgumentNullException">When <paramref name="messageTemplate"/> is <code>null</code></exception>
public MessageTemplate Parse(string messageTemplate)
{
if (messageTemplate == null) throw new ArgumentNullException(nameof(messageTemplate));
return new MessageTemplate(messageTemplate, Tokenize(messageTemplate));
}
static IEnumerable<MessageTemplateToken> Tokenize(string messageTemplate)
{
if (messageTemplate.Length == 0)
{
yield return new TextToken("", 0);
yield break;
}
var nextIndex = 0;
while (true)
{
var beforeText = nextIndex;
var tt = ParseTextToken(nextIndex, messageTemplate, out nextIndex);
if (nextIndex > beforeText)
yield return tt;
if (nextIndex == messageTemplate.Length)
yield break;
var beforeProp = nextIndex;
var pt = ParsePropertyToken(nextIndex, messageTemplate, out nextIndex);
if (beforeProp < nextIndex)
yield return pt;
if (nextIndex == messageTemplate.Length)
yield break;
}
}
// ReSharper disable once CognitiveComplexity
static MessageTemplateToken ParsePropertyToken(int startAt, string messageTemplate, out int next)
{
var first = startAt;
startAt++;
while (startAt < messageTemplate.Length && IsValidInPropertyTag(messageTemplate[startAt]))
startAt++;
if (startAt == messageTemplate.Length || messageTemplate[startAt] != '}')
{
next = startAt;
return new TextToken(messageTemplate.Substring(first, next - first), first);
}
next = startAt + 1;
var rawText = messageTemplate.Substring(first, next - first);
var tagContent = rawText.Substring(1, next - (first + 2));
if (tagContent.Length == 0)
return new TextToken(rawText, first);
if (!TrySplitTagContent(tagContent, out var propertyNameAndDestructuring, out var format, out var alignment))
return new TextToken(rawText, first);
var propertyName = propertyNameAndDestructuring;
var destructuring = Destructuring.Default;
if (propertyName.Length != 0 && TryGetDestructuringHint(propertyName[0], out destructuring))
propertyName = propertyName.Substring(1);
if (propertyName.Length == 0)
return new TextToken(rawText, first);
for (var i = 0; i < propertyName.Length; ++i)
{
var c = propertyName[i];
if (!IsValidInPropertyName(c))
return new TextToken(rawText, first);
}
if (format != null)
{
for (var i = 0; i < format.Length; ++i)
{
var c = format[i];
if (!IsValidInFormat(c))
return new TextToken(rawText, first);
}
}
Alignment? alignmentValue = null;
if (alignment != null)
{
for (var i = 0; i < alignment.Length; ++i)
{
var c = alignment[i];
if (!IsValidInAlignment(c))
return new TextToken(rawText, first);
}
var lastDash = alignment.LastIndexOf('-');
if (lastDash > 0)
return new TextToken(rawText, first);
if (!int.TryParse(lastDash == -1 ? alignment : alignment.Substring(1), out var width) || width == 0)
return new TextToken(rawText, first);
var direction = lastDash == -1 ?
AlignmentDirection.Right :
AlignmentDirection.Left;
alignmentValue = new Alignment(direction, width);
}
return new PropertyToken(
propertyName,
rawText,
format,
alignmentValue,
destructuring,
first);
}
// ReSharper disable once CognitiveComplexity
static bool TrySplitTagContent(string tagContent, out string propertyNameAndDestructuring, out string format, out string alignment)
{
var formatDelim = tagContent.IndexOf(':');
var alignmentDelim = tagContent.IndexOf(',');
if (formatDelim == -1 && alignmentDelim == -1)
{
propertyNameAndDestructuring = tagContent;
format = null;
alignment = null;
}
else
{
if (alignmentDelim == -1 || (formatDelim != -1 && alignmentDelim > formatDelim))
{
propertyNameAndDestructuring = tagContent.Substring(0, formatDelim);
format = formatDelim == tagContent.Length - 1 ?
null :
tagContent.Substring(formatDelim + 1);
alignment = null;
}
else
{
propertyNameAndDestructuring = tagContent.Substring(0, alignmentDelim);
if (formatDelim == -1)
{
if (alignmentDelim == tagContent.Length - 1)
{
alignment = format = null;
return false;
}
format = null;
alignment = tagContent.Substring(alignmentDelim + 1);
}
else
{
if (alignmentDelim == formatDelim - 1)
{
alignment = format = null;
return false;
}
alignment = tagContent.Substring(alignmentDelim + 1, formatDelim - alignmentDelim - 1);
format = formatDelim == tagContent.Length - 1 ?
null :
tagContent.Substring(formatDelim + 1);
}
}
}
return true;
}
static bool IsValidInPropertyTag(char c)
{
return IsValidInDestructuringHint(c) ||
IsValidInPropertyName(c) ||
IsValidInFormat(c) ||
c == ':';
}
static bool IsValidInPropertyName(char c) => char.IsLetterOrDigit(c) || c == '_' || c == '.' || c == ' ';
static bool TryGetDestructuringHint(char c, out Destructuring destructuring)
{
switch (c)
{
case '@':
{
destructuring = Destructuring.Destructure;
return true;
}
case '$':
{
destructuring = Destructuring.Stringify;
return true;
}
default:
{
destructuring = Destructuring.Default;
return false;
}
}
}
static bool IsValidInDestructuringHint(char c)
{
return c == '@' ||
c == '$';
}
static bool IsValidInAlignment(char c)
{
return char.IsDigit(c) ||
c == '-';
}
static bool IsValidInFormat(char c)
{
return c != '}' &&
(char.IsLetterOrDigit(c) ||
char.IsPunctuation(c) ||
c == ' ' ||
c == '+');
}
// ReSharper disable once CognitiveComplexity
private static TextToken ParseTextToken(int startAt, string messageTemplate, out int next)
{
var first = startAt;
var accum = new StringBuilder();
do
{
var nc = messageTemplate[startAt];
if (nc == '{')
{
if (startAt + 1 < messageTemplate.Length &&
messageTemplate[startAt + 1] == '{')
{
accum.Append(nc);
startAt++;
}
else
{
break;
}
}
else
{
accum.Append(nc);
if (nc == '}')
{
if (startAt + 1 < messageTemplate.Length &&
messageTemplate[startAt + 1] == '}')
{
startAt++;
}
}
}
startAt++;
} while (startAt < messageTemplate.Length);
next = startAt;
return new TextToken(accum.ToString(), first);
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/MessageTemplateToken.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace ReSharper.Structured.Logging.Serilog.Parsing
{
/// <summary>
/// An element parsed from a message template string.
/// </summary>
public abstract class MessageTemplateToken
{
/// <summary>
/// Construct a <see cref="MessageTemplateToken"/>.
/// </summary>
/// <param name="startIndex">The token's start index in the template.</param>
protected MessageTemplateToken(int startIndex)
{
StartIndex = startIndex;
}
/// <summary>
/// The token's start index in the template.
/// </summary>
// ReSharper disable once UnusedAutoPropertyAccessor.Global
public int StartIndex { get; }
/// <summary>
/// The token's length.
/// </summary>
public abstract int Length { get; }
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/PropertyToken.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.ComponentModel;
using System.Globalization;
namespace ReSharper.Structured.Logging.Serilog.Parsing
{
/// <summary>
/// A message template token representing a log event property.
/// </summary>
public sealed class PropertyToken : MessageTemplateToken
{
readonly string _rawText;
readonly int? _position;
/// <summary>
/// Construct a <see cref="PropertyToken"/>.
/// </summary>
/// <param name="propertyName">The name of the property.</param>
/// <param name="rawText">The token as it appears in the message template.</param>
/// <param name="formatObsolete">The format applied to the property, if any.</param>
/// <param name="destructuringObsolete">The destructuring strategy applied to the property, if any.</param>
/// <exception cref="ArgumentNullException"></exception>
[Obsolete("Use named arguments with this method to guarantee forwards-compatibility."), EditorBrowsable(EditorBrowsableState.Never)]
public PropertyToken(string propertyName, string rawText, string formatObsolete, Destructuring destructuringObsolete)
: this(propertyName, rawText, formatObsolete, null, destructuringObsolete)
{
}
/// <summary>
/// Construct a <see cref="PropertyToken"/>.
/// </summary>
/// <param name="propertyName">The name of the property.</param>
/// <param name="rawText">The token as it appears in the message template.</param>
/// <param name="format">The format applied to the property, if any.</param>
/// <param name="alignment">The alignment applied to the property, if any.</param>
/// <param name="destructuring">The destructuring strategy applied to the property, if any.</param>
/// <param name="startIndex">The token's start index in the template.</param>
/// <exception cref="ArgumentNullException"></exception>
public PropertyToken(string propertyName, string rawText, string format = null, Alignment? alignment = null, Destructuring destructuring = Destructuring.Default, int startIndex = -1)
: base(startIndex)
{
PropertyName = propertyName ?? throw new ArgumentNullException(nameof(propertyName));
Format = format;
Destructuring = destructuring;
_rawText = rawText ?? throw new ArgumentNullException(nameof(rawText));
Alignment = alignment;
int position;
if (int.TryParse(PropertyName, NumberStyles.None, CultureInfo.InvariantCulture, out position) &&
position >= 0)
{
_position = position;
}
}
/// <summary>
/// The token's length.
/// </summary>
public override int Length => _rawText.Length;
/// <summary>
/// The property name.
/// </summary>
public string PropertyName { get; }
/// <summary>
/// Destructuring strategy applied to the property.
/// </summary>
public Destructuring Destructuring { get; }
/// <summary>
/// Format applied to the property.
/// </summary>
public string Format { get; }
/// <summary>
/// Alignment applied to the property.
/// </summary>
public Alignment? Alignment { get; }
/// <summary>
/// True if the property name is a positional index; otherwise, false.
/// </summary>
public bool IsPositional => _position.HasValue;
internal string RawText => _rawText;
/// <summary>
/// Try to get the integer value represented by the property name.
/// </summary>
/// <param name="position">The integer value, if present.</param>
/// <returns>True if the property is positional, otherwise false.</returns>
public bool TryGetPositionalValue(out int position)
{
if (_position == null)
{
position = 0;
return false;
}
position = _position.Value;
return true;
}
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// true if the specified object is equal to the current object; otherwise, false.
/// </returns>
/// <param name="obj">The object to compare with the current object. </param><filterpriority>2</filterpriority>
public override bool Equals(object obj)
{
var pt = obj as PropertyToken;
return pt != null &&
pt.Destructuring == Destructuring &&
pt.Format == Format &&
pt.PropertyName == PropertyName &&
pt._rawText == _rawText;
}
/// <summary>
/// Serves as a hash function for a particular type.
/// </summary>
/// <returns>
/// A hash code for the current <see cref="T:System.Object"/>.
/// </returns>
/// <filterpriority>2</filterpriority>
public override int GetHashCode() => PropertyName.GetHashCode();
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>
/// A string that represents the current object.
/// </returns>
/// <filterpriority>2</filterpriority>
public override string ToString() => _rawText;
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/TextToken.cs
================================================
// Copyright 2013-2015 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
namespace ReSharper.Structured.Logging.Serilog.Parsing
{
/// <summary>
/// A message template token representing literal text.
/// </summary>
public sealed class TextToken : MessageTemplateToken
{
/// <summary>
/// Construct a <see cref="TextToken"/>.
/// </summary>
/// <param name="text">The text of the token.</param>
/// <param name="startIndex">The token's start index in the template.</param>
/// <exception cref="ArgumentNullException"></exception>
public TextToken(string text, int startIndex = -1) : base(startIndex)
{
Text = text ?? throw new ArgumentNullException(nameof(text));
}
/// <summary>
/// The token's length.
/// </summary>
public override int Length => Text.Length;
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// true if the specified object is equal to the current object; otherwise, false.
/// </returns>
/// <param name="obj">The object to compare with the current object. </param><filterpriority>2</filterpriority>
public override bool Equals(object obj)
{
var tt = obj as TextToken;
return tt != null && tt.Text == Text;
}
/// <summary>
/// Serves as a hash function for a particular type.
/// </summary>
/// <returns>
/// A hash code for the current <see cref="T:System.Object"/>.
/// </returns>
/// <filterpriority>2</filterpriority>
public override int GetHashCode() => Text.GetHashCode();
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <returns>
/// A string that represents the current object.
/// </returns>
/// <filterpriority>2</filterpriority>
public override string ToString() => Text;
/// <summary>
/// The text of the token.
/// </summary>
public string Text { get; }
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Settings/PropertyNamingType.cs
================================================
namespace ReSharper.Structured.Logging.Settings
{
public enum PropertyNamingType
{
PascalCase,
CamelCase,
SnakeCase,
/// <summary>
/// The elastic naming convention.
/// </summary>
/// <remarks>
/// https://www.elastic.co/guide/en/beats/devguide/current/event-conventions.html
/// </remarks>
ElasticNaming
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingGroup.cs
================================================
using JetBrains.ReSharper.Feature.Services.Daemon;
namespace ReSharper.Structured.Logging.Settings
{
[RegisterConfigurableHighlightingsGroup(Id, Name)]
public static class StructuredLoggingGroup
{
public const string Id = "StructuredLogging";
private const string Name = "Structured Logging Misuse";
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingOptionsPage.cs
================================================
using System;
using JetBrains.Application.Settings;
using JetBrains.Application.UI.Options;
using JetBrains.Application.UI.Options.OptionPages;
using JetBrains.Application.UI.Options.OptionsDialog;
using JetBrains.IDE.UI.Extensions;
using JetBrains.IDE.UI.Options;
using JetBrains.Lifetimes;
using JetBrains.ReSharper.Feature.Services.Resources;
namespace ReSharper.Structured.Logging.Settings
{
[OptionsPage(Pid, "Structured Logging", typeof(FeaturesEnvironmentOptionsThemedIcons.StringFormat), ParentId = EnvironmentPage.Pid)]
public class StructuredLoggingOptionsPage : BeSimpleOptionsPage
{
private const string Pid = "StructuredLogging";
public StructuredLoggingOptionsPage(
Lifetime lifetime,
OptionsPageContext optionsPageContext,
OptionsSettingsSmartContext optionsSettingsSmartContext,
bool wrapInScrollablePanel = false)
: base(lifetime, optionsPageContext, optionsSettingsSmartContext, wrapInScrollablePanel)
{
AddHeader("Log properties naming style");
AddComboOptionFromEnum(
(StructuredLoggingSettings settings) => settings.PropertyNamingType,
type =>
{
switch (type)
{
case PropertyNamingType.PascalCase:
return "PascalCase";
case PropertyNamingType.CamelCase:
return "camelCase";
case PropertyNamingType.SnakeCase:
return "snake_case";
case PropertyNamingType.ElasticNaming:
return "elastic.naming";
default:
throw new ArgumentOutOfRangeException(nameof(type), type, null);
}
});
AddHeader("Ignored properties naming");
AddCommentText("You may specify a regular expression here and if a property matches this expression, then it will be skipped during naming analysis.");
var ignoredRegex = OptionsSettingsSmartContext
.GetValueProperty(lifetime, StructuredLoggingSettingsAccessor.IgnoredPropertiesRegex);
AddControl(ignoredRegex.GetBeTextBox(lifetime));
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingSettings.cs
================================================
using JetBrains.Application.Settings;
using JetBrains.Application.Settings.WellKnownRootKeys;
namespace ReSharper.Structured.Logging.Settings
{
[SettingsKey(typeof(EnvironmentSettings), "Settings for Structured Logging")]
public class StructuredLoggingSettings
{
[SettingsEntry(PropertyNamingType.PascalCase, "Properties naming case")]
public PropertyNamingType PropertyNamingType { get; set; }
[SettingsEntry("", "Ignored properties RegEx")]
public string IgnoredPropertiesRegex { get; set; }
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingSettingsAccessor.cs
================================================
using System;
using System.Linq.Expressions;
using JetBrains.Annotations;
namespace ReSharper.Structured.Logging.Settings
{
public static class StructuredLoggingSettingsAccessor
{
[NotNull]
public static readonly Expression<Func<StructuredLoggingSettings, PropertyNamingType>> PropertyNamingType = x => x.PropertyNamingType;
[NotNull]
public static readonly Expression<Func<StructuredLoggingSettings, string>> IgnoredPropertiesRegex = x => x.IgnoredPropertiesRegex;
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Utils/PropertyNameProvider.cs
================================================
using JetBrains.Annotations;
using JetBrains.Application.Settings;
using JetBrains.Util;
using ReSharper.Structured.Logging.Settings;
namespace ReSharper.Structured.Logging.Services;
public static class PropertyNameProvider
{
public static string GetSuggestedName([NotNull]string propertyName, [CanBeNull]IContextBoundSettingsStore settingsStore)
{
var namingType = settingsStore
?.GetValue(StructuredLoggingSettingsAccessor.PropertyNamingType)
?? PropertyNamingType.PascalCase;
switch (namingType)
{
case PropertyNamingType.PascalCase:
return StringUtil.MakeUpperCamelCaseName(propertyName);
case PropertyNamingType.CamelCase:
return StringUtil.MakeUpperCamelCaseName(propertyName).Decapitalize();
case PropertyNamingType.SnakeCase:
return StringUtil.MakeUnderscoreCaseName(propertyName);
case PropertyNamingType.ElasticNaming:
return StringUtil.MakeUnderscoreCaseName(propertyName).Replace('_', '.');
default:
return propertyName;
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/Wiki/StructuredLoggingWikiDataProvider.cs
================================================
using System.Collections.Generic;
using JetBrains.Application;
using JetBrains.Application.Parts;
using JetBrains.ReSharper.Feature.Services.Explanatory;
using ReSharper.Structured.Logging.Highlighting;
namespace ReSharper.Structured.Logging.Wiki
{
[ShellComponent(Instantiation.DemandAnyThreadSafe)]
public class StructuredLoggingWikiDataProvider : ICodeInspectionWikiDataProvider
{
private static readonly IDictionary<string, string> AttributeUrlMap = new Dictionary<string, string>
{
{
DuplicateTemplatePropertyWarning.SeverityId,
CreateSeverityUrl(DuplicateTemplatePropertyWarning.SeverityId)
},
{
ExceptionPassedAsTemplateArgumentWarning.SeverityId,
CreateSeverityUrl(ExceptionPassedAsTemplateArgumentWarning.SeverityId)
},
{
TemplateIsNotCompileTimeConstantWarning.SeverityId,
CreateSeverityUrl(TemplateIsNotCompileTimeConstantWarning.SeverityId)
},
{
AnonymousObjectDestructuringWarning.SeverityId,
CreateSeverityUrl(AnonymousObjectDestructuringWarning.SeverityId)
},
{
ContextualLoggerWarning.SeverityId,
CreateSeverityUrl(ContextualLoggerWarning.SeverityId)
},
{
ComplexObjectDestructuringWarning.SeverityId,
CreateSeverityUrl(ComplexObjectDestructuringWarning.SeverityId)
},
{
PositionalPropertyUsedWarning.SeverityId,
CreateSeverityUrl(PositionalPropertyUsedWarning.SeverityId)
},
{
InconsistentLogPropertyNamingWarning.SeverityId,
CreateSeverityUrl(InconsistentLogPropertyNamingWarning.SeverityId)
},
{
LogMessageIsSentenceWarning.SeverityId,
CreateSeverityUrl(LogMessageIsSentenceWarning.SeverityId)
},
{
ComplexObjectDestructuringInContextWarning.SeverityId,
CreateSeverityUrl(ComplexObjectDestructuringInContextWarning.SeverityId)
},
{
InconsistentContextLogPropertyNamingWarning.SeverityId,
CreateSeverityUrl(InconsistentContextLogPropertyNamingWarning.SeverityId)
}
};
public bool TryGetValue(string attributeId, out string url)
{
return AttributeUrlMap.TryGetValue(attributeId, out url);
}
private static string CreateSeverityUrl(string severityId)
{
return $"https://github.com/olsh/resharper-structured-logging/blob/master/rules/{severityId}.md";
}
}
}
================================================
FILE: src/ReSharper.Structured.Logging/ZoneMarker.cs
================================================
using JetBrains.Application.BuildScript.Application.Zones;
using JetBrains.ReSharper.Psi.CSharp;
namespace ReSharper.Structured.Logging
{
[ZoneMarker]
public class ZoneMarker : IRequire<ILanguageCSharpZone>
{
}
}
================================================
FILE: src/ReSharper.Structured.Logging/app.config
================================================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
================================================
FILE: src/ReSharper.Structured.Logging.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32126.317
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReSharper.Structured.Logging", "ReSharper.Structured.Logging\ReSharper.Structured.Logging.csproj", "{0B29307F-4E38-4611-BA0D-408A4B4F4E15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReSharper.Structured.Logging.Tests", "..\test\src\ReSharper.Structured.Logging.Tests.csproj", "{D07C40A7-39BE-4725-889F-FF2F2B781442}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8F7509A6-86AF-48A9-BD71-464ED879D8FA}"
ProjectSection(SolutionItems) = preProject
..\.editorconfig = ..\.editorconfig
..\appveyor.yml = ..\appveyor.yml
..\build.gradle = ..\build.gradle
..\Directory.Build.props = ..\Directory.Build.props
rider\main\resources\META-INF\plugin.xml = rider\main\resources\META-INF\plugin.xml
..\README.md = ..\README.md
..\.gitignore = ..\.gitignore
..\.github\dependabot.yml = ..\.github\dependabot.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReSharper.Structured.Logging.Rider", "ReSharper.Structured.Logging\ReSharper.Structured.Logging.Rider.csproj", "{81C42342-6FD5-48D0-B45F-FD364B170FC1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReSharper.Structured.Logging.Rider.Tests", "..\test\src\ReSharper.Structured.Logging.Rider.Tests.csproj", "{6BC99E0B-6362-4A62-84F1-103B93896294}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Rules", "Rules", "{D93C6901-5685-495B-A790-6C1467978205}"
ProjectSection(SolutionItems) = preProject
..\rules\AnonymousObjectDestructuringProblem.md = ..\rules\AnonymousObjectDestructuringProblem.md
..\rules\ComplexObjectDestructuringProblem.md = ..\rules\ComplexObjectDestructuringProblem.md
..\rules\ComplexObjectInContextDestructuringProblem.md = ..\rules\ComplexObjectInContextDestructuringProblem.md
..\rules\ContextualLoggerProblem.md = ..\rules\ContextualLoggerProblem.md
..\rules\ExceptionPassedAsTemplateArgumentProblem.md = ..\rules\ExceptionPassedAsTemplateArgumentProblem.md
..\rules\InconsistentContextLogPropertyNaming.md = ..\rules\InconsistentContextLogPropertyNamin
gitextract_1ugkx01o/
├── .editorconfig
├── .gitattributes
├── .github/
│ └── dependabot.yml
├── .gitignore
├── .nuke/
│ ├── build.schema.json
│ └── parameters.json
├── Directory.Build.props
├── LICENSE
├── README.md
├── appveyor.yml
├── build/
│ ├── .editorconfig
│ ├── Build.cs
│ ├── Directory.Build.props
│ ├── Directory.Build.targets
│ ├── ReSharper.Structured.Logging.nuspec
│ ├── _build.csproj
│ └── _build.csproj.DotSettings
├── build.cmd
├── build.gradle
├── build.ps1
├── build.sh
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── rules/
│ ├── AnonymousObjectDestructuringProblem.md
│ ├── ComplexObjectDestructuringProblem.md
│ ├── ComplexObjectInContextDestructuringProblem.md
│ ├── ContextualLoggerProblem.md
│ ├── ExceptionPassedAsTemplateArgumentProblem.md
│ ├── InconsistentContextLogPropertyNaming.md
│ ├── InconsistentLogPropertyNaming.md
│ ├── LogMessageIsSentenceProblem.md
│ ├── PositionalPropertyUsedProblem.md
│ ├── TemplateDuplicatePropertyProblem.md
│ └── TemplateIsNotCompileTimeConstantProblem.md
├── settings.gradle
├── src/
│ ├── .idea/
│ │ └── .idea.ReSharper.Structured.Logging/
│ │ └── .idea/
│ │ ├── .gitignore
│ │ ├── .name
│ │ ├── encodings.xml
│ │ ├── indexLayout.xml
│ │ └── vcs.xml
│ ├── .run/
│ │ ├── Pack ReSharper.run.xml
│ │ ├── Pack Rider.run.xml
│ │ ├── Test ReSharper.run.xml
│ │ └── Test Rider.run.xml
│ ├── ReSharper.Structured.Logging/
│ │ ├── Analyzer/
│ │ │ ├── AnonymousTypeDestructureAnalyzer.cs
│ │ │ ├── CompileTimeConstantTemplateAnalyzer.cs
│ │ │ ├── ComplexObjectDestructureAnalyzer.cs
│ │ │ ├── ContextualLoggerConstructorAnalyzer.cs
│ │ │ ├── ContextualLoggerSerilogFactoryAnalyzer.cs
│ │ │ ├── CorrectExceptionPassingAnalyzer.cs
│ │ │ ├── DuplicatePropertiesTemplateAnalyzer.cs
│ │ │ ├── LogMessageIsSentenceAnalyzer.cs
│ │ │ ├── PositionalPropertiesUsageAnalyzer.cs
│ │ │ └── PropertiesNamingAnalyzer.cs
│ │ ├── Caching/
│ │ │ └── TemplateParameterNameAttributeProvider.cs
│ │ ├── Extensions/
│ │ │ └── PsiExtensions.cs
│ │ ├── Highlighting/
│ │ │ ├── AnonymousObjectWithoutDestructuringWarning.cs
│ │ │ ├── ComplexObjectDestructuringInContextWarning.cs
│ │ │ ├── ComplexObjectDestructuringWarning.cs
│ │ │ ├── ComplexObjectDestructuringWarningBase.cs
│ │ │ ├── ContextualLoggerWarning.cs
│ │ │ ├── DuplicateTemplatePropertyWarning.cs
│ │ │ ├── ExceptionPassedAsTemplateArgumentWarning.cs
│ │ │ ├── InconsistentContextLogPropertyNamingWarning.cs
│ │ │ ├── InconsistentLogPropertyNamingWarning.cs
│ │ │ ├── InconsistentLogPropertyNamingWarningBase.cs
│ │ │ ├── LogMessageIsSentenceWarning.cs
│ │ │ ├── PositionalPropertyUsedWarning.cs
│ │ │ ├── TemplateFormatStringNonExistingArgumentWarning.cs
│ │ │ └── TemplateIsNotCompileTimeConstantWarning.cs
│ │ ├── Models/
│ │ │ └── MessageTemplateTokenInformation.cs
│ │ ├── QuickFixes/
│ │ │ ├── AddDestructuringToMessageTemplatePropertyFix.cs
│ │ │ ├── RemoveTrailingPeriodFix.cs
│ │ │ ├── RenameContextLogPropertyFix.cs
│ │ │ ├── RenameLogPropertyFix.cs
│ │ │ └── TemplateIsNotCompileTimeConstantFix.cs
│ │ ├── ReSharper.Structured.Logging.Rider.csproj
│ │ ├── ReSharper.Structured.Logging.csproj
│ │ ├── Serilog/
│ │ │ ├── Core/
│ │ │ │ └── IMessageTemplateParser.cs
│ │ │ ├── Events/
│ │ │ │ └── MessageTemplate.cs
│ │ │ └── Parsing/
│ │ │ ├── Alignment.cs
│ │ │ ├── AlignmentDirection.cs
│ │ │ ├── Destructuring.cs
│ │ │ ├── MessageTemplateParser.cs
│ │ │ ├── MessageTemplateToken.cs
│ │ │ ├── PropertyToken.cs
│ │ │ └── TextToken.cs
│ │ ├── Settings/
│ │ │ ├── PropertyNamingType.cs
│ │ │ ├── StructuredLoggingGroup.cs
│ │ │ ├── StructuredLoggingOptionsPage.cs
│ │ │ ├── StructuredLoggingSettings.cs
│ │ │ └── StructuredLoggingSettingsAccessor.cs
│ │ ├── Utils/
│ │ │ └── PropertyNameProvider.cs
│ │ ├── Wiki/
│ │ │ └── StructuredLoggingWikiDataProvider.cs
│ │ ├── ZoneMarker.cs
│ │ └── app.config
│ ├── ReSharper.Structured.Logging.sln
│ └── rider/
│ └── main/
│ ├── kotlin/
│ │ └── com/
│ │ └── jetbrains/
│ │ └── rider/
│ │ └── settings/
│ │ ├── StructuredLoggingBundle.kt
│ │ └── StructuredLoggingPluginOptionsPage.kt
│ └── resources/
│ ├── META-INF/
│ │ └── plugin.xml
│ └── messages/
│ └── StructuredLoggingBundle.properties
└── test/
├── data/
│ ├── Analyzers/
│ │ ├── AnonymousTypeDestructure/
│ │ │ ├── SerilogWithComplexPropertyWithoutDestructure.cs
│ │ │ ├── SerilogWithComplexPropertyWithoutDestructure.cs.gold
│ │ │ ├── SerilogWithoutDestructure.cs
│ │ │ └── SerilogWithoutDestructure.cs.gold
│ │ ├── ComplexTypeDestructure/
│ │ │ ├── SerilogContextExplicitDestructure.cs
│ │ │ ├── SerilogContextExplicitDestructure.cs.gold
│ │ │ ├── SerilogContextNumericWithoutDestructure.cs
│ │ │ ├── SerilogContextNumericWithoutDestructure.cs.gold
│ │ │ ├── SerilogContextWithoutDestructure.cs
│ │ │ ├── SerilogContextWithoutDestructure.cs.gold
│ │ │ ├── SerilogCustomExceptionWithoutDestructure.cs
│ │ │ ├── SerilogCustomExceptionWithoutDestructure.cs.gold
│ │ │ ├── SerilogDictionaryWithoutDestructure.cs
│ │ │ ├── SerilogDictionaryWithoutDestructure.cs.gold
│ │ │ ├── SerilogEnumerableWithoutDestructure.cs
│ │ │ ├── SerilogEnumerableWithoutDestructure.cs.gold
│ │ │ ├── SerilogForceStringWithoutDestructure.cs
│ │ │ ├── SerilogForceStringWithoutDestructure.cs.gold
│ │ │ ├── SerilogNullableWithoutDestructure.cs
│ │ │ ├── SerilogNullableWithoutDestructure.cs.gold
│ │ │ ├── SerilogNumericWithoutDestructure.cs
│ │ │ ├── SerilogNumericWithoutDestructure.cs.gold
│ │ │ ├── SerilogParentWithOverriddenToString.cs
│ │ │ ├── SerilogParentWithOverriddenToString.cs.gold
│ │ │ ├── SerilogWithoutDestructure.cs
│ │ │ └── SerilogWithoutDestructure.cs.gold
│ │ ├── ContextualLoggerConstructor/
│ │ │ ├── MicrosoftCorrectContextType.cs
│ │ │ ├── MicrosoftCorrectContextType.cs.gold
│ │ │ ├── MicrosoftWrongContextType.cs
│ │ │ ├── MicrosoftWrongContextType.cs.gold
│ │ │ ├── MicrosoftWrongContextTypeMultipleNamespaces.cs
│ │ │ ├── MicrosoftWrongContextTypeMultipleNamespaces.cs.gold
│ │ │ ├── MicrosoftWrongContextTypeMultipleParameters.cs
│ │ │ └── MicrosoftWrongContextTypeMultipleParameters.cs.gold
│ │ ├── ContextualLoggerSerilogFactory/
│ │ │ ├── SerilogCorrectContextType.cs
│ │ │ ├── SerilogCorrectContextType.cs.gold
│ │ │ ├── SerilogWrongContextType.cs
│ │ │ └── SerilogWrongContextType.cs.gold
│ │ ├── CorrectExceptionPassing/
│ │ │ ├── SerilogCorrectExceptionPassing.cs
│ │ │ ├── SerilogCorrectExceptionPassing.cs.gold
│ │ │ ├── SerilogIncorrectExceptionPassing.cs
│ │ │ ├── SerilogIncorrectExceptionPassing.cs.gold
│ │ │ ├── SerilogIncorrectExceptionPassingDynamicTemplate.cs
│ │ │ ├── SerilogIncorrectExceptionPassingDynamicTemplate.cs.gold
│ │ │ ├── SerilogMultipleExceptionPassing.cs
│ │ │ └── SerilogMultipleExceptionPassing.cs.gold
│ │ ├── DuplicatePropertiesTemplate/
│ │ │ ├── SerilogDuplicateNamedProperty.cs
│ │ │ └── SerilogDuplicateNamedProperty.cs.gold
│ │ ├── LogMessageIsSentence/
│ │ │ ├── SerilogNotSentenceMessage.cs
│ │ │ ├── SerilogNotSentenceMessage.cs.gold
│ │ │ ├── SerilogSentenceMessage.cs
│ │ │ └── SerilogSentenceMessage.cs.gold
│ │ ├── PositionalPropertiesUsage/
│ │ │ ├── SerilogPositionProperty.cs
│ │ │ └── SerilogPositionProperty.cs.gold
│ │ ├── PropertiesNamingAnalyzer/
│ │ │ ├── SerilogContextInterpolatedStringProperty.cs
│ │ │ ├── SerilogContextInterpolatedStringProperty.cs.gold
│ │ │ ├── SerilogContextInvalidNamedProperty.cs
│ │ │ ├── SerilogContextInvalidNamedProperty.cs.gold
│ │ │ ├── SerilogIgnoredInvalidNamedProperty.cs
│ │ │ ├── SerilogIgnoredInvalidNamedProperty.cs.gold
│ │ │ ├── SerilogInvalidElasticNamedProperty.cs
│ │ │ ├── SerilogInvalidElasticNamedProperty.cs.gold
│ │ │ ├── SerilogInvalidNamedProperty.cs
│ │ │ ├── SerilogInvalidNamedProperty.cs.gold
│ │ │ ├── SerilogInvalidNamedPropertyWithDot.cs
│ │ │ ├── SerilogInvalidNamedPropertyWithDot.cs.gold
│ │ │ ├── SerilogInvalidNamedPropertyWithSpace.cs
│ │ │ ├── SerilogInvalidNamedPropertyWithSpace.cs.gold
│ │ │ ├── SerilogInvalidSyntax.cs
│ │ │ ├── SerilogInvalidSyntax.cs.gold
│ │ │ ├── SerilogValidDestructuredNamedProperty.cs
│ │ │ ├── SerilogValidDestructuredNamedProperty.cs.gold
│ │ │ ├── SerilogValidNamedProperty.cs
│ │ │ └── SerilogValidNamedProperty.cs.gold
│ │ └── PropertiesNamingAnalyzerDotNet6/
│ │ ├── ZLoggerInvalidNamedProperty.cs
│ │ └── ZLoggerInvalidNamedProperty.cs.gold
│ ├── QuickFixes/
│ │ ├── AddDestructuringFix/
│ │ │ ├── SerilogEscapedString.cs
│ │ │ ├── SerilogEscapedString.cs.gold
│ │ │ ├── SerilogNewAnonymousObject.cs
│ │ │ ├── SerilogNewAnonymousObject.cs.gold
│ │ │ ├── SerilogNewComplexObject.cs
│ │ │ └── SerilogNewComplexObject.cs.gold
│ │ ├── RemoveTrailingPeriodFix/
│ │ │ ├── SerilogTrailingPeriod.cs
│ │ │ └── SerilogTrailingPeriod.cs.gold
│ │ ├── RenameContextLogPropertyFix/
│ │ │ ├── SerilogContextProperty.cs
│ │ │ └── SerilogContextProperty.cs.gold
│ │ └── RenameLogPropertyFix/
│ │ ├── SerilogDestructuredProperty.cs
│ │ ├── SerilogDestructuredProperty.cs.gold
│ │ ├── SerilogProperty.cs
│ │ ├── SerilogProperty.cs.gold
│ │ ├── SerilogPropertyConcatenated.cs
│ │ └── SerilogPropertyConcatenated.cs.gold
│ └── nuget.config
└── src/
├── Analyzer/
│ ├── AnonymousTypeDestructureAnalyzerTests.cs
│ ├── ComplexObjectDestructureAnalyzerTests.cs
│ ├── ContextualLoggerConstructorAnalyzerTests.cs
│ ├── ContextualLoggerSerilogFactoryAnalyzerTests.cs
│ ├── CorrectExceptionPassingAnalyzerTests.cs
│ ├── DuplicatePropertiesTemplateAnalyzerTests.cs
│ ├── LogMessageIsSentenceAnalyzerTests.cs
│ ├── MessageTemplateTests.cs
│ ├── PositionalPropertiesUsageAnalyzerTests.cs
│ ├── PropertiesElasticNamingAnalyzerTests.cs
│ ├── PropertiesIgnoredRegexNamingAnalyzerTests.cs
│ ├── PropertiesNamingAnalyzerDotNet6Tests.cs
│ └── PropertiesNamingAnalyzerTests.cs
├── Constants/
│ └── NugetPackages.cs
├── QuickFixes/
│ ├── AddDestructuringToMessageTemplatePropertyFixTests.cs
│ ├── QuickFixTestBase.cs
│ ├── RemoveTrailingPeriodFixTests.cs
│ ├── RenameContextLogPropertyFixTests.cs
│ └── RenameLogPropertyFixTests.cs
├── ReSharper.Structured.Logging.Rider.Tests.csproj
├── ReSharper.Structured.Logging.Tests.csproj
├── TestEnvironment.cs
└── app.config
SYMBOL INDEX (349 symbols across 116 files)
FILE: build/Build.cs
class Build (line 20) | [ShutdownDotNetAfterServerBuild]
method Main (line 23) | public static int Main() => Execute<Build>(x => x.Pack);
method OnBuildInitialized (line 25) | protected override void OnBuildInitialized()
FILE: src/ReSharper.Structured.Logging/Analyzer/AnonymousTypeDestructureAnalyzer.cs
class AnonymousTypeDestructureAnalyzer (line 16) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method AnonymousTypeDestructureAnalyzer (line 23) | public AnonymousTypeDestructureAnalyzer(MessageTemplateParser messageT...
method Run (line 29) | protected override void Run(
FILE: src/ReSharper.Structured.Logging/Analyzer/CompileTimeConstantTemplateAnalyzer.cs
class CompileTimeConstantTemplateAnalyzer (line 13) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method CompileTimeConstantTemplateAnalyzer (line 18) | public CompileTimeConstantTemplateAnalyzer(CodeAnnotationsCache codeAn...
method Run (line 23) | protected override void Run(
FILE: src/ReSharper.Structured.Logging/Analyzer/ComplexObjectDestructureAnalyzer.cs
class ComplexObjectDestructureAnalyzer (line 19) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method ComplexObjectDestructureAnalyzer (line 28) | public ComplexObjectDestructureAnalyzer(MessageTemplateParser messageT...
method Run (line 34) | protected override void Run(
method CheckComplexObjectInContext (line 43) | private void CheckComplexObjectInContext(IInvocationExpression element...
method CheckComplexObjectInTemplate (line 65) | private void CheckComplexObjectInTemplate(IInvocationExpression elemen...
method CheckIfDestructureNeeded (line 114) | private static bool CheckIfDestructureNeeded(ICSharpArgument argument)
FILE: src/ReSharper.Structured.Logging/Analyzer/ContextualLoggerConstructorAnalyzer.cs
class ContextualLoggerConstructorAnalyzer (line 12) | [ElementProblemAnalyzer(typeof(IConstructorDeclaration))]
method Run (line 16) | protected override void Run(IConstructorDeclaration element, ElementPr...
FILE: src/ReSharper.Structured.Logging/Analyzer/ContextualLoggerSerilogFactoryAnalyzer.cs
class ContextualLoggerSerilogFactoryAnalyzer (line 10) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method Run (line 13) | protected override void Run(IInvocationExpression element, ElementProb...
FILE: src/ReSharper.Structured.Logging/Analyzer/CorrectExceptionPassingAnalyzer.cs
class CorrectExceptionPassingAnalyzer (line 16) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method CorrectExceptionPassingAnalyzer (line 21) | public CorrectExceptionPassingAnalyzer(CodeAnnotationsCache codeAnnota...
method Run (line 27) | protected override void Run(
method FindInvalidExceptionArgument (line 88) | private ICSharpArgument FindInvalidExceptionArgument(IInvocationExpres...
FILE: src/ReSharper.Structured.Logging/Analyzer/DuplicatePropertiesTemplateAnalyzer.cs
class DuplicatePropertiesTemplateAnalyzer (line 15) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method DuplicatePropertiesTemplateAnalyzer (line 22) | public DuplicatePropertiesTemplateAnalyzer(MessageTemplateParser messa...
method Run (line 28) | protected override void Run(
FILE: src/ReSharper.Structured.Logging/Analyzer/LogMessageIsSentenceAnalyzer.cs
class LogMessageIsSentenceAnalyzer (line 15) | [ElementProblemAnalyzer(typeof(IInvocationExpression), HighlightingTypes...
method LogMessageIsSentenceAnalyzer (line 22) | public LogMessageIsSentenceAnalyzer(CodeAnnotationsCache codeAnnotatio...
method Run (line 27) | protected override void Run(IInvocationExpression element, ElementProb...
FILE: src/ReSharper.Structured.Logging/Analyzer/PositionalPropertiesUsageAnalyzer.cs
class PositionalPropertiesUsageAnalyzer (line 14) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method PositionalPropertiesUsageAnalyzer (line 21) | public PositionalPropertiesUsageAnalyzer(MessageTemplateParser message...
method Run (line 27) | protected override void Run(
FILE: src/ReSharper.Structured.Logging/Analyzer/PropertiesNamingAnalyzer.cs
class PropertiesNamingAnalyzer (line 20) | [ElementProblemAnalyzer(typeof(IInvocationExpression))]
method PropertiesNamingAnalyzer (line 27) | public PropertiesNamingAnalyzer(MessageTemplateParser messageTemplateP...
method Run (line 33) | protected override void Run(
method CheckPropertiesInTemplate (line 49) | private void CheckPropertiesInTemplate(
method CheckPropertiesInContext (line 87) | private void CheckPropertiesInContext(
method GetSuggestedName (line 121) | private string GetSuggestedName(string propertyName, IContextBoundSett...
FILE: src/ReSharper.Structured.Logging/Caching/TemplateParameterNameAttributeProvider.cs
class TemplateParameterNameAttributeProvider (line 11) | [CodeAnnotationProvider(Instantiation.DemandAnyThreadUnsafe)]
method CalculateInfo (line 19) | protected override string CalculateInfo(ITypeMember attributesOwner, I...
method GetDefaultInfo (line 45) | protected override string GetDefaultInfo(ITypeMember attributesOwner)
FILE: src/ReSharper.Structured.Logging/Extensions/PsiExtensions.cs
class PsiExtensions (line 22) | public static class PsiExtensions
method GetTemplateArgument (line 26) | [CanBeNull]
method GetTokenInformation (line 51) | public static MessageTemplateTokenInformation GetTokenInformation(this...
method FindTokenTextRange (line 61) | private static (TextRange, IStringLiteralAlterer) FindTokenTextRange(t...
method TryGetTemplateText (line 108) | public static string TryGetTemplateText(this ICSharpArgument argument)
method TryCreateLastTemplateFragmentExpression (line 121) | [CanBeNull]
method IsGenericMicrosoftExtensionsLogger (line 138) | public static bool IsGenericMicrosoftExtensionsLogger([NotNull]this ID...
method IsSerilogContextFactoryLogger (line 143) | public static bool IsSerilogContextFactoryLogger([NotNull]this IInvoca...
method IsSerilogContextPushPropertyMethod (line 165) | public static bool IsSerilogContextPushPropertyMethod(this IInvocation...
method GetFirstGenericArgumentType (line 177) | [CanBeNull]
method IsVerbatimString (line 190) | private static bool IsVerbatimString([CanBeNull]this IExpression expre...
method GetExpressionText (line 195) | private static string GetExpressionText(this ICSharpExpression express...
method FlattenAdditiveExpression (line 217) | private static void FlattenAdditiveExpression(IAdditiveExpression addi...
FILE: src/ReSharper.Structured.Logging/Highlighting/AnonymousObjectWithoutDestructuringWarning.cs
class AnonymousObjectDestructuringWarning (line 10) | [RegisterConfigurableSeverity(
method AnonymousObjectDestructuringWarning (line 28) | public AnonymousObjectDestructuringWarning(MessageTemplateTokenInforma...
method CalculateRange (line 39) | public DocumentRange CalculateRange()
method IsValid (line 44) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringInContextWarning.cs
class ComplexObjectDestructuringInContextWarning (line 11) | [RegisterConfigurableSeverity(
method ComplexObjectDestructuringInContextWarning (line 29) | public ComplexObjectDestructuringInContextWarning(IInvocationExpressio...
method CalculateRange (line 38) | public DocumentRange CalculateRange()
method IsValid (line 43) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringWarning.cs
class ComplexObjectDestructuringWarning (line 10) | [RegisterConfigurableSeverity(
method ComplexObjectDestructuringWarning (line 26) | public ComplexObjectDestructuringWarning(MessageTemplateTokenInformati...
method CalculateRange (line 37) | public DocumentRange CalculateRange()
method IsValid (line 42) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringWarningBase.cs
class ComplexObjectDestructuringWarningBase (line 3) | public abstract class ComplexObjectDestructuringWarningBase
FILE: src/ReSharper.Structured.Logging/Highlighting/ContextualLoggerWarning.cs
class ContextualLoggerWarning (line 9) | [RegisterConfigurableSeverity(
method ContextualLoggerWarning (line 29) | public ContextualLoggerWarning(DocumentRange documentRange)
method CalculateRange (line 38) | public DocumentRange CalculateRange()
method IsValid (line 43) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/DuplicateTemplatePropertyWarning.cs
class DuplicateTemplatePropertyWarning (line 10) | [RegisterConfigurableSeverity(
method DuplicateTemplatePropertyWarning (line 30) | public DuplicateTemplatePropertyWarning(MessageTemplateTokenInformatio...
method CalculateRange (line 39) | public DocumentRange CalculateRange()
method IsValid (line 44) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/ExceptionPassedAsTemplateArgumentWarning.cs
class ExceptionPassedAsTemplateArgumentWarning (line 9) | [RegisterConfigurableSeverity(
method ExceptionPassedAsTemplateArgumentWarning (line 29) | public ExceptionPassedAsTemplateArgumentWarning(DocumentRange document...
method CalculateRange (line 38) | public DocumentRange CalculateRange()
method IsValid (line 43) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/InconsistentContextLogPropertyNamingWarning.cs
class InconsistentContextLogPropertyNamingWarning (line 10) | [RegisterConfigurableSeverity(
method InconsistentContextLogPropertyNamingWarning (line 28) | public InconsistentContextLogPropertyNamingWarning(ICSharpArgument arg...
method CalculateRange (line 44) | public DocumentRange CalculateRange()
method IsValid (line 49) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/InconsistentLogPropertyNamingWarning.cs
class InconsistentLogPropertyNamingWarning (line 11) | [RegisterConfigurableSeverity(
method InconsistentLogPropertyNamingWarning (line 27) | public InconsistentLogPropertyNamingWarning(
method CalculateRange (line 47) | public DocumentRange CalculateRange()
method IsValid (line 52) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/InconsistentLogPropertyNamingWarningBase.cs
class InconsistentLogPropertyNamingWarningBase (line 3) | public class InconsistentLogPropertyNamingWarningBase
method GetToolTipMessage (line 7) | protected string GetToolTipMessage(string propertyName, string suggest...
FILE: src/ReSharper.Structured.Logging/Highlighting/LogMessageIsSentenceWarning.cs
class LogMessageIsSentenceWarning (line 13) | [RegisterConfigurableSeverity(
method LogMessageIsSentenceWarning (line 33) | public LogMessageIsSentenceWarning(IStringLiteralAlterer stringLiteral...
method CalculateRange (line 48) | public DocumentRange CalculateRange()
method IsValid (line 53) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/PositionalPropertyUsedWarning.cs
class PositionalPropertyUsedWarning (line 10) | [RegisterConfigurableSeverity(
method PositionalPropertyUsedWarning (line 30) | public PositionalPropertyUsedWarning(MessageTemplateTokenInformation t...
method CalculateRange (line 39) | public DocumentRange CalculateRange()
method IsValid (line 44) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/TemplateFormatStringNonExistingArgumentWarning.cs
class TemplateFormatStringNonExistingArgumentWarning (line 9) | [RegisterConfigurableSeverity(
method TemplateFormatStringNonExistingArgumentWarning (line 29) | public TemplateFormatStringNonExistingArgumentWarning(DocumentRange do...
method CalculateRange (line 38) | public DocumentRange CalculateRange()
method IsValid (line 43) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Highlighting/TemplateIsNotCompileTimeConstantWarning.cs
class TemplateIsNotCompileTimeConstantWarning (line 11) | [RegisterConfigurableSeverity(
method TemplateIsNotCompileTimeConstantWarning (line 29) | public TemplateIsNotCompileTimeConstantWarning(
method CalculateRange (line 44) | public DocumentRange CalculateRange()
method IsValid (line 49) | public bool IsValid()
FILE: src/ReSharper.Structured.Logging/Models/MessageTemplateTokenInformation.cs
class MessageTemplateTokenInformation (line 7) | public class MessageTemplateTokenInformation
method MessageTemplateTokenInformation (line 9) | public MessageTemplateTokenInformation(
FILE: src/ReSharper.Structured.Logging/QuickFixes/AddDestructuringToMessageTemplatePropertyFix.cs
class AddDestructuringToMessageTemplatePropertyFix (line 19) | [QuickFix]
method AddDestructuringToMessageTemplatePropertyFix (line 24) | public AddDestructuringToMessageTemplatePropertyFix([NotNull] Anonymou...
method AddDestructuringToMessageTemplatePropertyFix (line 29) | public AddDestructuringToMessageTemplatePropertyFix([NotNull] ComplexO...
method IsAvailable (line 36) | public override bool IsAvailable(IUserDataHolder cache)
method ExecutePsiTransaction (line 41) | protected override Action<ITextControl> ExecutePsiTransaction(ISolutio...
FILE: src/ReSharper.Structured.Logging/QuickFixes/RemoveTrailingPeriodFix.cs
class RemoveTrailingPeriodFix (line 20) | [QuickFix]
method RemoveTrailingPeriodFix (line 27) | public RemoveTrailingPeriodFix([NotNull] LogMessageIsSentenceWarning e...
method IsAvailable (line 35) | public override bool IsAvailable(IUserDataHolder cache)
method TryGetContextTreeNode (line 41) | protected override ITreeNode TryGetContextTreeNode()
method ExecutePsiTransaction (line 46) | protected override Action<ITextControl> ExecutePsiTransaction(ISolutio...
FILE: src/ReSharper.Structured.Logging/QuickFixes/RenameContextLogPropertyFix.cs
class RenameContextLogPropertyFix (line 18) | [QuickFix]
method RenameContextLogPropertyFix (line 25) | public RenameContextLogPropertyFix([NotNull] InconsistentContextLogPro...
method IsAvailable (line 33) | public override bool IsAvailable(IUserDataHolder cache)
method ExecutePsiTransaction (line 38) | protected override Action<ITextControl> ExecutePsiTransaction(ISolutio...
FILE: src/ReSharper.Structured.Logging/QuickFixes/RenameLogPropertyFix.cs
class RenameLogPropertyFix (line 20) | [QuickFix]
method RenameLogPropertyFix (line 29) | public RenameLogPropertyFix([NotNull] InconsistentLogPropertyNamingWar...
method IsAvailable (line 38) | public override bool IsAvailable(IUserDataHolder cache)
method ExecutePsiTransaction (line 43) | protected override Action<ITextControl> ExecutePsiTransaction(ISolutio...
FILE: src/ReSharper.Structured.Logging/QuickFixes/TemplateIsNotCompileTimeConstantFix.cs
class TemplateIsNotCompileTimeConstantFix (line 31) | [QuickFix]
method TemplateIsNotCompileTimeConstantFix (line 34) | public TemplateIsNotCompileTimeConstantFix([NotNull] TemplateIsNotComp...
method IsAvailable (line 44) | public override bool IsAvailable(IUserDataHolder cache)
method ExecutePsiTransaction (line 50) | protected override Action<ITextControl> ExecutePsiTransaction(ISolutio...
FILE: src/ReSharper.Structured.Logging/Serilog/Core/IMessageTemplateParser.cs
type IMessageTemplateParser (line 19) | public interface IMessageTemplateParser
method Parse (line 21) | MessageTemplate Parse(string messageTemplate);
FILE: src/ReSharper.Structured.Logging/Serilog/Events/MessageTemplate.cs
class MessageTemplate (line 28) | public class MessageTemplate
method MessageTemplate (line 41) | public MessageTemplate(IEnumerable<MessageTemplateToken> tokens)
method MessageTemplate (line 54) | public MessageTemplate(string text, IEnumerable<MessageTemplateToken> ...
method GetElementsOfTypeToArray (line 92) | static TResult[] GetElementsOfTypeToArray<TResult>(MessageTemplateToke...
method ToString (line 116) | public override string ToString()
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/Alignment.cs
type Alignment (line 20) | public struct Alignment
method Alignment (line 27) | public Alignment(AlignmentDirection direction, int width)
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/AlignmentDirection.cs
type AlignmentDirection (line 20) | public enum AlignmentDirection
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/Destructuring.cs
type Destructuring (line 21) | public enum Destructuring
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/MessageTemplateParser.cs
class MessageTemplateParser (line 31) | #if RIDER
method Parse (line 47) | public MessageTemplate Parse(string messageTemplate)
method Tokenize (line 54) | static IEnumerable<MessageTemplateToken> Tokenize(string messageTemplate)
method ParsePropertyToken (line 84) | static MessageTemplateToken ParsePropertyToken(int startAt, string mes...
method TrySplitTagContent (line 166) | static bool TrySplitTagContent(string tagContent, out string propertyN...
method IsValidInPropertyTag (line 219) | static bool IsValidInPropertyTag(char c)
method IsValidInPropertyName (line 227) | static bool IsValidInPropertyName(char c) => char.IsLetterOrDigit(c) |...
method TryGetDestructuringHint (line 229) | static bool TryGetDestructuringHint(char c, out Destructuring destruct...
method IsValidInDestructuringHint (line 251) | static bool IsValidInDestructuringHint(char c)
method IsValidInAlignment (line 257) | static bool IsValidInAlignment(char c)
method IsValidInFormat (line 263) | static bool IsValidInFormat(char c)
method ParseTextToken (line 273) | private static TextToken ParseTextToken(int startAt, string messageTem...
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/MessageTemplateToken.cs
class MessageTemplateToken (line 20) | public abstract class MessageTemplateToken
method MessageTemplateToken (line 26) | protected MessageTemplateToken(int startIndex)
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/PropertyToken.cs
class PropertyToken (line 24) | public sealed class PropertyToken : MessageTemplateToken
method PropertyToken (line 37) | [Obsolete("Use named arguments with this method to guarantee forwards-...
method PropertyToken (line 53) | public PropertyToken(string propertyName, string rawText, string forma...
method TryGetPositionalValue (line 107) | public bool TryGetPositionalValue(out int position)
method Equals (line 126) | public override bool Equals(object obj)
method GetHashCode (line 143) | public override int GetHashCode() => PropertyName.GetHashCode();
method ToString (line 152) | public override string ToString() => _rawText;
FILE: src/ReSharper.Structured.Logging/Serilog/Parsing/TextToken.cs
class TextToken (line 22) | public sealed class TextToken : MessageTemplateToken
method TextToken (line 30) | public TextToken(string text, int startIndex = -1) : base(startIndex)
method Equals (line 47) | public override bool Equals(object obj)
method GetHashCode (line 60) | public override int GetHashCode() => Text.GetHashCode();
method ToString (line 69) | public override string ToString() => Text;
FILE: src/ReSharper.Structured.Logging/Settings/PropertyNamingType.cs
type PropertyNamingType (line 3) | public enum PropertyNamingType
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingGroup.cs
class StructuredLoggingGroup (line 5) | [RegisterConfigurableHighlightingsGroup(Id, Name)]
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingOptionsPage.cs
class StructuredLoggingOptionsPage (line 14) | [OptionsPage(Pid, "Structured Logging", typeof(FeaturesEnvironmentOption...
method StructuredLoggingOptionsPage (line 19) | public StructuredLoggingOptionsPage(
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingSettings.cs
class StructuredLoggingSettings (line 6) | [SettingsKey(typeof(EnvironmentSettings), "Settings for Structured Loggi...
FILE: src/ReSharper.Structured.Logging/Settings/StructuredLoggingSettingsAccessor.cs
class StructuredLoggingSettingsAccessor (line 8) | public static class StructuredLoggingSettingsAccessor
FILE: src/ReSharper.Structured.Logging/Utils/PropertyNameProvider.cs
class PropertyNameProvider (line 9) | public static class PropertyNameProvider
method GetSuggestedName (line 11) | public static string GetSuggestedName([NotNull]string propertyName, [C...
FILE: src/ReSharper.Structured.Logging/Wiki/StructuredLoggingWikiDataProvider.cs
class StructuredLoggingWikiDataProvider (line 11) | [ShellComponent(Instantiation.DemandAnyThreadSafe)]
method TryGetValue (line 62) | public bool TryGetValue(string attributeId, out string url)
method CreateSeverityUrl (line 67) | private static string CreateSeverityUrl(string severityId)
FILE: src/ReSharper.Structured.Logging/ZoneMarker.cs
class ZoneMarker (line 6) | [ZoneMarker]
FILE: test/data/Analyzers/AnonymousTypeDestructure/SerilogWithComplexPropertyWithoutDestructure.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/AnonymousTypeDestructure/SerilogWithoutDestructure.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogContextExplicitDestructure.cs
class Program (line 7) | public static class Program
method Main (line 9) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogContextNumericWithoutDestructure.cs
class Program (line 7) | public static class Program
method Main (line 9) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogContextWithoutDestructure.cs
class Program (line 7) | public static class Program
method Main (line 9) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogCustomExceptionWithoutDestructure.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
class MyException (line 14) | public class MyException : Exception
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogDictionaryWithoutDestructure.cs
class Program (line 7) | public static class Program
method Main (line 9) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogEnumerableWithoutDestructure.cs
class Program (line 7) | public static class Program
method Main (line 9) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogForceStringWithoutDestructure.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogNullableWithoutDestructure.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogNumericWithoutDestructure.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogParentWithOverriddenToString.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
class A (line 14) | public class A
method ToString (line 16) | public override string ToString() => "Custom ToString";
class B (line 19) | public class B: A { }
FILE: test/data/Analyzers/ComplexTypeDestructure/SerilogWithoutDestructure.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/ContextualLoggerConstructor/MicrosoftCorrectContextType.cs
class A (line 3) | class A
method A (line 7) | public A(ILogger<A> log)
FILE: test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextType.cs
class A (line 3) | class A
method A (line 7) | public A(ILogger<B> log)
class B (line 13) | class B { }
FILE: test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextTypeMultipleNamespaces.cs
class A (line 5) | class A { }
method A (line 14) | public A(ILogger<X.A> log)
class A (line 10) | class A
method A (line 14) | public A(ILogger<X.A> log)
FILE: test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextTypeMultipleParameters.cs
class A (line 3) | class A
method A (line 7) | public A(int a, ILogger<B> log)
class B (line 13) | class B { }
FILE: test/data/Analyzers/ContextualLoggerSerilogFactory/SerilogCorrectContextType.cs
class A (line 3) | class A
class B (line 8) | class B {}
FILE: test/data/Analyzers/ContextualLoggerSerilogFactory/SerilogWrongContextType.cs
class A (line 3) | class A
class B (line 8) | class B {}
FILE: test/data/Analyzers/CorrectExceptionPassing/SerilogCorrectExceptionPassing.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/CorrectExceptionPassing/SerilogIncorrectExceptionPassing.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/CorrectExceptionPassing/SerilogIncorrectExceptionPassingDynamicTemplate.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/CorrectExceptionPassing/SerilogMultipleExceptionPassing.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/DuplicatePropertiesTemplate/SerilogDuplicateNamedProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/LogMessageIsSentence/SerilogNotSentenceMessage.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/LogMessageIsSentence/SerilogSentenceMessage.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PositionalPropertiesUsage/SerilogPositionProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogContextInterpolatedStringProperty.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogContextInvalidNamedProperty.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogIgnoredInvalidNamedProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidElasticNamedProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedPropertyWithDot.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedPropertyWithSpace.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidSyntax.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogValidDestructuredNamedProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzer/SerilogValidNamedProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/Analyzers/PropertiesNamingAnalyzerDotNet6/ZLoggerInvalidNamedProperty.cs
class A (line 6) | class A
method A (line 8) | public A(ILogger<A> log)
FILE: test/data/QuickFixes/AddDestructuringFix/SerilogEscapedString.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/QuickFixes/AddDestructuringFix/SerilogNewAnonymousObject.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/QuickFixes/AddDestructuringFix/SerilogNewComplexObject.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/QuickFixes/RemoveTrailingPeriodFix/SerilogTrailingPeriod.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/QuickFixes/RenameContextLogPropertyFix/SerilogContextProperty.cs
class Program (line 6) | public static class Program
method Main (line 8) | public static void Main()
FILE: test/data/QuickFixes/RenameLogPropertyFix/SerilogDestructuredProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/QuickFixes/RenameLogPropertyFix/SerilogProperty.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/data/QuickFixes/RenameLogPropertyFix/SerilogPropertyConcatenated.cs
class Program (line 5) | public static class Program
method Main (line 7) | public static void Main()
FILE: test/src/Analyzer/AnonymousTypeDestructureAnalyzerTests.cs
class AnonymousTypeDestructureAnalyzerTests (line 5) | public class AnonymousTypeDestructureAnalyzerTests : MessageTemplateAnal...
method TestSerilogWithoutDestructure (line 9) | [Test] public void TestSerilogWithoutDestructure() => DoNamedTest2();
method TestSerilogWithComplexPropertyWithoutDestructure (line 11) | [Test] public void TestSerilogWithComplexPropertyWithoutDestructure() ...
FILE: test/src/Analyzer/ComplexObjectDestructureAnalyzerTests.cs
class ComplexObjectDestructureAnalyzerTests (line 5) | public class ComplexObjectDestructureAnalyzerTests : MessageTemplateAnal...
method TestSerilogWithoutDestructure (line 9) | [Test] public void TestSerilogWithoutDestructure() => DoNamedTest2();
method TestSerilogForceStringWithoutDestructure (line 11) | [Test] public void TestSerilogForceStringWithoutDestructure() => DoNam...
method TestSerilogNumericWithoutDestructure (line 13) | [Test] public void TestSerilogNumericWithoutDestructure() => DoNamedTe...
method TestSerilogEnumerableWithoutDestructure (line 15) | [Test] public void TestSerilogEnumerableWithoutDestructure() => DoName...
method TestSerilogNullableWithoutDestructure (line 17) | [Test] public void TestSerilogNullableWithoutDestructure() => DoNamedT...
method TestSerilogDictionaryWithoutDestructure (line 19) | [Test] public void TestSerilogDictionaryWithoutDestructure() => DoName...
method TestSerilogContextWithoutDestructure (line 21) | [Test] public void TestSerilogContextWithoutDestructure() => DoNamedTe...
method TestSerilogContextNumericWithoutDestructure (line 23) | [Test] public void TestSerilogContextNumericWithoutDestructure() => Do...
method TestSerilogContextExplicitDestructure (line 25) | [Test] public void TestSerilogContextExplicitDestructure() => DoNamedT...
method TestSerilogCustomExceptionWithoutDestructure (line 27) | [Test] public void TestSerilogCustomExceptionWithoutDestructure() => D...
method TestSerilogParentWithOverriddenToString (line 29) | [Test] public void TestSerilogParentWithOverriddenToString() => DoName...
FILE: test/src/Analyzer/ContextualLoggerConstructorAnalyzerTests.cs
class ContextualLoggerConstructorAnalyzerTests (line 7) | [TestNet60]
method TestMicrosoftCorrectContextType (line 12) | [Test] public void TestMicrosoftCorrectContextType() => DoNamedTest2();
method TestMicrosoftWrongContextType (line 14) | [Test] public void TestMicrosoftWrongContextType() => DoNamedTest2();
method TestMicrosoftWrongContextTypeMultipleNamespaces (line 16) | [Test] public void TestMicrosoftWrongContextTypeMultipleNamespaces() =...
method TestMicrosoftWrongContextTypeMultipleParameters (line 18) | [Test] public void TestMicrosoftWrongContextTypeMultipleParameters() =...
FILE: test/src/Analyzer/ContextualLoggerSerilogFactoryAnalyzerTests.cs
class ContextualLoggerSerilogFactoryAnalyzerTests (line 5) | public class ContextualLoggerSerilogFactoryAnalyzerTests : MessageTempla...
method TestSerilogCorrectContextType (line 9) | [Test] public void TestSerilogCorrectContextType() => DoNamedTest2();
method TestSerilogWrongContextType (line 11) | [Test] public void TestSerilogWrongContextType() => DoNamedTest2();
FILE: test/src/Analyzer/CorrectExceptionPassingAnalyzerTests.cs
class CorrectExceptionPassingAnalyzerTests (line 5) | public class CorrectExceptionPassingAnalyzerTests : MessageTemplateAnaly...
method TestSerilogCorrectExceptionPassing (line 9) | [Test] public void TestSerilogCorrectExceptionPassing() => DoNamedTest...
method TestSerilogIncorrectExceptionPassing (line 11) | [Test] public void TestSerilogIncorrectExceptionPassing() => DoNamedTe...
method TestSerilogIncorrectExceptionPassingDynamicTemplate (line 13) | [Test] public void TestSerilogIncorrectExceptionPassingDynamicTemplate...
method TestSerilogMultipleExceptionPassing (line 15) | [Test] public void TestSerilogMultipleExceptionPassing() => DoNamedTes...
FILE: test/src/Analyzer/DuplicatePropertiesTemplateAnalyzerTests.cs
class DuplicatePropertiesTemplateAnalyzerTests (line 5) | public class DuplicatePropertiesTemplateAnalyzerTests : MessageTemplateA...
method TestSerilogDuplicateNamedProperty (line 9) | [Test] public void TestSerilogDuplicateNamedProperty() => DoNamedTest2();
FILE: test/src/Analyzer/LogMessageIsSentenceAnalyzerTests.cs
class LogMessageIsSentenceAnalyzerTests (line 5) | public class LogMessageIsSentenceAnalyzerTests : MessageTemplateAnalyzer...
method TestSerilogSentenceMessage (line 9) | [Test] public void TestSerilogSentenceMessage() => DoNamedTest2();
method TestSerilogNotSentenceMessage (line 11) | [Test] public void TestSerilogNotSentenceMessage() => DoNamedTest2();
FILE: test/src/Analyzer/MessageTemplateTests.cs
class MessageTemplateAnalyzerTestBase (line 14) | [TestPackages(
method DoTestSolution (line 25) | protected override void DoTestSolution([NotNull] params string[] fileSet)
method HighlightingPredicate (line 35) | protected override bool HighlightingPredicate(
method MutateSettings (line 54) | protected virtual void MutateSettings([NotNull] IContextBoundSettingsS...
FILE: test/src/Analyzer/PositionalPropertiesUsageAnalyzerTests.cs
class PositionalPropertiesUsageAnalyzerTests (line 5) | public class PositionalPropertiesUsageAnalyzerTests : MessageTemplateAna...
method TestSerilogPositionProperty (line 9) | [Test] public void TestSerilogPositionProperty() => DoNamedTest2();
FILE: test/src/Analyzer/PropertiesElasticNamingAnalyzerTests.cs
class PropertiesElasticNamingAnalyzerTests (line 10) | public class PropertiesElasticNamingAnalyzerTests : MessageTemplateAnaly...
method TestSerilogInvalidElasticNamedProperty (line 14) | [Test] public void TestSerilogInvalidElasticNamedProperty() => DoNamed...
method MutateSettings (line 16) | protected override void MutateSettings(IContextBoundSettingsStore sett...
FILE: test/src/Analyzer/PropertiesIgnoredRegexNamingAnalyzerTests.cs
class PropertiesIgnoredRegexNamingAnalyzerTests (line 10) | public class PropertiesIgnoredRegexNamingAnalyzerTests : MessageTemplate...
method TestSerilogIgnoredInvalidNamedProperty (line 14) | [Test] public void TestSerilogIgnoredInvalidNamedProperty() => DoNamed...
method MutateSettings (line 16) | protected override void MutateSettings(IContextBoundSettingsStore sett...
FILE: test/src/Analyzer/PropertiesNamingAnalyzerDotNet6Tests.cs
class PropertiesNamingAnalyzerDotNet6Tests (line 9) | [TestNet60]
method TestZLoggerInvalidNamedProperty (line 17) | [Test] public void TestZLoggerInvalidNamedProperty() => DoNamedTest2();
FILE: test/src/Analyzer/PropertiesNamingAnalyzerTests.cs
class PropertiesNamingAnalyzerTests (line 5) | public class PropertiesNamingAnalyzerTests : MessageTemplateAnalyzerTest...
method TestSerilogInvalidNamedProperty (line 9) | [Test] public void TestSerilogInvalidNamedProperty() => DoNamedTest2();
method TestSerilogValidNamedProperty (line 11) | [Test] public void TestSerilogValidNamedProperty() => DoNamedTest2();
method TestSerilogValidDestructuredNamedProperty (line 13) | [Test] public void TestSerilogValidDestructuredNamedProperty() => DoNa...
method TestSerilogContextInvalidNamedProperty (line 15) | [Test] public void TestSerilogContextInvalidNamedProperty() => DoNamed...
method TestSerilogContextInterpolatedStringProperty (line 17) | [Test] public void TestSerilogContextInterpolatedStringProperty() => D...
method TestSerilogInvalidNamedPropertyWithDot (line 19) | [Test] public void TestSerilogInvalidNamedPropertyWithDot() => DoNamed...
method TestSerilogInvalidSyntax (line 21) | [Test] public void TestSerilogInvalidSyntax() => DoNamedTest2();
method TestSerilogInvalidNamedPropertyWithSpace (line 23) | [Test] public void TestSerilogInvalidNamedPropertyWithSpace() => DoNam...
FILE: test/src/Constants/NugetPackages.cs
class NugetPackages (line 3) | internal static class NugetPackages
FILE: test/src/QuickFixes/AddDestructuringToMessageTemplatePropertyFixTests.cs
class AddDestructuringToMessageTemplatePropertyFixTests (line 6) | public class AddDestructuringToMessageTemplatePropertyFixTests : QuickFi...
method TestSerilogEscapedString (line 10) | [Test] public void TestSerilogEscapedString() => DoNamedTest2();
method TestSerilogNewAnonymousObject (line 12) | [Test] public void TestSerilogNewAnonymousObject() => DoNamedTest2();
method TestSerilogNewComplexObject (line 14) | [Test] public void TestSerilogNewComplexObject() => DoNamedTest2();
FILE: test/src/QuickFixes/QuickFixTestBase.cs
class QuickFixTestBase (line 11) | [TestFixture]
FILE: test/src/QuickFixes/RemoveTrailingPeriodFixTests.cs
class RemoveTrailingPeriodFixTests (line 7) | public class RemoveTrailingPeriodFixTests : QuickFixTestBase<RemoveTrail...
method TestSerilogTrailingPeriod (line 11) | [Test] public void TestSerilogTrailingPeriod() => DoNamedTest2();
FILE: test/src/QuickFixes/RenameContextLogPropertyFixTests.cs
class RenameContextLogPropertyFixTests (line 7) | public class RenameContextLogPropertyFixTests : QuickFixTestBase<RenameC...
method TestSerilogContextProperty (line 11) | [Test] public void TestSerilogContextProperty() => DoNamedTest2();
FILE: test/src/QuickFixes/RenameLogPropertyFixTests.cs
class RenameLogPropertyFixTests (line 7) | public class RenameLogPropertyFixTests : QuickFixTestBase<RenameLogPrope...
method TestSerilogProperty (line 11) | [Test] public void TestSerilogProperty() => DoNamedTest2();
method TestSerilogDestructuredProperty (line 13) | [Test] public void TestSerilogDestructuredProperty() => DoNamedTest2();
method TestSerilogPropertyConcatenated (line 15) | [Test] public void TestSerilogPropertyConcatenated() => DoNamedTest2();
FILE: test/src/TestEnvironment.cs
type IReSharperSerilog (line 16) | [ZoneDefinition]
class TestEnvironment (line 24) | [SetUpFixture]
Condensed preview — 220 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (261K chars).
[
{
"path": ".editorconfig",
"chars": 295,
"preview": "root = true\n\n[*]\ncharset = utf-8\nindent_style = space\ninsert_final_newline = true\ntrim_trailing_whitespace = true\ndotnet"
},
{
"path": ".gitattributes",
"chars": 2518,
"preview": "###############################################################################\n# Set default behavior to automatically "
},
{
"path": ".github/dependabot.yml",
"chars": 208,
"preview": "version: 2\nupdates:\n - package-ecosystem: \"gradle\"\n directory: \"/\"\n schedule:\n interval: \"monthly\"\n\n - pack"
},
{
"path": ".gitignore",
"chars": 5748,
"preview": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## G"
},
{
"path": ".nuke/build.schema.json",
"chars": 3079,
"preview": "{\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"definitions\": {\n \"Host\": {\n \"type\": \"string\",\n "
},
{
"path": ".nuke/parameters.json",
"chars": 92,
"preview": "{\n \"$schema\": \"./build.schema.json\",\n \"Solution\": \"src/ReSharper.Structured.Logging.sln\"\n}"
},
{
"path": "Directory.Build.props",
"chars": 455,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microso"
},
{
"path": "LICENSE",
"chars": 1072,
"preview": "MIT License\n\nCopyright (c) 2019 Oleg Shevchenko\n\nPermission is hereby granted, free of charge, to any person obtaining a"
},
{
"path": "README.md",
"chars": 3256,
"preview": "# ReSharper Structured Logging\n[]("
},
{
"path": "appveyor.yml",
"chars": 490,
"preview": "image: Visual Studio 2022\n\nskip_branch_with_pr: true\nskip_tags: true\n\ninstall:\n - SET JAVA_HOME=C:\\Program Files\\Java\\j"
},
{
"path": "build/.editorconfig",
"chars": 506,
"preview": "[*.cs]\ndotnet_style_qualification_for_field = false:warning\ndotnet_style_qualification_for_property = false:warning\ndotn"
},
{
"path": "build/Build.cs",
"chars": 7844,
"preview": "using System.Text.RegularExpressions;\n\nusing Nuke.Common;\nusing Nuke.Common.CI;\nusing Nuke.Common.CI.AppVeyor;\nusing Nuk"
},
{
"path": "build/Directory.Build.props",
"chars": 428,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsof"
},
{
"path": "build/Directory.Build.targets",
"chars": 432,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsof"
},
{
"path": "build/ReSharper.Structured.Logging.nuspec",
"chars": 940,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<package>\n <metadata>\n <id>$project$</id>\n <version>1.0.0</version>\n <"
},
{
"path": "build/_build.csproj",
"chars": 786,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n <PropertyGroup>\n <OutputType>Exe</OutputType>\n <TargetFramework>net8.0</Targe"
},
{
"path": "build/_build.csproj.DotSettings",
"chars": 5914,
"preview": "<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namesp"
},
{
"path": "build.cmd",
"chars": 201,
"preview": ":; set -eo pipefail\n:; SCRIPT_DIR=$(cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd)\n:; ${SCRIPT_DIR}/build.sh \"$@\"\n:; exit"
},
{
"path": "build.gradle",
"chars": 1433,
"preview": "plugins {\n id 'org.jetbrains.kotlin.jvm' version '2.3.10'\n id 'org.jetbrains.intellij.platform' version '"
},
{
"path": "build.ps1",
"chars": 2936,
"preview": "[CmdletBinding()]\nParam(\n [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]\n [string[]]$B"
},
{
"path": "build.sh",
"chars": 2280,
"preview": "#!/usr/bin/env bash\n\nbash --version 2>&1 | head -n 1\n\nset -eo pipefail\nSCRIPT_DIR=$(cd \"$( dirname \"${BASH_SOURCE[0]}\" )"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 282,
"preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://cache-redirector.jetbrains.com"
},
{
"path": "gradle.properties",
"chars": 550,
"preview": "# Any property can be overwritten from command-line via\n# -P<propertyName>=<value>\n\nPluginVersion=_PLACEHOLDER_\nProduc"
},
{
"path": "gradlew",
"chars": 8504,
"preview": "#!/bin/sh\n\n#\n# Copyright © 2015-2021 the original authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "gradlew.bat",
"chars": 2776,
"preview": "@rem\n@rem Copyright 2015 the original author or authors.\n@rem\n@rem Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "rules/AnonymousObjectDestructuringProblem.md",
"chars": 235,
"preview": "#### Anonymous objects must be destructured\n\nNoncompliant Code Examples:\n```csharp\nLog.Error(\"Processed {Position}\", new"
},
{
"path": "rules/ComplexObjectDestructuringProblem.md",
"chars": 450,
"preview": "#### Complex objects with default `ToString()` implementation probably need to be destructured \n\nNoncompliant Code Examp"
},
{
"path": "rules/ComplexObjectInContextDestructuringProblem.md",
"chars": 436,
"preview": "#### Complex objects with default `ToString()` implementation probably need to be destructured\n\nNoncompliant Code Exampl"
},
{
"path": "rules/ContextualLoggerProblem.md",
"chars": 529,
"preview": "#### Incorrect type is used for contextual logger\n\nNoncompliant Code Examples:\n```csharp\nclass A\n{\n private static re"
},
{
"path": "rules/ExceptionPassedAsTemplateArgumentProblem.md",
"chars": 334,
"preview": "#### Exception passed as a template argument\n\nNoncompliant Code Example:\n```csharp\ncatch (Exception exception)\n{\n Log."
},
{
"path": "rules/InconsistentContextLogPropertyNaming.md",
"chars": 262,
"preview": "#### Inconsistent log property naming in context (can be configured in the extension settings)\n\nNoncompliant Code Exampl"
},
{
"path": "rules/InconsistentLogPropertyNaming.md",
"chars": 247,
"preview": "#### Inconsistent log property naming (can be configured in the extension settings)\n\nNoncompliant Code Examples:\n```csha"
},
{
"path": "rules/LogMessageIsSentenceProblem.md",
"chars": 445,
"preview": "#### Log event messages should be fragments, not sentences\n\n[https://benfoster.io/blog/serilog-best-practices/#message-t"
},
{
"path": "rules/PositionalPropertyUsedProblem.md",
"chars": 264,
"preview": "#### Prefer named properties instead of positional ones\n\nNoncompliant Code Examples:\n```csharp\nLog.Error(\"Disk quota {0}"
},
{
"path": "rules/TemplateDuplicatePropertyProblem.md",
"chars": 248,
"preview": "#### Duplicate template property \n\nNoncompliant Code Example:\n```csharp\nLog.Error(\"Disk quota {Quota} MB exceeded by {Qu"
},
{
"path": "rules/TemplateIsNotCompileTimeConstantProblem.md",
"chars": 347,
"preview": "#### Message template is not a compile time constant\n\nNoncompliant Code Examples:\n```csharp\nLog.Error($\"Disk quota {quot"
},
{
"path": "settings.gradle",
"chars": 46,
"preview": "rootProject.name = 'rider-structured-logging'\n"
},
{
"path": "src/.idea/.idea.ReSharper.Structured.Logging/.idea/.gitignore",
"chars": 361,
"preview": "# Default ignored files\n/shelf/\n/workspace.xml\n# Rider ignored files\n/modules.xml\n/contentModel.xml\n/projectSettingsUpd"
},
{
"path": "src/.idea/.idea.ReSharper.Structured.Logging/.idea/.name",
"chars": 28,
"preview": "ReSharper.Structured.Logging"
},
{
"path": "src/.idea/.idea.ReSharper.Structured.Logging/.idea/encodings.xml",
"chars": 169,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"Encoding\" addBOMForNewFiles=\"with BOM un"
},
{
"path": "src/.idea/.idea.ReSharper.Structured.Logging/.idea/indexLayout.xml",
"chars": 198,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"UserContentModel\">\n <attachedFolders "
},
{
"path": "src/.idea/.idea.ReSharper.Structured.Logging/.idea/vcs.xml",
"chars": 183,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": "src/.run/Pack ReSharper.run.xml",
"chars": 1013,
"preview": "<component name=\"ProjectRunConfigurationManager\">\n <configuration default=\"false\" name=\"Pack ReSharper\" type=\"NukeBuil"
},
{
"path": "src/.run/Pack Rider.run.xml",
"chars": 1036,
"preview": "<component name=\"ProjectRunConfigurationManager\">\n <configuration default=\"false\" name=\"Pack Rider\" type=\"NukeBuildTar"
},
{
"path": "src/.run/Test ReSharper.run.xml",
"chars": 1013,
"preview": "<component name=\"ProjectRunConfigurationManager\">\n <configuration default=\"false\" name=\"Test ReSharper\" type=\"NukeBuil"
},
{
"path": "src/.run/Test Rider.run.xml",
"chars": 1025,
"preview": "<component name=\"ProjectRunConfigurationManager\">\n <configuration default=\"false\" name=\"Test Rider\" type=\"NukeBuildTar"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/AnonymousTypeDestructureAnalyzer.cs",
"chars": 2965,
"preview": "using System;\nusing System.Linq;\n\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi;\nusin"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/CompileTimeConstantTemplateAnalyzer.cs",
"chars": 1507,
"preview": "using System;\n\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CodeAnnotations;\nusing J"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/ComplexObjectDestructureAnalyzer.cs",
"chars": 6655,
"preview": "using System;\nusing System.Linq;\n\nusing JetBrains.Metadata.Reader.API;\nusing JetBrains.Metadata.Reader.Impl;\nusing JetBr"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/ContextualLoggerConstructorAnalyzer.cs",
"chars": 1950,
"preview": "using JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi;\nusing JetBrains.ReSharper.Psi.CSharp."
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/ContextualLoggerSerilogFactoryAnalyzer.cs",
"chars": 1215,
"preview": "using JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp.Tree;\nusing JetBrains.ReSharper"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/CorrectExceptionPassingAnalyzer.cs",
"chars": 3995,
"preview": "using System;\nusing System.Linq;\nusing JetBrains.Metadata.Reader.API;\nusing JetBrains.ReSharper.Feature.Services.Daemon;"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/DuplicatePropertiesTemplateAnalyzer.cs",
"chars": 2186,
"preview": "using System;\nusing System.Linq;\n\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CodeA"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/LogMessageIsSentenceAnalyzer.cs",
"chars": 1876,
"preview": "using System;\nusing System.Text.RegularExpressions;\n\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains."
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/PositionalPropertiesUsageAnalyzer.cs",
"chars": 1992,
"preview": "using System;\n\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CodeAnnotations;\nusing J"
},
{
"path": "src/ReSharper.Structured.Logging/Analyzer/PropertiesNamingAnalyzer.cs",
"chars": 4630,
"preview": "using System;\nusing System.Text.RegularExpressions;\n\nusing JetBrains.Application.Settings;\nusing JetBrains.ProjectModel;"
},
{
"path": "src/ReSharper.Structured.Logging/Caching/TemplateParameterNameAttributeProvider.cs",
"chars": 1738,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nusing JetBrains.Application.Parts;\nusing JetBrains.R"
},
{
"path": "src/ReSharper.Structured.Logging/Extensions/PsiExtensions.cs",
"chars": 9306,
"preview": "using System.Collections.Generic;\nusing System.Linq;\n\nusing JetBrains.Annotations;\nusing JetBrains.DocumentModel;\nusing "
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/AnonymousObjectWithoutDestructuringWarning.cs",
"chars": 1427,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringInContextWarning.cs",
"chars": 1461,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringWarning.cs",
"chars": 1378,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/ComplexObjectDestructuringWarningBase.cs",
"chars": 264,
"preview": "namespace ReSharper.Structured.Logging.Highlighting\n{\n public abstract class ComplexObjectDestructuringWarningBase\n "
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/ContextualLoggerWarning.cs",
"chars": 1246,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/DuplicateTemplatePropertyWarning.cs",
"chars": 1382,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/ExceptionPassedAsTemplateArgumentWarning.cs",
"chars": 1337,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/InconsistentContextLogPropertyNamingWarning.cs",
"chars": 1597,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/InconsistentLogPropertyNamingWarning.cs",
"chars": 1761,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/InconsistentLogPropertyNamingWarningBase.cs",
"chars": 471,
"preview": "namespace ReSharper.Structured.Logging.Highlighting\n{\n public class InconsistentLogPropertyNamingWarningBase\n {\n "
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/LogMessageIsSentenceWarning.cs",
"chars": 1665,
"preview": "using System.Text.RegularExpressions;\n\nusing JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/PositionalPropertyUsedWarning.cs",
"chars": 1427,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/TemplateFormatStringNonExistingArgumentWarning.cs",
"chars": 1326,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Highlighting/TemplateIsNotCompileTimeConstantWarning.cs",
"chars": 1690,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Feature.Services.Daemon;\nusing JetBrains.ReSharper.Psi.CSharp;\n"
},
{
"path": "src/ReSharper.Structured.Logging/Models/MessageTemplateTokenInformation.cs",
"chars": 704,
"preview": "using JetBrains.DocumentModel;\nusing JetBrains.ReSharper.Psi.Tree;\nusing JetBrains.ReSharper.Psi.Util;\n\nnamespace ReShar"
},
{
"path": "src/ReSharper.Structured.Logging/QuickFixes/AddDestructuringToMessageTemplatePropertyFix.cs",
"chars": 2090,
"preview": "using System;\n\nusing JetBrains.Annotations;\nusing JetBrains.Application.Progress;\nusing JetBrains.ProjectModel;\nusing Je"
},
{
"path": "src/ReSharper.Structured.Logging/QuickFixes/RemoveTrailingPeriodFix.cs",
"chars": 1905,
"preview": "using System;\nusing System.Text.RegularExpressions;\n\nusing JetBrains.Annotations;\nusing JetBrains.Application.Progress;\n"
},
{
"path": "src/ReSharper.Structured.Logging/QuickFixes/RenameContextLogPropertyFix.cs",
"chars": 1676,
"preview": "using System;\n\nusing JetBrains.Annotations;\nusing JetBrains.Application.Progress;\nusing JetBrains.ProjectModel;\nusing Je"
},
{
"path": "src/ReSharper.Structured.Logging/QuickFixes/RenameLogPropertyFix.cs",
"chars": 2510,
"preview": "using System;\n\nusing JetBrains.Annotations;\nusing JetBrains.Application.Progress;\nusing JetBrains.ProjectModel;\nusing Je"
},
{
"path": "src/ReSharper.Structured.Logging/QuickFixes/TemplateIsNotCompileTimeConstantFix.cs",
"chars": 7348,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing JetBrains.Annotations;\nusing"
},
{
"path": "src/ReSharper.Structured.Logging/ReSharper.Structured.Logging.Rider.csproj",
"chars": 647,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n <PropertyGroup>\n <TargetFramework>net472</TargetFramework>\n <AppendTargetFrame"
},
{
"path": "src/ReSharper.Structured.Logging/ReSharper.Structured.Logging.csproj",
"chars": 642,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n <PropertyGroup>\n <TargetFramework>net472</TargetFramework>\n <AppendTargetFrame"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Core/IMessageTemplateParser.cs",
"chars": 821,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Events/MessageTemplate.cs",
"chars": 4730,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Parsing/Alignment.cs",
"chars": 1500,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// yo"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Parsing/AlignmentDirection.cs",
"chars": 991,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// yo"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Parsing/Destructuring.cs",
"chars": 1319,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// yo"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Parsing/MessageTemplateParser.cs",
"chars": 11102,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Parsing/MessageTemplateToken.cs",
"chars": 1447,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// yo"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Parsing/PropertyToken.cs",
"chars": 6224,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// yo"
},
{
"path": "src/ReSharper.Structured.Logging/Serilog/Parsing/TextToken.cs",
"chars": 2804,
"preview": "// Copyright 2013-2015 Serilog Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// yo"
},
{
"path": "src/ReSharper.Structured.Logging/Settings/PropertyNamingType.cs",
"chars": 405,
"preview": "namespace ReSharper.Structured.Logging.Settings\n{\n public enum PropertyNamingType\n {\n PascalCase,\n\n "
},
{
"path": "src/ReSharper.Structured.Logging/Settings/StructuredLoggingGroup.cs",
"chars": 338,
"preview": "using JetBrains.ReSharper.Feature.Services.Daemon;\n\nnamespace ReSharper.Structured.Logging.Settings\n{\n [RegisterConfi"
},
{
"path": "src/ReSharper.Structured.Logging/Settings/StructuredLoggingOptionsPage.cs",
"chars": 2420,
"preview": "using System;\n\nusing JetBrains.Application.Settings;\nusing JetBrains.Application.UI.Options;\nusing JetBrains.Application"
},
{
"path": "src/ReSharper.Structured.Logging/Settings/StructuredLoggingSettings.cs",
"chars": 548,
"preview": "using JetBrains.Application.Settings;\nusing JetBrains.Application.Settings.WellKnownRootKeys;\n\nnamespace ReSharper.Struc"
},
{
"path": "src/ReSharper.Structured.Logging/Settings/StructuredLoggingSettingsAccessor.cs",
"chars": 517,
"preview": "using System;\nusing System.Linq.Expressions;\n\nusing JetBrains.Annotations;\n\nnamespace ReSharper.Structured.Logging.Setti"
},
{
"path": "src/ReSharper.Structured.Logging/Utils/PropertyNameProvider.cs",
"chars": 1181,
"preview": "using JetBrains.Annotations;\nusing JetBrains.Application.Settings;\nusing JetBrains.Util;\n\nusing ReSharper.Structured.Log"
},
{
"path": "src/ReSharper.Structured.Logging/Wiki/StructuredLoggingWikiDataProvider.cs",
"chars": 6210,
"preview": "using System.Collections.Generic;\n\nusing JetBrains.Application;\nusing JetBrains.Application.Parts;\nusing JetBrains.ReSha"
},
{
"path": "src/ReSharper.Structured.Logging/ZoneMarker.cs",
"chars": 231,
"preview": "using JetBrains.Application.BuildScript.Application.Zones;\nusing JetBrains.ReSharper.Psi.CSharp;\n\nnamespace ReSharper.S"
},
{
"path": "src/ReSharper.Structured.Logging/app.config",
"chars": 1170,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n <runtime>\n <assemblyBinding xmlns=\"urn:schemas-microsoft-co"
},
{
"path": "src/ReSharper.Structured.Logging.sln",
"chars": 4895,
"preview": "\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.0.3212"
},
{
"path": "src/rider/main/kotlin/com/jetbrains/rider/settings/StructuredLoggingBundle.kt",
"chars": 662,
"preview": "package com.jetbrains.rider.settings\n\nimport com.intellij.DynamicBundle\nimport org.jetbrains.annotations.Nls\nimport org."
},
{
"path": "src/rider/main/kotlin/com/jetbrains/rider/settings/StructuredLoggingPluginOptionsPage.kt",
"chars": 425,
"preview": "package com.jetbrains.rider.settings\n\nimport com.jetbrains.rider.settings.simple.SimpleOptionsPage\nimport com.jetbrains."
},
{
"path": "src/rider/main/resources/META-INF/plugin.xml",
"chars": 1267,
"preview": "<idea-plugin require-restart=\"true\">\n <id>com.intellij.resharper.StructuredLogging</id>\n <name>Structured Logging</nam"
},
{
"path": "src/rider/main/resources/messages/StructuredLoggingBundle.properties",
"chars": 61,
"preview": "configurable.name.structuredlogging.title=Structured Logging\n"
},
{
"path": "test/data/Analyzers/AnonymousTypeDestructure/SerilogWithComplexPropertyWithoutDestructure.cs",
"chars": 247,
"preview": "using Serilog;\nusing System;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Ma"
},
{
"path": "test/data/Analyzers/AnonymousTypeDestructure/SerilogWithComplexPropertyWithoutDestructure.cs.gold",
"chars": 375,
"preview": "using Serilog;\nusing System;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/AnonymousTypeDestructure/SerilogWithoutDestructure.cs",
"chars": 209,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/Analyzers/AnonymousTypeDestructure/SerilogWithoutDestructure.cs.gold",
"chars": 337,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogContextExplicitDestructure.cs",
"chars": 241,
"preview": "using System;\nusing Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogContextExplicitDestructure.cs.gold",
"chars": 301,
"preview": "using System;\nusing Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogContextNumericWithoutDestructure.cs",
"chars": 224,
"preview": "using System;\nusing Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogContextNumericWithoutDestructure.cs.gold",
"chars": 284,
"preview": "using System;\nusing Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogContextWithoutDestructure.cs",
"chars": 235,
"preview": "using System;\nusing Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogContextWithoutDestructure.cs.gold",
"chars": 412,
"preview": "using System;\nusing Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogCustomExceptionWithoutDestructure.cs",
"chars": 286,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Ma"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogCustomExceptionWithoutDestructure.cs.gold",
"chars": 463,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogDictionaryWithoutDestructure.cs",
"chars": 271,
"preview": "using System;\nusing System.Collections.Generic;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogDictionaryWithoutDestructure.cs.gold",
"chars": 331,
"preview": "using System;\nusing System.Collections.Generic;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogEnumerableWithoutDestructure.cs",
"chars": 271,
"preview": "using System;\nusing System.Collections.Generic;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n "
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogEnumerableWithoutDestructure.cs.gold",
"chars": 331,
"preview": "using System;\nusing System.Collections.Generic;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogForceStringWithoutDestructure.cs",
"chars": 220,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Ma"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogForceStringWithoutDestructure.cs.gold",
"chars": 280,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogNullableWithoutDestructure.cs",
"chars": 230,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Ma"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogNullableWithoutDestructure.cs.gold",
"chars": 290,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogNumericWithoutDestructure.cs",
"chars": 209,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Ma"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogNumericWithoutDestructure.cs.gold",
"chars": 269,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogParentWithOverriddenToString.cs",
"chars": 337,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Ma"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogParentWithOverriddenToString.cs.gold",
"chars": 397,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogWithoutDestructure.cs",
"chars": 219,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Ma"
},
{
"path": "test/data/Analyzers/ComplexTypeDestructure/SerilogWithoutDestructure.cs.gold",
"chars": 396,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftCorrectContextType.cs",
"chars": 115,
"preview": "using Microsoft.Extensions.Logging;\n\nclass A\n{\n\tILogger<A> _log;\n\t\n\tpublic A(ILogger<A> log)\n\t{\n\t\t_log = log;\n\t}\n}\n"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftCorrectContextType.cs.gold",
"chars": 175,
"preview": "using Microsoft.Extensions.Logging;\n\nclass A\n{\n\tILogger<A> _log;\n\t\n\tpublic A(ILogger<A> log)\n\t{\n\t\t_log = log;\n\t}\n}\n\n---"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextType.cs",
"chars": 128,
"preview": "using Microsoft.Extensions.Logging;\n\nclass A\n{\n\tILogger<B> _log;\n\t\n\tpublic A(ILogger<B> log)\n\t{\n\t\t_log = log;\n\t}\n}\n\nclas"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextType.cs.gold",
"chars": 262,
"preview": "using Microsoft.Extensions.Logging;\n\nclass A\n{\n\tILogger<B> _log;\n\t\n\tpublic A(|ILogger<B>|(0) log)\n\t{\n\t\t_log = log;\n\t}\n}"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextTypeMultipleNamespaces.cs",
"chars": 174,
"preview": "using Microsoft.Extensions.Logging;\n\nnamespace X\n{\n\tclass A { }\n}\n\nnamespace Y\n{\n\tclass A\n\t{\n\t\tILogger<X.A> _log;\n\t\t\n\t\tp"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextTypeMultipleNamespaces.cs.gold",
"chars": 308,
"preview": "using Microsoft.Extensions.Logging;\n\nnamespace X\n{\n\tclass A { }\n}\n\nnamespace Y\n{\n\tclass A\n\t{\n\t\tILogger<X.A> _log;\n\t\t\n\t\t"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextTypeMultipleParameters.cs",
"chars": 135,
"preview": "using Microsoft.Extensions.Logging;\n\nclass A\n{\n\tILogger<B> _log;\n\t\n\tpublic A(int a, ILogger<B> log)\n\t{\n\t\t_log = log;\n\t}\n"
},
{
"path": "test/data/Analyzers/ContextualLoggerConstructor/MicrosoftWrongContextTypeMultipleParameters.cs.gold",
"chars": 269,
"preview": "using Microsoft.Extensions.Logging;\n\nclass A\n{\n\tILogger<B> _log;\n\t\n\tpublic A(int a, |ILogger<B>|(0) log)\n\t{\n\t\t_log = lo"
},
{
"path": "test/data/Analyzers/ContextualLoggerSerilogFactory/SerilogCorrectContextType.cs",
"chars": 110,
"preview": "using Serilog;\n\nclass A\n{\n private static readonly ILogger Logger = Logger.ForContext<A>();\n}\n\nclass B {} \n"
},
{
"path": "test/data/Analyzers/ContextualLoggerSerilogFactory/SerilogCorrectContextType.cs.gold",
"chars": 170,
"preview": "using Serilog;\n\nclass A\n{\n private static readonly ILogger Logger = Logger.ForContext<A>();\n}\n\nclass B {} \n\n--------"
},
{
"path": "test/data/Analyzers/ContextualLoggerSerilogFactory/SerilogWrongContextType.cs",
"chars": 110,
"preview": "using Serilog;\n\nclass A\n{\n private static readonly ILogger Logger = Logger.ForContext<B>();\n}\n\nclass B {} \n"
},
{
"path": "test/data/Analyzers/ContextualLoggerSerilogFactory/SerilogWrongContextType.cs.gold",
"chars": 256,
"preview": "using Serilog;\n\nclass A\n{\n private static readonly ILogger Logger = |Logger.ForContext<B>()|(0);\n}\n\nclass B {} \n\n---"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogCorrectExceptionPassing.cs",
"chars": 219,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogCorrectExceptionPassing.cs.gold",
"chars": 278,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogIncorrectExceptionPassing.cs",
"chars": 225,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogIncorrectExceptionPassing.cs.gold",
"chars": 366,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogIncorrectExceptionPassingDynamicTemplate.cs",
"chars": 236,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogIncorrectExceptionPassingDynamicTemplate.cs.gold",
"chars": 465,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogMultipleExceptionPassing.cs",
"chars": 253,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/CorrectExceptionPassing/SerilogMultipleExceptionPassing.cs.gold",
"chars": 312,
"preview": "using System;\nusing Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/Analyzers/DuplicatePropertiesTemplate/SerilogDuplicateNamedProperty.cs",
"chars": 199,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/DuplicatePropertiesTemplate/SerilogDuplicateNamedProperty.cs.gold",
"chars": 398,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/LogMessageIsSentence/SerilogNotSentenceMessage.cs",
"chars": 205,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/Analyzers/LogMessageIsSentence/SerilogNotSentenceMessage.cs.gold",
"chars": 265,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/LogMessageIsSentence/SerilogSentenceMessage.cs",
"chars": 201,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/Analyzers/LogMessageIsSentence/SerilogSentenceMessage.cs.gold",
"chars": 380,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PositionalPropertiesUsage/SerilogPositionProperty.cs",
"chars": 186,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PositionalPropertiesUsage/SerilogPositionProperty.cs.gold",
"chars": 325,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogContextInterpolatedStringProperty.cs",
"chars": 244,
"preview": "using Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public stati"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogContextInterpolatedStringProperty.cs.gold",
"chars": 304,
"preview": "using Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public stat"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogContextInvalidNamedProperty.cs",
"chars": 210,
"preview": "using Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public stati"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogContextInvalidNamedProperty.cs.gold",
"chars": 375,
"preview": "using Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public stat"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogIgnoredInvalidNamedProperty.cs",
"chars": 204,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogIgnoredInvalidNamedProperty.cs.gold",
"chars": 264,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidElasticNamedProperty.cs",
"chars": 195,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidElasticNamedProperty.cs.gold",
"chars": 372,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedProperty.cs",
"chars": 195,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedProperty.cs.gold",
"chars": 371,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedPropertyWithDot.cs",
"chars": 195,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedPropertyWithDot.cs.gold",
"chars": 373,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedPropertyWithSpace.cs",
"chars": 195,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidNamedPropertyWithSpace.cs.gold",
"chars": 373,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidSyntax.cs",
"chars": 196,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogInvalidSyntax.cs.gold",
"chars": 255,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogValidDestructuredNamedProperty.cs",
"chars": 196,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogValidDestructuredNamedProperty.cs.gold",
"chars": 255,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogValidNamedProperty.cs",
"chars": 195,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzer/SerilogValidNamedProperty.cs.gold",
"chars": 254,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzerDotNet6/ZLoggerInvalidNamedProperty.cs",
"chars": 207,
"preview": "using Microsoft.Extensions.Logging;\nusing ZLogger;\n\nnamespace ConsoleApp\n{\n class A\n {\n public A(ILogger<A"
},
{
"path": "test/data/Analyzers/PropertiesNamingAnalyzerDotNet6/ZLoggerInvalidNamedProperty.cs.gold",
"chars": 383,
"preview": "using Microsoft.Extensions.Logging;\nusing ZLogger;\n\nnamespace ConsoleApp\n{\n class A\n {\n public A(ILogger<A"
},
{
"path": "test/data/QuickFixes/AddDestructuringFix/SerilogEscapedString.cs",
"chars": 242,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/AddDestructuringFix/SerilogEscapedString.cs.gold",
"chars": 243,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/AddDestructuringFix/SerilogNewAnonymousObject.cs",
"chars": 217,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/AddDestructuringFix/SerilogNewAnonymousObject.cs.gold",
"chars": 218,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/AddDestructuringFix/SerilogNewComplexObject.cs",
"chars": 227,
"preview": "using Serilog;\nusing System;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/QuickFixes/AddDestructuringFix/SerilogNewComplexObject.cs.gold",
"chars": 228,
"preview": "using Serilog;\nusing System;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void M"
},
{
"path": "test/data/QuickFixes/RemoveTrailingPeriodFix/SerilogTrailingPeriod.cs",
"chars": 210,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/QuickFixes/RemoveTrailingPeriodFix/SerilogTrailingPeriod.cs.gold",
"chars": 210,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/RenameContextLogPropertyFix/SerilogContextProperty.cs",
"chars": 217,
"preview": "using Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public stati"
},
{
"path": "test/data/QuickFixes/RenameContextLogPropertyFix/SerilogContextProperty.cs.gold",
"chars": 218,
"preview": "using Serilog;\nusing Serilog.Context;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public stat"
},
{
"path": "test/data/QuickFixes/RenameLogPropertyFix/SerilogDestructuredProperty.cs",
"chars": 213,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/RenameLogPropertyFix/SerilogDestructuredProperty.cs.gold",
"chars": 213,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/RenameLogPropertyFix/SerilogProperty.cs",
"chars": 212,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/RenameLogPropertyFix/SerilogProperty.cs.gold",
"chars": 212,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/QuickFixes/RenameLogPropertyFix/SerilogPropertyConcatenated.cs",
"chars": 216,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n {"
},
{
"path": "test/data/QuickFixes/RenameLogPropertyFix/SerilogPropertyConcatenated.cs.gold",
"chars": 217,
"preview": "using Serilog;\n\nnamespace ConsoleApp\n{\n public static class Program\n {\n public static void Main()\n "
},
{
"path": "test/data/nuget.config",
"chars": 673,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n <config>\n <add key=\"repositorypath\" value=\"./packages\" />\n "
},
{
"path": "test/src/Analyzer/AnonymousTypeDestructureAnalyzerTests.cs",
"chars": 434,
"preview": "using NUnit.Framework;\n\nnamespace ReSharper.Structured.Logging.Tests.Analyzer\n{\n public class AnonymousTypeDestructu"
},
{
"path": "test/src/Analyzer/ComplexObjectDestructureAnalyzerTests.cs",
"chars": 1223,
"preview": "using NUnit.Framework;\n\nnamespace ReSharper.Structured.Logging.Tests.Analyzer\n{\n public class ComplexObjectDestructur"
},
{
"path": "test/src/Analyzer/ContextualLoggerConstructorAnalyzerTests.cs",
"chars": 675,
"preview": "using JetBrains.ReSharper.TestFramework;\n\nusing NUnit.Framework;\n\nnamespace ReSharper.Structured.Logging.Tests.Analyzer"
},
{
"path": "test/src/Analyzer/ContextualLoggerSerilogFactoryAnalyzerTests.cs",
"chars": 425,
"preview": "using NUnit.Framework;\n\nnamespace ReSharper.Structured.Logging.Tests.Analyzer\n{\n public class ContextualLoggerSerilo"
}
]
// ... and 20 more files (download for full content)
About this extraction
This page contains the full source code of the olsh/resharper-structured-logging GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 220 files (225.9 KB), approximately 57.4k tokens, and a symbol index with 349 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.