Skip to content

Commit

Permalink
Upgrade to latest Atom
Browse files Browse the repository at this point in the history
  • Loading branch information
hwndmaster committed Sep 16, 2024
1 parent 382848c commit ae63e27
Show file tree
Hide file tree
Showing 54 changed files with 899 additions and 570 deletions.
142 changes: 140 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,141 @@
[*.cs]
# RCS1090: Add call to 'ConfigureAwait' (or vice versa)
dotnet_diagnostic.RCS1090.severity = none #suggestion
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.severity = suggestion
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _

dotnet_diagnostic.CA1001.severity = warning # CA1001: Types that own disposable fields should be disposable
dotnet_diagnostic.CA1003.severity = warning # CA1003: Use generic event handler instances
dotnet_diagnostic.CA1012.severity = error # CA1012: Abstract types should not have public constructors
dotnet_diagnostic.CA1018.severity = error # CA1018: Mark attributes with AttributeUsageAttribute
dotnet_diagnostic.CA1027.severity = warning # CA1027: Mark enums with FlagsAttribute
dotnet_diagnostic.CA1032.severity = warning # CA1032: Implement standard exception constructors
dotnet_diagnostic.CA1033.severity = error # CA1033: Interface methods should be callable by child types
dotnet_diagnostic.CA1036.severity = suggestion # CA1036: Override methods on comparable types
dotnet_diagnostic.CA1044.severity = error # CA1044: Properties should not be write only
dotnet_diagnostic.CA1046.severity = error # CA1046: Do not overload equality operator on reference types
dotnet_diagnostic.CA1050.severity = error # CA1050: Declare types in namespaces
dotnet_diagnostic.CA1052.severity = error # CA1052: Static holder types should be Static or NotInheritable
dotnet_diagnostic.CA1053.severity = error # CA1053: Static holder types should not have default constructors
dotnet_diagnostic.CA1058.severity = warning # CA1058: Types should not extend certain base types
dotnet_diagnostic.CA1060.severity = error # CA1060: Move pinvokes to native methods class
dotnet_diagnostic.CA1061.severity = error # CA1061: Do not hide base class methods
dotnet_diagnostic.CA1062.severity = warning # CA1062: Validate arguments of public methods
dotnet_diagnostic.CA1066.severity = warning # CA1066: Implement IEquatable when overriding Object.Equals
dotnet_diagnostic.CA1067.severity = warning # CA1067: Override Object.Equals(object) when implementing IEquatable<T>
dotnet_diagnostic.CA1068.severity = warning # CA1068: CancellationToken parameters must come last
dotnet_diagnostic.CA1069.severity = warning # CA1069: Enums values should not be duplicated
dotnet_diagnostic.CA1070.severity = error # CA1070: Do not declare event fields as virtual
dotnet_diagnostic.CA1304.severity = error # CA1304: Specify CultureInfo
dotnet_diagnostic.CA1305.severity = error # CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1307.severity = suggestion # CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1310.severity = error # CA1310: Specify StringComparison for correctness
dotnet_diagnostic.CA1311.severity = error # CA1311: Specify Culture for ToLower and ToUpper
dotnet_diagnostic.CA1507.severity = error # CA1507: Use nameof to express symbol names
dotnet_diagnostic.CA1708.severity = error # CA1708: Identifiers should differ by more than case
dotnet_diagnostic.CA1711.severity = suggestion # CA1711: Identifiers should not have incorrect suffix
dotnet_diagnostic.CA1712.severity = error # CA1712: Do not prefix enum values with type name
dotnet_diagnostic.CA1715.severity = warning # CA1715: Identifiers should have correct prefix
dotnet_diagnostic.CA1720.severity = suggestion # CA1720: Identifier contains type name
dotnet_diagnostic.CA1725.severity = error # CA1725: Parameter names should match base declaration
dotnet_diagnostic.CA1802.severity = warning # CA1802: Use literals where appropriate
dotnet_diagnostic.CA1805.severity = warning # CA1805: Do not initialize unnecessarily
dotnet_diagnostic.CA1806.severity = warning # CA1806: Do not ignore method results
dotnet_diagnostic.CA1822.severity = suggestion # CA1822: Mark members as static
dotnet_diagnostic.CA1823.severity = error # CA1823: Avoid unused private fields
dotnet_diagnostic.CA1825.severity = warning # CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1827.severity = warning # CA1827: Do not use Count() or LongCount() when Any() can be used
dotnet_diagnostic.CA1828.severity = warning # CA1828: Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used
dotnet_diagnostic.CA1829.severity = warning # CA1829: Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1830.severity = warning # CA1830: Prefer strongly-typed Append and Insert method overloads on StringBuilder
dotnet_diagnostic.CA1831.severity = warning # CA1831: Use AsSpan instead of Range-based indexers for string when appropriate
dotnet_diagnostic.CA1832.severity = warning # CA1832: Use AsSpan or AsMemory instead of Range-based indexers for getting ReadOnlySpan or ReadOnlyMemory portion of an array
dotnet_diagnostic.CA1833.severity = warning # CA1833: Use AsSpan or AsMemory instead of Range-based indexers for getting Span or Memory portion of an array
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1836.severity = error # CA1836: Prefer IsEmpty over Count
dotnet_diagnostic.CA1837.severity = error # CA1837: Use 'Environment.ProcessId'
dotnet_diagnostic.CA1838.severity = error # CA1838: Avoid 'StringBuilder' parameters for P/Invokes
dotnet_diagnostic.CA1839.severity = error # CA1839: Use 'Environment.ProcessPath'
dotnet_diagnostic.CA1840.severity = error # CA1840: Use 'Environment.CurrentManagedThreadId'
dotnet_diagnostic.CA1841.severity = error # CA1841: Prefer Dictionary.Contains
dotnet_diagnostic.CA1842.severity = error # CA1842: Do not use WhenAll with a single task
dotnet_diagnostic.CA1843.severity = error # CA1843: Do not use WaitAll with a single task
dotnet_diagnostic.CA1844.severity = error # CA1844: Provide memory-based overrides of async methods when subclassing 'Stream'
dotnet_diagnostic.CA1845.severity = error # CA1845: Use span-based 'string.Concat'
dotnet_diagnostic.CA1846.severity = error # CA1846: Prefer AsSpan over Substring
dotnet_diagnostic.CA1847.severity = warning # CA1847: Use char literal for a single character lookup
dotnet_diagnostic.CA1849.severity = error # CA1849: Call async methods when in an async method
dotnet_diagnostic.CA1850.severity = error # CA1850: Prefer static HashData method over ComputeHash
dotnet_diagnostic.CA1851.severity = error # CA1851: Possible multiple enumerations of IEnumerable collection
dotnet_diagnostic.CA1853.severity = warning # CA1853: Unnecessary call to 'Dictionary.ContainsKey()'
dotnet_diagnostic.CA1854.severity = warning # CA1854: Prefer the IDictionary.TryGetValue() method
dotnet_diagnostic.CA1855.severity = warning # CA1855: Use Span.Clear instead of Span.Fill
dotnet_diagnostic.CA2000.severity = warning # CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2002.severity = warning # CA2002: Do not lock on objects with weak identity
dotnet_diagnostic.CA2007.severity = suggestion # CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2008.severity = suggestion # CA2008: Do not create tasks without passing a TaskScheduler
dotnet_diagnostic.CA2009.severity = warning # CA2009: Do not call ToImmutableCollection on an ImmutableCollection value
dotnet_diagnostic.CA2011.severity = warning # CA2011: Avoid infinite recursion
dotnet_diagnostic.CA2012.severity = warning # CA2012: Use ValueTasks correctly
dotnet_diagnostic.CA2013.severity = warning # CA2013: Do not use ReferenceEquals with value types
dotnet_diagnostic.CA2014.severity = error # CA2014: Do not use stackalloc in loops
dotnet_diagnostic.CA2016.severity = error # CA2016: Forward the 'CancellationToken' parameter to methods that take one
dotnet_diagnostic.CA2019.severity = error # CA2019: ThreadStatic fields should not use inline initialization
dotnet_diagnostic.CA2020.severity = error # CA2020: Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr
dotnet_diagnostic.CA2100.severity = warning # CA2100: Review SQL queries for security vulnerabilities
dotnet_diagnostic.CA2101.severity = warning # CA2101: Specify marshaling for P/Invoke string arguments
dotnet_diagnostic.CA2119.severity = warning # CA2119: Seal methods that satisfy private interfaces
dotnet_diagnostic.CA2153.severity = warning # CA2153: Avoid handling Corrupted State Exceptions
dotnet_diagnostic.CA2200.severity = error # CA2200: Rethrow to preserve stack details
dotnet_diagnostic.CA2201.severity = warning # CA2201: Do not raise reserved exception types
dotnet_diagnostic.CA2207.severity = warning # CA2207: Initialize value type static fields inline
dotnet_diagnostic.CA2208.severity = warning # CA2208: Instantiate argument exceptions correctly
dotnet_diagnostic.CA2211.severity = error # CA2211: Non-constant fields should not be visible
dotnet_diagnostic.CA2213.severity = warning # CA2213: Disposable fields should be disposed
dotnet_diagnostic.CA2214.severity = error # CA2214: Do not call overridable methods in constructors
dotnet_diagnostic.CA2215.severity = error # CA2215: Dispose methods should call base class dispose
dotnet_diagnostic.CA2217.severity = warning # CA2217: Do not mark enums with FlagsAttribute
dotnet_diagnostic.CA2218.severity = error # CA2218: Override GetHashCode on overriding Equals
dotnet_diagnostic.CA2219.severity = warning # CA2219: Do not raise exceptions in finally clauses
dotnet_diagnostic.CA2224.severity = error # CA2224: Override Equals on overloading operator equals
dotnet_diagnostic.CA2231.severity = warning # CA2231: Overload operator equals on overriding value type Equals
dotnet_diagnostic.CA2241.severity = warning # CA2241: Provide correct arguments to formatting methods
dotnet_diagnostic.CA2242.severity = warning # CA2242: Test for NaN correctly
dotnet_diagnostic.CA2244.severity = warning # CA2244: Do not duplicate indexed element initializations
dotnet_diagnostic.CA2245.severity = error # CA2245: Do not assign a property to itself
dotnet_diagnostic.CA2246.severity = warning # CA2246: Assigning symbol and its member in the same statement
dotnet_diagnostic.CA2248.severity = error # CA2248: Provide correct 'enum' argument to 'Enum.HasFlag'
dotnet_diagnostic.CA2249.severity = error # CA2249: Consider using 'string.Contains' instead of 'string.IndexOf'
dotnet_diagnostic.CA2250.severity = error # CA2250: Use 'ThrowIfCancellationRequested'
dotnet_diagnostic.CA2251.severity = error # CA2251: Use 'string.Equals'
dotnet_diagnostic.CA5351.severity = warning # CA5351: Do Not Use Broken Cryptographic Algorithms
dotnet_diagnostic.CA5364.severity = warning # CA5364: Do Not Use Deprecated Security Protocols
dotnet_diagnostic.CS8509.severity = warning # CS8509: The switch expression does not handle all possible values of its input type (it is not exhaustive)
dotnet_diagnostic.RCS1075.severity = suggestion # Avoid empty catch clause that catches System.Exception
dotnet_diagnostic.RCS1090.severity = suggestion # RCS1090: Add call to 'ConfigureAwait' (or vice versa)

# CA1001: Subject<T> to ignore
dotnet_code_quality.CA1001.excluded_symbol_names = T:System.Reactive.Subjects.Subject*

# CA1062: Do not analyze in method extensions
dotnet_code_quality.CA1062.exclude_extension_method_this_parameter = true

# CA2000: Satisfy when object is being created and immediately taken by someone (whether with a method or as a ctor parameter).
# Example: https://github.com/dotnet/roslyn-analyzers/blob/main/docs/Analyzer%20Configuration.md#configure-dispose-ownership-transfer-for-arguments-passed-to-constructor-invocation
#dotnet_code_quality.dispose_analysis_kind = AllPathsOnlyNotDisposed
dotnet_code_quality.dispose_ownership_transfer_at_constructor = true
dotnet_code_quality.dispose_ownership_transfer_at_method_call = true

[{**/*Tests.cs,**/StepDefinitions/*.cs}]
dotnet_diagnostic.CA1062.severity = suggestion # CA1062: Validate arguments of public methods
dotnet_diagnostic.CA1304.severity = suggestion # CA1304: Specify CultureInfo
dotnet_diagnostic.CA1305.severity = suggestion # CA1305: Specify IFormatProvider
dotnet_diagnostic.CA1311.severity = suggestion # CA1311: Specify Culture for ToLower and ToUpper
dotnet_diagnostic.VSTHRD105.severity = none # Avoid method overloads that assume TaskScheduler.Current. Use an overload that accepts a TaskScheduler and specify TaskScheduler.Default (or any other) explicitly
dotnet_diagnostic.VSTHRD200.severity = none # Use "Async" suffix for async methods

[*TestingUtil/*.cs]
dotnet_diagnostic.VSTHRD002.severity = none # Use await or JoinableTaskFactory.Run instead
3 changes: 3 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ jobs:
release:
name: Release
runs-on: windows-latest
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
build:

runs-on: windows-latest
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

steps:
- uses: actions/checkout@v2
Expand Down
77 changes: 77 additions & 0 deletions Atom.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AtomLocation>..\atom\</AtomLocation>
</PropertyGroup>

<Target Name="AtomDataReference" BeforeTargets="PrepareProjectReferences;CollectPackageReferences"
Condition="'$(ReferenceAtomData)' == 'true'">
<PropertyGroup>
<Name>Atom.Data</Name>
<Path>$(MSBuildThisFileDirectory)$(AtomLocation)$(Name)</Path>
<ProjectExists Condition="Exists('$(Path)')">true</ProjectExists>
</PropertyGroup>

<!-- <Message Text="$(Path)" Importance="High" />
<Message Text="ProjectExists: $(ProjectExists)" Importance="High" /> -->

<ItemGroup>
<Reference Include="Genius.$(Name)" Condition="'$(ProjectExists)' == 'true'">
<HintPath>$(Path)\bin\Debug\net8.0\Genius.$(Name).dll</HintPath>
</Reference>
<PackageReference Include="Genius.$(Name)" Condition="'$(ProjectExists)' != 'true'" />
</ItemGroup>
</Target>

<Target Name="AtomInfrastructureReference" BeforeTargets="PrepareProjectReferences;CollectPackageReferences"
Condition="'$(ReferenceAtomInfrastructure)' == 'true'">
<PropertyGroup>
<Name>Atom.Infrastructure</Name>
<Path>$(MSBuildThisFileDirectory)$(AtomLocation)$(Name)</Path>
<ProjectExists Condition="Exists('$(Path)')">true</ProjectExists>
</PropertyGroup>

<ItemGroup>
<Reference Include="Genius.$(Name)" Condition="'$(ProjectExists)' == 'true'">
<HintPath>$(Path)\bin\Debug\net8.0\Genius.$(Name).dll</HintPath>
</Reference>
<PackageReference Include="Genius.$(Name)" Condition="'$(ProjectExists)' != 'true'" />
</ItemGroup>

<ItemGroup Condition="$(MSBuildProjectName.EndsWith('.Tests')) Or $(MSBuildProjectName.EndsWith('.TestingUtil'))">
<Reference Include="Genius.$(Name).TestingUtil" Condition="'$(ProjectExists)' == 'true'">
<HintPath>$(Path).TestingUtil\bin\Debug\net8.0\Genius.$(Name).TestingUtil.dll</HintPath>
</Reference>
<PackageReference Include="Genius.$(Name).TestingUtil" Condition="'$(ProjectExists)' != 'true'" />
</ItemGroup>

</Target>

<Target Name="AtomUiFormsReference" BeforeTargets="PrepareProjectReferences;CollectPackageReferences"
Condition="'$(ReferenceAtomUiForms)' == 'true'">
<PropertyGroup>
<Name>Atom.UI.Forms</Name>
<Path>$(MSBuildThisFileDirectory)$(AtomLocation)$(Name)</Path>
<ProjectExists Condition="Exists('$(Path)')">true</ProjectExists>
</PropertyGroup>

<ItemGroup>
<Reference Include="Genius.$(Name)" Condition="'$(ProjectExists)' == 'true'">
<HintPath>$(Path)\bin\Debug\$(UiTargetFramework)\Genius.$(Name).dll</HintPath>
</Reference>
<PackageReference Include="Genius.$(Name)" Condition="'$(ProjectExists)' != 'true'" />

<!-- 3rd-party dependencies from Atom.UI.Forms -->
<_AtomUiFormsThirdPartyDependencies Include="$(Path)\bin\Debug\$(UiTargetFramework)\*.dll" />
</ItemGroup>

<Copy SourceFiles="@(_AtomUiFormsThirdPartyDependencies)" DestinationFolder="$(TargetDir)\" />

<ItemGroup Condition="$(MSBuildProjectName.EndsWith('.Tests')) Or $(MSBuildProjectName.EndsWith('.TestingUtil'))">
<Reference Include="Genius.$(Name).TestingUtil" Condition="'$(ProjectExists)' == 'true'">
<HintPath>$(Path).TestingUtil\bin\Debug\$(UiTargetFramework)\Genius.$(Name).TestingUtil.dll</HintPath>
</Reference>
<PackageReference Include="Genius.$(Name).TestingUtil" Condition="'$(ProjectExists)' != 'true'" />
</ItemGroup>

</Target>
</Project>
Loading

0 comments on commit ae63e27

Please sign in to comment.