Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.

Commit be16c34

Browse files
author
Jérémie Bertrand
committed
🚨 remove sonarlint warnings
1 parent e47e32e commit be16c34

28 files changed

Lines changed: 53 additions & 69 deletions

src/Pretzel.Logic/Commands/CommandParameters.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public decimal Port
7878

7979
private OptionSet Settings { get; set; }
8080

81-
private IFileSystem fileSystem;
81+
private readonly IFileSystem fileSystem;
8282

8383
public void Parse(IEnumerable<string> arguments)
8484
{

src/Pretzel.Logic/Extensibility/Extensions/PostUrlTag.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Pretzel.Logic.Extensibility.Extensions
1010
public class PostUrlTag : DotLiquid.Tag, ITag
1111
{
1212
private string _postFileName;
13-
private SiteContext _siteContext;
13+
private readonly SiteContext _siteContext;
1414

1515
public new string Name { get { return "PostUrl"; } }
1616

src/Pretzel.Logic/Extensibility/Extensions/SlugifyFilter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Text.RegularExpressions;
1+
using System.Globalization;
2+
using System.Text.RegularExpressions;
23

34
namespace Pretzel.Logic.Extensibility.Extensions
45
{
@@ -11,7 +12,7 @@ public string Name
1112

1213
public static string Slugify(string input)
1314
{
14-
var str = input.ToLower().Trim('.', ' ');
15+
var str = input.ToLower(CultureInfo.InvariantCulture).Trim('.', ' ');
1516

1617
str = str.Replace("#", "sharp").Replace('.', '-');
1718
// invalid chars, make into spaces

src/Pretzel.Logic/Extensibility/TagFactoryBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Pretzel.Logic.Extensibility
77
[InheritedExport]
88
public abstract class TagFactoryBase : DotLiquid.ITagFactory
99
{
10-
private string _tageName;
10+
private readonly string _tageName;
1111

1212
protected SiteContext SiteContext { get; private set; }
1313

src/Pretzel.Logic/Extensions/StringExtensions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.IO;
43
using System.IO.Abstractions;
54
using System.Linq;
65

@@ -532,7 +531,7 @@ public static string MimeType(this string filename)
532531
{
533532
if (!filename.Contains("."))
534533
return "text/html";
535-
string extension = filename.Substring(filename.LastIndexOf("."));
534+
string extension = filename.Substring(filename.LastIndexOf(".", StringComparison.InvariantCulture));
536535
return Get(extension, types["bin"]);
537536
}
538537

src/Pretzel.Logic/Import/BloggerImport.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ public void Import()
4646
// <entry>
4747

4848
XNamespace atom = "http://www.w3.org/2005/Atom";
49-
var count = root.Descendants(atom + "entry").Count();
5049

5150
var posts = from e in root.Descendants(atom + "entry")
52-
where e.Elements(atom + "category").Where(x => x.Attribute("term").Value == "http://schemas.google.com/blogger/2008/kind#post").Count() > 0
51+
where e.Elements(atom + "category").Any(x => x.Attribute("term").Value == "http://schemas.google.com/blogger/2008/kind#post")
5352
select new BloggerPost
5453
{
5554
Title = e.Element(atom + "title").Value,

src/Pretzel.Logic/Import/HtmlToMarkdownConverter.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ private void ProcessNodes(StringBuilder markdown, IEnumerable<HtmlNode> htmlNode
108108
break;
109109
case "img":
110110
case "blockquote":
111-
// leave html unchanged for now, maybe revisit later
112-
markdown.Append(htmlNode.OuterHtml);
113-
break;
114111
case "object":
115112
case "table":
116113
case "div":

src/Pretzel.Logic/Liquid/CgiEscapeFilter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System;
1+
using System;
22

33
namespace Pretzel.Logic.Liquid
44
{
5-
public class CgiEscapeFilter
5+
public static class CgiEscapeFilter
66
{
77
public static string cgi_escape(string input)
88
{

src/Pretzel.Logic/Liquid/DateToLongStringFilter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
namespace Pretzel.Logic.Liquid
55
{
6-
public class DateToLongStringFilter
6+
public static class DateToLongStringFilter
77
{
88
public static string date_to_long_string(DateTime input)
99
{
10-
//return input.ToString("dd MMMM yyyy");
1110
return XmlConvert.ToString(input, "dd MMMM yyyy");
1211
}
1312

@@ -20,7 +19,7 @@ public static string date_to_long_string(string input)
2019
return date_to_long_string(inputDate);
2120
}
2221

23-
return "";
22+
return string.Empty;
2423
}
2524
}
2625
}

src/Pretzel.Logic/Liquid/DateToRfc822FormatFilter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Pretzel.Logic.Liquid
44
{
5-
public class DateToRfc822FormatFilter
5+
public static class DateToRfc822FormatFilter
66
{
77
public static string date_to_rfc822(DateTime input)
88
{

0 commit comments

Comments
 (0)