Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Changed rulesets to reduce warning noise (#1486)
Browse files Browse the repository at this point in the history
  • Loading branch information
pictos authored Jul 8, 2021
1 parent 0ddb607 commit 02884f5
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 23 deletions.
8 changes: 4 additions & 4 deletions Xamarin.CommunityToolkit.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA0001" Action="None" />
<Rule Id="SA0002" Action="Warning" />
<Rule Id="SA1000" Action="Warning" />
<Rule Id="SA1000" Action="None" />
<Rule Id="SA1001" Action="Warning" />
<Rule Id="SA1002" Action="Warning" />
<Rule Id="SA1003" Action="Warning" />
Expand All @@ -13,8 +13,9 @@
<Rule Id="SA1006" Action="Warning" />
<Rule Id="SA1007" Action="Warning" />
<Rule Id="SA1008" Action="Warning" />
<Rule Id="SA1009" Action="Warning" />
<Rule Id="SA1009" Action="None" />
<Rule Id="SA1010" Action="Warning" />
<Rule Id="SA1011" Action="None" />
<Rule Id="SA1012" Action="Warning" />
<Rule Id="SA1013" Action="Warning" />
<Rule Id="SA1014" Action="Warning" />
Expand Down Expand Up @@ -55,7 +56,7 @@
<Rule Id="SA1120" Action="Warning" />
<Rule Id="SA1121" Action="Warning" />
<Rule Id="SA1122" Action="Warning" />
<Rule Id="SA1123" Action="Warning" />
<Rule Id="SA1123" Action="None" />
<Rule Id="SA1124" Action="None" />
<Rule Id="SA1125" Action="Warning" />
<Rule Id="SA1126" Action="Warning" />
Expand Down Expand Up @@ -115,7 +116,6 @@
<Rule Id="SA1409" Action="Warning" />
<Rule Id="SA1410" Action="Warning" />
<Rule Id="SA1411" Action="Warning" />
<Rule Id="SA1412" Action="Warning" />
<Rule Id="SA1413" Action="None" />
<Rule Id="SA1500" Action="Warning" />
<Rule Id="SA1501" Action="Warning" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using Xamarin.CommunityToolkit.UI.Views;
using Xamarin.Forms;

#pragma warning disable CS0618 // Type or member is obsolete
[assembly: LinkerSafe]
#pragma warning restore CS0618 // Type or member is obsolete

#if XAMARIN_IOS || XAMARIN_MAC
[assembly: ExportImageSourceHandler(typeof(GravatarImageSource), typeof(GravatarImageSourceHandler))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public static class SemanticEffect

public static void SetHeadingLevel(BindableObject view, HeadingLevel value) => view.SetValue(HeadingLevelProperty, value);


public static readonly BindableProperty DescriptionProperty = BindableProperty.CreateAttached("Description", typeof(string), typeof(SemanticEffect), default(string), propertyChanged: OnPropertyChanged);

public static string GetDescription(BindableObject bindable) => (string)bindable.GetValue(DescriptionProperty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ protected override void OnAttached()
}
}


protected virtual void Update(global::Android.Views.View view, T effect)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ protected override void OnAttached()
pointerDownStoryboard = new Storyboard();
var downThemeAnimation = new PointerDownThemeAnimation();


Storyboard.SetTargetName(downThemeAnimation, nativeControl.Name);

pointerDownStoryboard.Children.Add(downThemeAnimation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Xamarin.CommunityToolkit.Extensions
/// </summary>
public static partial class VisualElementExtensions
{

/// <summary>
/// <see cref="VisualElement"/> cleanup object to dispose and
/// destroy resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
using System.Linq;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Camera = Android.Hardware.Camera;
using Math = System.Math;
using Rect = Android.Graphics.Rect;
using APoint = Android.Graphics.Point;

Expand Down Expand Up @@ -541,8 +539,6 @@ public async Task StopRecord()
{
LogError("Error restarting video recording", ex);
}


}

async Task PrepareSession()
Expand Down Expand Up @@ -783,7 +779,6 @@ public void ApplyZoom()
};
}

#region TextureView.ISurfaceTextureListener
async void TextureView.ISurfaceTextureListener.OnSurfaceTextureAvailable(SurfaceTexture? surface, int width, int height)
{
UpdateBackgroundColor();
Expand All @@ -803,9 +798,7 @@ bool TextureView.ISurfaceTextureListener.OnSurfaceTextureDestroyed(SurfaceTextur
void TextureView.ISurfaceTextureListener.OnSurfaceTextureUpdated(SurfaceTexture? surface)
{
}
#endregion

#region Permissions
async Task RequestCameraPermissions()
{
if (permissionsRequested != null)
Expand Down Expand Up @@ -856,9 +849,7 @@ public override void OnRequestPermissionsResult(int requestCode, string[] permis
}
permissionsRequested?.TrySetResult(true);
}
#endregion

#region Helpers
void LogError(string desc, Java.Lang.Exception? ex = null)
{
var newLine = System.Environment.NewLine;
Expand Down Expand Up @@ -1069,6 +1060,5 @@ ASize ChooseOptimalSize(ASize[] choices, int width, int height, int maxWidth, in
LogError("Couldn't find any suitable preview size");
return choices[0];
}
#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected override void OnElementChanged(ElementChangedEventArgs<ToolKitMediaEle

Control.Stretch = Element.Aspect.ToStretch();


Element.SeekRequested += SeekRequested;
Element.StateRequested += StateRequested;
Element.PositionRequested += PositionRequested;
Expand All @@ -73,6 +72,7 @@ void PositionRequested(object? sender, EventArgs e)
}

MediaElementState requestedState;

IMediaElementController Controller => Element as IMediaElementController;

void StateRequested(object? sender, StateRequested e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ void SetEvents()
Opened += OnOpened;
}



void SetSize()
{
_ = Element ?? throw new InvalidOperationException($"{nameof(Element)} cannot be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ protected override void OnPropertyChanged([CallerMemberName] string propertyName

void UpdateSubjectColor() => ShieldSubjectContainer.BackgroundColor = SubjectBackgroundColor;

#pragma warning disable CS0618 // Type or member is obsolete
void UpdateColor() => ShieldStatusContainer.BackgroundColor = Color;
#pragma warning restore CS0618 // Type or member is obsolete

void UpdateStatusBackgroundColor() => ShieldStatusContainer.BackgroundColor = StatusBackgroundColor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Xamarin.CommunityToolkit.UI.Views.Helpers.iOS;
using UIKit;
#elif __MACOS__
using CoreGraphics;
using Xamarin.CommunityToolkit.UI.Views.Helpers.macOS;
using Xamarin.CommunityToolkit.UI.Views.Helpers.macOS.Extensions;
using AppKit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<Configurations>Debug;Release</Configurations>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<DebugType>portable</DebugType>
<NoWarn>SA1123</NoWarn>
<NoWarn>NU1701</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
<!-- Manage TargetFrameworks for development (Debug Mode) -->
Expand Down

0 comments on commit 02884f5

Please sign in to comment.