Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update StyleCop #7048

Merged
merged 1 commit into from
Dec 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PropertyGroup>
Copy link
Member Author

Choose a reason for hiding this comment

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

Now you just remove the TreatWarningsAsErrors false from a project if all it's warnings are fixed

<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
46 changes: 23 additions & 23 deletions Emby.Dlna/ContentDirectory/ControlHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -690,16 +690,16 @@ private QueryResult<ServerItem> GetMusicFolders(BaseItem item, User user, StubTy

var serverItems = new ServerItem[]
{
new (item, StubType.Latest),
new (item, StubType.Playlists),
new (item, StubType.Albums),
new (item, StubType.AlbumArtists),
new (item, StubType.Artists),
new (item, StubType.Songs),
new (item, StubType.Genres),
new (item, StubType.FavoriteArtists),
new (item, StubType.FavoriteAlbums),
new (item, StubType.FavoriteSongs)
new(item, StubType.Latest),
new(item, StubType.Playlists),
new(item, StubType.Albums),
new(item, StubType.AlbumArtists),
new(item, StubType.Artists),
new(item, StubType.Songs),
new(item, StubType.Genres),
new(item, StubType.FavoriteArtists),
new(item, StubType.FavoriteAlbums),
new(item, StubType.FavoriteSongs)
};

if (limit < serverItems.Length)
Expand Down Expand Up @@ -751,12 +751,12 @@ private QueryResult<ServerItem> GetMovieFolders(BaseItem item, User user, StubTy

var array = new ServerItem[]
{
new (item, StubType.ContinueWatching),
new (item, StubType.Latest),
new (item, StubType.Movies),
new (item, StubType.Collections),
new (item, StubType.Favorites),
new (item, StubType.Genres)
new(item, StubType.ContinueWatching),
new(item, StubType.Latest),
new(item, StubType.Movies),
new(item, StubType.Collections),
new(item, StubType.Favorites),
new(item, StubType.Genres)
};

if (limit < array.Length)
Expand Down Expand Up @@ -836,13 +836,13 @@ private QueryResult<ServerItem> GetTvFolders(BaseItem item, User user, StubType?

var serverItems = new ServerItem[]
{
new (item, StubType.ContinueWatching),
new (item, StubType.NextUp),
new (item, StubType.Latest),
new (item, StubType.Series),
new (item, StubType.FavoriteSeries),
new (item, StubType.FavoriteEpisodes),
new (item, StubType.Genres)
new(item, StubType.ContinueWatching),
new(item, StubType.NextUp),
new(item, StubType.Latest),
new(item, StubType.Series),
new(item, StubType.FavoriteSeries),
new(item, StubType.FavoriteEpisodes),
new(item, StubType.Genres)
};

if (limit < serverItems.Length)
Expand Down
6 changes: 5 additions & 1 deletion Emby.Dlna/Emby.Dlna.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>

<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>

Expand Down
6 changes: 5 additions & 1 deletion Emby.Drawing/Emby.Drawing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
Expand All @@ -24,7 +28,7 @@
<!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>

Expand Down
3 changes: 1 addition & 2 deletions Emby.Drawing/ImageProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ public sealed class ImageProcessor : IImageProcessor, IDisposable
public async Task ProcessImage(ImageProcessingOptions options, Stream toStream)
{
var file = await ProcessImage(options).ConfigureAwait(false);

using (var fileStream = AsyncFile.OpenRead(file.Item1))
using (var fileStream = AsyncFile.OpenRead(file.path))
{
await fileStream.CopyToAsync(toStream).ConfigureAwait(false);
}
Expand Down
1 change: 0 additions & 1 deletion Emby.Naming/AudioBook/AudioBookListResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public AudioBookListResolver(NamingOptions options)
/// <returns>Returns IEnumerable of <see cref="AudioBookInfo"/>.</returns>
public IEnumerable<AudioBookInfo> Resolve(IEnumerable<FileSystemMetadata> files)
{

// File with empty fullname will be sorted out here.
var audiobookFileInfos = files
.Select(i => _audioBookResolver.Resolve(i.FullName))
Expand Down
6 changes: 5 additions & 1 deletion Emby.Naming/Emby.Naming.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition=" '$(Stability)'=='Unstable'">
<!-- Include all symbols in the main nupkg until Azure Artifact Feed starts supporting ingesting NuGet symbol packages. -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
Expand Down Expand Up @@ -44,7 +48,7 @@
<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Emby.Naming/Video/Format3DParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Emby.Naming.Video
public static class Format3DParser
{
// Static default result to save on allocation costs.
private static readonly Format3DResult _defaultResult = new (false, null);
private static readonly Format3DResult _defaultResult = new(false, null);

/// <summary>
/// Parse 3D format related flags.
Expand Down
2 changes: 1 addition & 1 deletion Emby.Notifications/Emby.Notifications.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!-- Code analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Emby.Photos/Emby.Photos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public abstract class ApplicationHost : IServerApplicationHost, IDisposable
/// <summary>
/// The disposable parts.
/// </summary>
private readonly ConcurrentDictionary<IDisposable, byte> _disposableParts = new ();
private readonly ConcurrentDictionary<IDisposable, byte> _disposableParts = new();

private readonly IFileSystem _fileSystemManager;
private readonly IConfiguration _startupConfig;
Expand Down
19 changes: 10 additions & 9 deletions Emby.Server.Implementations/Data/BaseSqliteRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,21 +160,22 @@ public IStatement[] PrepareAll(IDatabaseConnection connection, IReadOnlyList<str
protected bool TableExists(ManagedConnection connection, string name)
{
return connection.RunInTransaction(
db =>
{
using (var statement = PrepareStatement(db, "select DISTINCT tbl_name from sqlite_master"))
db =>
{
foreach (var row in statement.ExecuteQuery())
using (var statement = PrepareStatement(db, "select DISTINCT tbl_name from sqlite_master"))
{
if (string.Equals(name, row.GetString(0), StringComparison.OrdinalIgnoreCase))
foreach (var row in statement.ExecuteQuery())
{
return true;
if (string.Equals(name, row.GetString(0), StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
}
}

return false;
}, ReadTransactionMode);
return false;
},
ReadTransactionMode);
}

protected List<string> GetColumnNames(IDatabaseConnection connection, string table)
Expand Down
Loading