Fix code smells
continuous-integration/drone/push Build is passing Details

pull/39/head
Corentin LEMAIRE 2 years ago
parent 8057ef4a0b
commit f742ff4494

@ -428,12 +428,9 @@ namespace Model.Stub
foreach(Playlist p in DataManager.GetPlaylists())
{
List<CustomTitle> ToDelete = new();
foreach (CustomTitle ct in p.Titles)
foreach (CustomTitle ct in p.Titles.Where(ct => ct.Equals(title)))
{
if (ct.Equals(title))
{
ToDelete.Add(ct);
}
ToDelete.Add(ct);
}
foreach(CustomTitle ct in ToDelete)
{

@ -314,9 +314,9 @@ namespace Model
/// <returns>Booléen True si le CustomTitle est contenu dans la Playlist, False sinon</returns>
public bool HasCustomTitle(CustomTitle customTitle)
{
foreach (CustomTitle custom in Titles)
foreach (CustomTitle custom in Titles.Where(ct => ct.Equals(customTitle)))
{
if (custom.Equals(customTitle)) return true;
return true;
}
return false;
}

@ -479,12 +479,9 @@ namespace Model.Serialization
/// <returns>Retourne l'objet InfoTitle avec un nom équivalent à celui donné en paramètre</returns>
public InfoTitle GetInfoTitleByName(string name)
{
foreach (InfoTitle it in infoTitles)
foreach (InfoTitle it in infoTitles.Where(it => it.Name.Equals(name)))
{
if (it.Name.Equals(name))
{
return it;
}
return it;
}
return null;
}
@ -496,12 +493,9 @@ namespace Model.Serialization
/// <returns>Retourne l'objet Artist avec un nom équivalent à celui donné en paramètre</returns>
public Artist GetArtistByName(string name)
{
foreach (Artist a in artists)
foreach (Artist a in artists.Where(artist => artist.Name.Equals(name)))
{
if (a.Name.Equals(name))
{
return a;
}
return a;
}
return null;
}
@ -513,12 +507,9 @@ namespace Model.Serialization
/// <returns>Retourne l'objet Album avec un nom équivalent à celui donné en paramètre</returns>
public Album GetAlbumByName(string name)
{
foreach (Album a in albums)
foreach (Album a in albums.Where(a => a.Name.Equals(name)))
{
if (a.Name.Equals(name))
{
return a;
}
return a;
}
return null;
}
@ -530,9 +521,9 @@ namespace Model.Serialization
/// <returns>Retourne l'objet Album avec un ID équivalent à celui donné en paramètre</returns>
public Album GetAlbumById(long id)
{
foreach (Album a in albums)
foreach (Album a in albums.Where(a => a.ID == id))
{
if (a.ID == id) return a;
return a;
}
return null;
}
@ -544,12 +535,9 @@ namespace Model.Serialization
/// <returns>Retourne l'objet CustomTitle avec un chemin d'accès équivalent à celui donné en paramètre</returns>
public CustomTitle GetCustomTitleByPath(string custom)
{
foreach (CustomTitle customTitle in customTitles)
foreach (CustomTitle customTitle in customTitles.Where(customTitle => customTitle.Path.Equals(custom)))
{
if (customTitle.Path.Equals(custom))
{
return customTitle;
}
return customTitle;
}
return null;
}
@ -621,12 +609,9 @@ namespace Model.Serialization
/// <returns>Retourne l'objet Playlist avec un nom équivalent à celui donné en paramètre</returns>
public Playlist GetPlaylistByName(string name)
{
foreach (Playlist p in playlists)
foreach (Playlist p in playlists.Where(p => p.Name.Equals(name)))
{
if (p.Name.Equals(name))
{
return p;
}
return p;
}
return null;
}
@ -916,12 +901,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsPlaylist(Playlist playlist)
{
foreach (Playlist p in playlists)
foreach (Playlist p in playlists.Where(p => p.Equals(playlist)))
{
if (p.Equals(playlist))
{
return true;
}
return true;
}
return false;
}
@ -933,12 +915,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsPlaylistByName(string name)
{
foreach (Playlist p in playlists)
foreach (Playlist p in playlists.Where(p => p.Name.Equals(name)))
{
if (p.Name.Equals(name))
{
return true;
}
return true;
}
return false;
}
@ -950,12 +929,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsAlbum(Album album)
{
foreach (Album a in albums)
foreach (Album a in albums.Where(a => a.Equals(album)))
{
if (a.Equals(album))
{
return true;
}
return true;
}
return false;
}
@ -967,12 +943,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsAlbumByName(string name)
{
foreach (Album a in albums)
foreach (Album a in albums.Where(a => a.Name.Equals(name)))
{
if (a.Name.Equals(name))
{
return true;
}
return true;
}
return false;
}
@ -984,12 +957,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsArtist(Artist artist)
{
foreach (Artist a in artists)
foreach (Artist a in artists.Where(a => a.Equals(artist)))
{
if (a.Equals(artist))
{
return true;
}
return true;
}
return false;
}
@ -1001,12 +971,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsArtistByName(string name)
{
foreach (Artist a in artists)
foreach (Artist a in artists.Where(a => a.Name.Equals(name)))
{
if (a.Name.Equals(name))
{
return true;
}
return true;
}
return false;
}
@ -1018,12 +985,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsCustomTitle(CustomTitle title)
{
foreach (CustomTitle ct in customTitles)
foreach (CustomTitle ct in customTitles.Where(ct => title.Equals(ct)))
{
if (title.Equals(ct))
{
return true;
}
return true;
}
return false;
}
@ -1035,12 +999,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsCustomTitleByName(string name)
{
foreach (CustomTitle ct in customTitles)
foreach (CustomTitle ct in customTitles.Where(ct => ct.Name.Equals(name)))
{
if (ct.Name.Equals(name))
{
return true;
}
return true;
}
return false;
}
@ -1052,12 +1013,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsInfoTitle(InfoTitle title)
{
foreach (InfoTitle it in infoTitles)
foreach (InfoTitle it in infoTitles.Where(it => it.Equals(title)))
{
if (it.Equals(title))
{
return true;
}
return true;
}
return false;
}
@ -1069,12 +1027,9 @@ namespace Model.Serialization
/// <returns>Booléen True s'il est contenu dans l'application, False sinon</returns>
public bool ExistsInfoTitleByName(string name)
{
foreach (InfoTitle it in infoTitles)
foreach (InfoTitle it in infoTitles.Where(it => it.Name.Equals(name)))
{
if (it.Name.Equals(name))
{
return true;
}
return true;
}
return false;
}

Loading…
Cancel
Save