Skip to content

Commit

Permalink
Fix sonarqube issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Galad committed Aug 9, 2020
1 parent 1592b71 commit 8a14967
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Update="Selenium.Support" Version="3.14.0" />
<PackageReference Update="Selenium.WebDriver" Version="3.14.0" />
<PackageReference Update="Selenium.WebDriver.ChromeDriver" Version="2.43.0" />
<PackageReference Update="SonarAnalyzer.CSharp" Version="7.14.0.8411" />
<PackageReference Update="SonarAnalyzer.CSharp" Version="8.10.0.19839" />
<PackageReference Update="SpecFlow.Tools.MsBuild.Generation" Version="3.0.213" />
<PackageReference Update="SpecFlow.xUnit" version="3.0.213" />
<PackageReference Update="System.ComponentModel.TypeConverter" Version="4.3.0" />
Expand Down
3 changes: 2 additions & 1 deletion SonarQube/SolutionBinding.sqconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"Name": "Lucas Loegel"
},
"ProjectKey": "Tranquire",
"ProjectName": "Tranquire",
"Profiles": {
"CSharp": {
"ProfileKey": "AWLo_hSnX0BbYiea--EJ",
"ProfileTimestamp": "2018-04-21T18:21:41+02:00"
"ProfileTimestamp": "2018-04-21T16:21:41Z"
}
}
}
35 changes: 28 additions & 7 deletions SonarQube/TranquireCSharp.ruleset
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="SonarQube - Tranquire Tranquire-csharp" Description="This rule set was automatically generated from SonarQube.&#xD;&#xA;https://sonarcloud.io/profiles/show?key=AWLo_hSnX0BbYiea--EJ" ToolsVersion="15.0">
<RuleSet Name="SonarQube - Tranquire Tranquire-csharp" Description="This rule set was automatically generated from SonarQube.&#xD;&#xA;https://sonarcloud.io/profiles/show?key=AWLo_hSnX0BbYiea--EJ" ToolsVersion="16.0">
<Rules AnalyzerId="SonarAnalyzer.CSharp" RuleNamespace="SonarAnalyzer.CSharp">
<Rule Id="S100" Action="None" />
<Rule Id="S1006" Action="Warning" />
Expand All @@ -26,6 +26,7 @@
<Rule Id="S1121" Action="Warning" />
<Rule Id="S1123" Action="Warning" />
<Rule Id="S1125" Action="Warning" />
<Rule Id="S1128" Action="None" />
<Rule Id="S113" Action="None" />
<Rule Id="S1134" Action="Warning" />
<Rule Id="S1135" Action="Warning" />
Expand All @@ -40,6 +41,7 @@
<Rule Id="S1185" Action="Warning" />
<Rule Id="S1186" Action="Warning" />
<Rule Id="S1192" Action="None" />
<Rule Id="S1199" Action="None" />
<Rule Id="S1200" Action="None" />
<Rule Id="S1206" Action="Warning" />
<Rule Id="S121" Action="None" />
Expand All @@ -64,7 +66,6 @@
<Rule Id="S1451" Action="None" />
<Rule Id="S1479" Action="Warning" />
<Rule Id="S1481" Action="Warning" />
<Rule Id="S1523" Action="None" />
<Rule Id="S1541" Action="None" />
<Rule Id="S1607" Action="Warning" />
<Rule Id="S1643" Action="Warning" />
Expand Down Expand Up @@ -110,6 +111,8 @@
<Rule Id="S2228" Action="None" />
<Rule Id="S2234" Action="Warning" />
<Rule Id="S2245" Action="None" />
<Rule Id="S2251" Action="None" />
<Rule Id="S2252" Action="None" />
<Rule Id="S2255" Action="None" />
<Rule Id="S2259" Action="Warning" />
<Rule Id="S2275" Action="Warning" />
Expand Down Expand Up @@ -140,6 +143,7 @@
<Rule Id="S2387" Action="None" />
<Rule Id="S2436" Action="None" />
<Rule Id="S2437" Action="Warning" />
<Rule Id="S2479" Action="None" />
<Rule Id="S2486" Action="Warning" />
<Rule Id="S2551" Action="None" />
<Rule Id="S2583" Action="Warning" />
Expand All @@ -153,10 +157,12 @@
<Rule Id="S2701" Action="None" />
<Rule Id="S2737" Action="Warning" />
<Rule Id="S2743" Action="Warning" />
<Rule Id="S2755" Action="None" />
<Rule Id="S2757" Action="Warning" />
<Rule Id="S2758" Action="Warning" />
<Rule Id="S2760" Action="None" />
<Rule Id="S2761" Action="Warning" />
<Rule Id="S2857" Action="None" />
<Rule Id="S2930" Action="Warning" />
<Rule Id="S2931" Action="None" />
<Rule Id="S2933" Action="Warning" />
Expand Down Expand Up @@ -272,6 +278,7 @@
<Rule Id="S3927" Action="Warning" />
<Rule Id="S3928" Action="Warning" />
<Rule Id="S3937" Action="None" />
<Rule Id="S3949" Action="None" />
<Rule Id="S3956" Action="None" />
<Rule Id="S3962" Action="None" />
<Rule Id="S3963" Action="None" />
Expand Down Expand Up @@ -321,12 +328,14 @@
<Rule Id="S4061" Action="None" />
<Rule Id="S4069" Action="None" />
<Rule Id="S4070" Action="None" />
<Rule Id="S4136" Action="None" />
<Rule Id="S4142" Action="None" />
<Rule Id="S4143" Action="None" />
<Rule Id="S4144" Action="Warning" />
<Rule Id="S4158" Action="Warning" />
<Rule Id="S4159" Action="Warning" />
<Rule Id="S4200" Action="Warning" />
<Rule Id="S4201" Action="None" />
<Rule Id="S4210" Action="Warning" />
<Rule Id="S4211" Action="None" />
<Rule Id="S4212" Action="None" />
Expand All @@ -345,24 +354,30 @@
<Rule Id="S4456" Action="None" />
<Rule Id="S4457" Action="None" />
<Rule Id="S4462" Action="None" />
<Rule Id="S4487" Action="None" />
<Rule Id="S4507" Action="None" />
<Rule Id="S4524" Action="None" />
<Rule Id="S4529" Action="None" />
<Rule Id="S4564" Action="None" />
<Rule Id="S4581" Action="None" />
<Rule Id="S4583" Action="None" />
<Rule Id="S4586" Action="None" />
<Rule Id="S4721" Action="None" />
<Rule Id="S4635" Action="None" />
<Rule Id="S4784" Action="None" />
<Rule Id="S4787" Action="None" />
<Rule Id="S4790" Action="None" />
<Rule Id="S4792" Action="None" />
<Rule Id="S4797" Action="None" />
<Rule Id="S4817" Action="None" />
<Rule Id="S4818" Action="None" />
<Rule Id="S4823" Action="None" />
<Rule Id="S4825" Action="None" />
<Rule Id="S4829" Action="None" />
<Rule Id="S4830" Action="None" />
<Rule Id="S4834" Action="None" />
<Rule Id="S5034" Action="None" />
<Rule Id="S5042" Action="None" />
<Rule Id="S5542" Action="None" />
<Rule Id="S5547" Action="None" />
<Rule Id="S5659" Action="None" />
<Rule Id="S5766" Action="None" />
<Rule Id="S5773" Action="None" />
<Rule Id="S818" Action="Warning" />
<Rule Id="S881" Action="None" />
<Rule Id="S907" Action="Warning" />
Expand All @@ -375,5 +390,11 @@
<Rule Id="S2091" Action="None" />
<Rule Id="S2631" Action="None" />
<Rule Id="S3649" Action="Warning" />
<Rule Id="S5131" Action="None" />
<Rule Id="S5135" Action="None" />
<Rule Id="S5144" Action="None" />
<Rule Id="S5145" Action="None" />
<Rule Id="S5146" Action="None" />
<Rule Id="S5167" Action="None" />
</Rules>
</RuleSet>
14 changes: 5 additions & 9 deletions src/Tranquire.Selenium/ActorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,11 @@ public static Actor TakeScreenshots(

var id = 0;

string screenshotFormat;
if (string.Format(screenshotNameOrFormat, 1) == screenshotNameOrFormat)
{
screenshotFormat = screenshotNameOrFormat + "_" + "{0:00}";
}
else
{
screenshotFormat = screenshotNameOrFormat;
}
#pragma warning disable S1854 // Unused assignments should be removed. False positive
var screenshotFormat = string.Format(screenshotNameOrFormat, 1) == screenshotNameOrFormat
#pragma warning restore S1854 // Unused assignments should be removed
? screenshotNameOrFormat + "_" + "{0:00}"
: screenshotNameOrFormat;

string nextScreenshotName()
{
Expand Down
9 changes: 8 additions & 1 deletion src/Tranquire.Selenium/Questions/UIModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,14 @@ private static Func<IActor, ITarget, CultureInfo, object> RetrieveValue(Property
private static readonly IntegerArrayConverters _integerArrayConverters = new IntegerArrayConverters();
private static readonly DoubleArrayConverters _doubleArrayConverters = new DoubleArrayConverters();

private static Func<IActor, ITarget, CultureInfo, object> ApplyGetConverter(ITarget target, Type type, UIStateAttribute uiStateAttribute)
private static Func<IActor, ITarget, CultureInfo, object> ApplyGetConverter(
#pragma warning disable S1172 // Unused method parameters should be removed. False positive
ITarget target,
#pragma warning restore S1172 // Unused method parameters should be removed
Type type,
#pragma warning disable S1172 // Unused method parameters should be removed. False positive
UIStateAttribute uiStateAttribute)
#pragma warning restore S1172 // Unused method parameters should be removed
{
if (type == typeof(int))
{
Expand Down
6 changes: 5 additions & 1 deletion src/Tranquire/ActionTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ public TTag FindBestGivenTag(IEnumerable<TTag> tags)
return GetBestTag(GivenTags, tags);
}

private TTag GetBestTag(ImmutableDictionary<TTag, int> orderedTags, IEnumerable<TTag> tags)
private TTag GetBestTag(
#pragma warning disable S1172 // Unused method parameters should be removed. False positive
ImmutableDictionary<TTag, int> orderedTags,
#pragma warning restore S1172 // Unused method parameters should be removed
IEnumerable<TTag> tags)
{
if (tags == null)
{
Expand Down

0 comments on commit 8a14967

Please sign in to comment.