Skip to content

Commit

Permalink
Update dependencies (#9)
Browse files Browse the repository at this point in the history
* updates

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* fix ci

* ci fix

* fix ci

* fix ci
  • Loading branch information
MaceWindu committed Oct 25, 2023
1 parent 1ce1efb commit de5569b
Show file tree
Hide file tree
Showing 17 changed files with 135 additions and 127 deletions.
32 changes: 15 additions & 17 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ indent_style = space
indent_size = 4
end_of_line = crlf
insert_final_newline = false
spelling_exclusion_path = spellcheck.txt

[*.cs]
dotnet_analyzer_diagnostic.severity = error
Expand All @@ -13,7 +14,6 @@ dotnet_code_quality.api_surface = all
dotnet_diagnostic.CA1002.severity = none # CA1002: Do not expose generic lists
dotnet_code_quality.CA1002.api_surface = public,internal


dotnet_diagnostic.CA1031.severity = none # CA1031: Do not catch general exception types

dotnet_diagnostic.CA1054.severity = none # CA1054: URI parameters should not be strings
Expand All @@ -22,14 +22,12 @@ dotnet_code_quality.CA1054.api_surface = all
dotnet_diagnostic.CA1056.severity = none # CA1056: URI properties should not be strings
dotnet_code_quality.CA1056.api_surface = all


dotnet_diagnostic.CA1062.severity = none # CA1062: Validate arguments of public methods
dotnet_code_quality.CA1062.api_surface = all

dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers should not contain underscores
dotnet_code_quality.CA1707.api_surface = all


dotnet_diagnostic.CA2227.severity = none # CA2227: Collection properties should be read only

dotnet_diagnostic.IDE0008.severity = error # 'var' preferences
Expand All @@ -48,34 +46,34 @@ dotnet_diagnostic.IDE1006.severity = error # Naming rule violation

# styles
dotnet_naming_style.style_pascal_case.capitalization = pascal_case
dotnet_naming_style.style_pascal_case.required_suffix =
dotnet_naming_style.style_pascal_case.required_prefix =
dotnet_naming_style.style_pascal_case.word_separator =
dotnet_naming_style.style_pascal_case.required_suffix =
dotnet_naming_style.style_pascal_case.required_prefix =
dotnet_naming_style.style_pascal_case.word_separator =

dotnet_naming_style.style_i_pascal_case.capitalization = pascal_case
dotnet_naming_style.style_i_pascal_case.required_suffix =
dotnet_naming_style.style_i_pascal_case.required_suffix =
dotnet_naming_style.style_i_pascal_case.required_prefix = I
dotnet_naming_style.style_i_pascal_case.word_separator =
dotnet_naming_style.style_i_pascal_case.word_separator =

dotnet_naming_style.style_t_pascal_case.capitalization = pascal_case
dotnet_naming_style.style_t_pascal_case.required_suffix =
dotnet_naming_style.style_t_pascal_case.required_suffix =
dotnet_naming_style.style_t_pascal_case.required_prefix = T
dotnet_naming_style.style_t_pascal_case.word_separator =
dotnet_naming_style.style_t_pascal_case.word_separator =

dotnet_naming_style.style_all_caps.capitalization = all_upper
dotnet_naming_style.style_all_caps.required_suffix =
dotnet_naming_style.style_all_caps.required_prefix =
dotnet_naming_style.style_all_caps.required_suffix =
dotnet_naming_style.style_all_caps.required_prefix =
dotnet_naming_style.style_all_caps.word_separator = _

dotnet_naming_style.style_underscore_camel_case.capitalization = camel_case
dotnet_naming_style.style_underscore_camel_case.required_suffix =
dotnet_naming_style.style_underscore_camel_case.required_suffix =
dotnet_naming_style.style_underscore_camel_case.required_prefix = _
dotnet_naming_style.style_underscore_camel_case.word_separator =
dotnet_naming_style.style_underscore_camel_case.word_separator =

dotnet_naming_style.style_camel_case.capitalization = camel_case
dotnet_naming_style.style_camel_case.required_suffix =
dotnet_naming_style.style_camel_case.required_prefix =
dotnet_naming_style.style_camel_case.word_separator =
dotnet_naming_style.style_camel_case.required_suffix =
dotnet_naming_style.style_camel_case.required_prefix =
dotnet_naming_style.style_camel_case.word_separator =

# symbols
dotnet_naming_symbols.symbols_allways_pascal_case.applicable_kinds = namespace,class,struct,enum,property,method,event,delegate
Expand Down
4 changes: 3 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Configurations>Debug;Release</Configurations>

<LangVersion>11.0</LangVersion>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<Features>strict</Features>
Expand All @@ -21,6 +21,8 @@
<AnalysisLevel>preview-All</AnalysisLevel>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<ReportAnalyzer>true</ReportAnalyzer>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup Label="External Code Analyzers">
Expand Down
33 changes: 15 additions & 18 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<Project>
<ItemGroup>
<PackageVersion Include="Seq.Apps" Version="2021.4.0" />
<PackageVersion Include="AdaptiveCards.Templating" Version="1.4.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />

<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="PolySharp" Version="1.13.2" />

<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="System.Text.Json" Version="7.0.3" />

<PackageVersion Include="Lindhart.Analyser.MissingAwaitWarning" Version="3.0.0-beta" />
<PackageVersion Include="NUnit.Analyzers" Version="3.6.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview1.23165.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.5-beta1.23270.2" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Seq.Apps" Version="2023.4.0" />
<PackageVersion Include="AdaptiveCards.Templating" Version="1.5.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="PolySharp" Version="1.13.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit" Version="3.13.3" />
<PackageVersion Include="System.Text.Json" Version="7.0.3" />
<PackageVersion Include="Lindhart.Analyser.MissingAwaitWarning" Version="3.0.0-beta" />
<PackageVersion Include="NUnit.Analyzers" Version="3.8.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0-preview.23472.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0-beta1.23472.1" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Those examples could be used with `AdaptiveCard` designer.
In addition to standard AdaptiveTemplate [functions](https://learn.microsoft.com/en-us/azure/bot-service/adaptive-expressions/adaptive-expressions-prebuilt-functions?view=azure-bot-service-4.0), application implements several custom functions:

- `_nomd(param)`: this function takes single parameter of any type and in case of string escapes all supported [markdown control sequences](https://learn.microsoft.com/en-us/adaptive-cards/authoring-cards/text-features). Function is useful when rendered text could contain markdown-like character sequences as AdaptiveCard doesn't provide option to disable markdown from template.
- `_jsonPrettify(param)`: same as built-in jsonStringify(), but `JSON` rendered indented and `null` values are ommited
- `_jsonPrettify(param)`: same as built-in jsonStringify(), but `JSON` rendered indented and `null` values are omitted
- `_colorUri(hex_rgb)`: generates data uri with one-pixel image of specified color. Parameter must be string with hex color in `RRGGBB` form. Because `AdaptiveCard` doesn't support background color but supports background image, this function could be used to emulate background color using background image.

## Extra Links
Expand Down
11 changes: 10 additions & 1 deletion Seq.App.Teams.AdaptiveCard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".root", ".root", "{D2DDC05F
LICENSE.txt = LICENSE.txt
nuget.config = nuget.config
README.md = README.md
spellcheck.txt = spellcheck.txt
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Seq.App.Teams.AdaptiveCard.Tests", "tests\Seq.App.Teams.AdaptiveCard.Tests\Seq.App.Teams.AdaptiveCard.Tests.csproj", "{971F2FDD-EC57-4E9D-8317-C99AFE87B575}"
Expand All @@ -28,6 +29,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ci", "ci", "{D0D1202E-6444-
ci\SetVersion.ps1 = ci\SetVersion.ps1
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB2294A-EAFE-45BF-B3E7-B5F2BC4FB248}"
ProjectSection(SolutionItems) = preProject
tests\.editorconfig = tests\.editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -46,8 +52,11 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{971F2FDD-EC57-4E9D-8317-C99AFE87B575} = {0AB2294A-EAFE-45BF-B3E7-B5F2BC4FB248}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {34F2739E-EFC9-4753-9EB3-CF2A94B9D9C3}
SolutionGuid = {45F4DD2D-CE5F-4FAA-8968-D04D1273476B}
SolutionGuid = {34F2739E-EFC9-4753-9EB3-CF2A94B9D9C3}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion ci/Seq.App.Teams.AdaptiveCard.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<file src="..\src\Seq.App.Teams.AdaptiveCard\bin\Release\netstandard2.0\Seq.App.Teams.AdaptiveCard.xml" target="lib\netstandard2.0\" />
<file src="..\src\Seq.App.Teams.AdaptiveCard\bin\Release\netstandard2.0\Seq.App.Teams.AdaptiveCard.dll" target="lib\netstandard2.0\" />

<!--seq doesn't resolve nuget dependencies or do it incorreclty-->
<!--seq doesn't resolve nuget dependencies or does it incorrectly-->
<file src="..\src\Seq.App.Teams.AdaptiveCard\bin\Release\netstandard2.0\publish\AdaptiveCards.Templating.dll" target="lib\netstandard2.0\" />
<file src="..\src\Seq.App.Teams.AdaptiveCard\bin\Release\netstandard2.0\publish\AdaptiveExpressions.dll" target="lib\netstandard2.0\" />
<file src="..\src\Seq.App.Teams.AdaptiveCard\bin\Release\netstandard2.0\publish\Antlr4.Runtime.Standard.dll" target="lib\netstandard2.0\" />
Expand Down
58 changes: 21 additions & 37 deletions ci/default.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
variables:
- name: solution
value: Seq.App.Teams.AdaptiveCard.sln
- name: build_configuration
value: Release
- name: assemblyVersion
value: 1.1.0
value: 1.2.0
- name: packageVersion
value: 1.1.0
value: 1.2.0
- name: nugetDevVersion
value: 1.1.0
value: 1.2.1

trigger:
- master
Expand All @@ -23,16 +25,19 @@ stages:
jobs:
- job: main_job
pool:
vmImage: 'windows-2022'
vmImage: 'ubuntu-latest'
displayName: 'Seq.App.Teams.AdaptiveCard'

steps:

#########
# BUILD #
#########
- task: NuGetToolInstaller@1
displayName: Install latest nuget tools
- task: UseDotNet@2
displayName: 'Install .NET 8'
inputs:
includePreviewVersions: true
version: 8.x

- task: PowerShell@2
inputs:
Expand All @@ -41,12 +46,12 @@ stages:
arguments: -path $(Build.SourcesDirectory)/src/Seq.App.Teams.AdaptiveCard/Seq.App.Teams.AdaptiveCard.csproj -version $(assemblyVersion)
displayName: Update assembly version

- task: MSBuild@1
- task: DotNetCoreCLI@2
inputs:
solution: '$(solution)'
configuration: 'Release'
msbuildArguments: '/t:Restore;Rebuild -m /p:ContinuousIntegrationBuild=true'
displayName: Build solution
command: 'build'
projects: '$(solution)'
arguments: '-property:ContinuousIntegrationBuild=true --configuration $(build_configuration)'
displayName: Build Solution

- task: DotNetCoreCLI@2
inputs:
Expand All @@ -58,43 +63,22 @@ stages:
nobuild: true
displayName: Publish project

- task: DotNetCoreCLI@2
inputs:
command: 'publish'
projects: '$(Build.SourcesDirectory)/tests/Seq.App.Teams.AdaptiveCard.Tests/Seq.App.Teams.AdaptiveCard.Tests.csproj'
publishWebProjects: false
zipAfterPublish: false
arguments: -f net7.0 -c Release
nobuild: true
displayName: Publish test project for net7.0

########
# TEST #
########
- task: UseDotNet@2
displayName: 'Install .net 7'
inputs:
packageType: sdk
version: 7.x

- script: dotnet test $(Build.SourcesDirectory)\tests\Seq.App.Teams.AdaptiveCard.Tests\bin\Release\net7.0\Seq.App.Teams.AdaptiveCard.Tests.dll /Framework:net7.0 /logger:trx
displayName: 'Tests: .NET 7'
- script: dotnet test $(Build.SourcesDirectory)/$(solution) -c $(build_configuration) -l trx
displayName: 'Run Tests'
condition: succeededOrFailed()

- task: PublishTestResults@2
inputs:
testRunner: VsTest
testResultsFiles: '**/*.trx'
testRunTitle: '.NET 7'
testRunTitle: 'Tests'
displayName: 'Publish test results'
condition: succeededOrFailed()

- task: DeleteFiles@1
inputs:
contents: '**/*.trx'
displayName: 'Cleanup'
condition: succeededOrFailed()

##########################
# CREATE / PUBLISH NUGET #
##########################
Expand All @@ -111,14 +95,14 @@ stages:

- task: CmdLine@2
inputs:
script: nuget.exe Pack $(Build.SourcesDirectory)\ci\Seq.App.Teams.AdaptiveCard.nuspec -OutputDirectory $(Build.SourcesDirectory)\built
script: nuget pack $(Build.SourcesDirectory)/ci/Seq.App.Teams.AdaptiveCard.nuspec -OutputDirectory $(Build.SourcesDirectory)/built
workingDirectory: $(Build.SourcesDirectory)/ci
displayName: Build nuget for artifacts
condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'release'))

- task: CmdLine@2
inputs:
script: nuget.exe Pack $(Build.SourcesDirectory)\ci\Seq.App.Teams.AdaptiveCard.nuspec -OutputDirectory $(Build.SourcesDirectory)\built -Symbols -SymbolPackageFormat snupkg
script: nuget pack $(Build.SourcesDirectory)/ci/Seq.App.Teams.AdaptiveCard.nuspec -OutputDirectory $(Build.SourcesDirectory)/built -Symbols -SymbolPackageFormat snupkg
workingDirectory: $(Build.SourcesDirectory)/ci
displayName: Build nuget for nuget.org
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'release'))
Expand Down
13 changes: 13 additions & 0 deletions spellcheck.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
microsoft
Stringify
json
webhook
Webhooks
nomd
serializer
Namespaced
rties
Prope
nrties
rrties
ndata
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
<Version>1.0.0</Version>

<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>CS1591</NoWarn>
</PropertyGroup>


<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DebugType>portable</DebugType>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand Down
2 changes: 1 addition & 1 deletion src/Seq.App.Teams.AdaptiveCard/TeamsApp.CustomFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Seq.App.Teams;

public sealed partial class TeamsApp
{
private static readonly Dictionary<(int, int, int), string> _colors = new();
private static readonly Dictionary<(int, int, int), string> _colors = [];

public static void RegisterCustomFunctions()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Seq.App.Teams.AdaptiveCard/TeamsApp.OnEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public sealed partial class TeamsApp
var data = new Dictionary<string, object?>()
{
{ "Id", evt.Id },
{ "TimeStamp", evt.TimestampUtc.ToString("O") },
{ "TimeStamp", evt.Timestamp.ToString("O") },
{ "Level", evt.Data.Level.ToString() },
{ "MessageTemplate", evt.Data.MessageTemplate },
{ "Message", evt.Data.RenderedMessage },
Expand Down Expand Up @@ -149,7 +149,7 @@ async Task ISubscribeToAsync<LogEventData>.OnAsync(Event<LogEventData> evt)
}
catch (Exception ex)
{
_log.Error(ex, "An error occured while constructing the request");
_log.Error(ex, "An error occurred while constructing the request");
}
}
}
9 changes: 6 additions & 3 deletions src/Seq.App.Teams.AdaptiveCard/TeamsApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ namespace Seq.App.Teams;
public sealed partial class TeamsApp : SeqApp, ISubscribeToAsync<LogEventData>
#pragma warning restore CA1001 // Types that own disposable fields should be disposable
{
private static readonly char[] _logLevelsSeparator = [','];
private static readonly char[] _propertiesSeparators = ['\r', '\n'];

private ILogger _log = default!;
private string _defaultTemplate = default!;
private HashSet<LogEventLevel>? _loggedLevels;
Expand All @@ -26,7 +29,7 @@ private HashSet<LogEventLevel> LogEventLevelList
var result = new HashSet<LogEventLevel>();
if (!string.IsNullOrEmpty(LogEventLevels))
{
var strValues = LogEventLevels!.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
var strValues = LogEventLevels!.Split(_logLevelsSeparator, StringSplitOptions.RemoveEmptyEntries);
if (strValues?.Length > 0)
{
foreach (var strValue in strValues)
Expand Down Expand Up @@ -56,7 +59,7 @@ private IReadOnlyList<IReadOnlyList<string>> ExcludedProperties
if (!string.IsNullOrWhiteSpace(PropertiesToExclude))
{

var lines = PropertiesToExclude!.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
var lines = PropertiesToExclude!.Split(_propertiesSeparators, StringSplitOptions.RemoveEmptyEntries);

foreach (var line in lines)
{
Expand Down Expand Up @@ -96,7 +99,7 @@ private IReadOnlyList<IReadOnlyList<string>> ExcludedProperties
case ']':
if (isInName)
{
(properties ??= new()).Add(sb.ToString());
(properties ??= []).Add(sb.ToString());
sb.Length = 0;
isInName = false;
}
Expand Down

0 comments on commit de5569b

Please sign in to comment.