Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Fixed warnings in code

Joseph Milazzofa71a40990a8
diff --git a/API/Controllers/AdminController.cs b/API/Controllers/AdminController.cs
index 2c2e64bd7..4aba6b7bd 100644
--- a/API/Controllers/AdminController.cs
+++ b/API/Controllers/AdminController.cs
@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using API.Entities;
-using API.Interfaces;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
diff --git a/API/Controllers/UsersController.cs b/API/Controllers/UsersController.cs
index f309ef0f5..db81af51d 100644
--- a/API/Controllers/UsersController.cs
+++ b/API/Controllers/UsersController.cs
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using API.Data;
using API.DTOs;
using API.Entities;
using API.Extensions;
@@ -39,7 +38,6 @@ namespace API.Controllers
return BadRequest("Library name already exists. Please choose a unique name to the server.");
}
- // TODO: We probably need to normalize the folders before we insert
var library = new Library
{
Name = createLibraryDto.Name.ToLower(),
diff --git a/API/DTOs/SeriesDto.cs b/API/DTOs/SeriesDto.cs
index 8f13061bf..9e9491d7e 100644
--- a/API/DTOs/SeriesDto.cs
+++ b/API/DTOs/SeriesDto.cs
@@ -1,6 +1,4 @@
-using System.Collections.Generic;
-
-namespace API.DTOs
+namespace API.DTOs
{
public class SeriesDto
{
diff --git a/API/Data/LibraryRepository.cs b/API/Data/LibraryRepository.cs
index a218cdd98..ce986279f 100644
--- a/API/Data/LibraryRepository.cs
+++ b/API/Data/LibraryRepository.cs
@@ -6,7 +6,6 @@ using API.Entities;
using API.Interfaces;
using AutoMapper;
using AutoMapper.QueryableExtensions;
-using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace API.Data
diff --git a/API/Interfaces/IDirectoryService.cs b/API/Interfaces/IDirectoryService.cs
index dcb1e763d..818aa9451 100644
--- a/API/Interfaces/IDirectoryService.cs
+++ b/API/Interfaces/IDirectoryService.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using API.DTOs;
-using API.Entities;
namespace API.Interfaces
{
diff --git a/API/Interfaces/ILibraryRepository.cs b/API/Interfaces/ILibraryRepository.cs
index 41be8ef40..409068fc3 100644
--- a/API/Interfaces/ILibraryRepository.cs
+++ b/API/Interfaces/ILibraryRepository.cs
@@ -2,7 +2,6 @@
using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
-using Microsoft.AspNetCore.Mvc;
namespace API.Interfaces
{
@@ -22,6 +21,5 @@ namespace API.Interfaces
bool SaveAll();
Library GetLibraryForName(string libraryName);
Task<IEnumerable<LibraryDto>> GetLibrariesForUsernameAysnc(string userName);
- //Task<IEnumerable<Series>> GetSeriesForIdAsync(int libraryId);
}
}
\ No newline at end of file
diff --git a/API/Services/DirectoryService.cs b/API/Services/DirectoryService.cs
index 7ff5c605b..de1cf994b 100644
--- a/API/Services/DirectoryService.cs
+++ b/API/Services/DirectoryService.cs
@@ -5,7 +5,6 @@ using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Linq;
-using System.Runtime.InteropServices;
using System.Security;
using System.Text.RegularExpressions;
using System.Threading;
@@ -14,7 +13,6 @@ using API.DTOs;
using API.Entities;
using API.Interfaces;
using API.Parser;
-using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace API.Services
@@ -135,7 +133,7 @@ namespace API.Services
private Series UpdateSeries(string seriesName, ParserInfo[] infos)
{
var series = _seriesRepository.GetSeriesByName(seriesName);
- ICollection<Volume> volumes = new List<Volume>();;
+ ICollection<Volume> volumes = new List<Volume>();
if (series == null)
{
@@ -150,7 +148,7 @@ namespace API.Services
// BUG: This is creating new volume entries and not resetting each run.
- IEnumerable<Volume> existingVolumes = _seriesRepository.GetVolumes(series.Id);
+ IList<Volume> existingVolumes = _seriesRepository.GetVolumes(series.Id).ToList();
foreach (var info in infos)
{
var existingVolume = existingVolumes.SingleOrDefault(v => v.Number == info.Volumes);
diff --git a/API/Services/TaskScheduler.cs b/API/Services/TaskScheduler.cs
index 31f029948..d5dcdcb5c 100644
--- a/API/Services/TaskScheduler.cs
+++ b/API/Services/TaskScheduler.cs
@@ -5,11 +5,11 @@ namespace API.Services
{
public class TaskScheduler : ITaskScheduler
{
- private BackgroundJobServer Client { get; }
+ private readonly BackgroundJobServer _client;
public TaskScheduler()
{
- Client = new BackgroundJobServer();
+ _client = new BackgroundJobServer();
}