Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set SA1214 to "Error" and resolved errors. #1843

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Rule Id="SA1720" Action="None" /> <!-- Error SA1720: Name contains type-->
<Rule Id="SA1300" Action="None" /> <!-- Error SA1300: Element 'iFrame' should begin with an uppercase letter (SA1300)-->
<Rule Id="SA1500" Action="None" /> <!-- Error SA1500: Braces for multi-line statements should not share line (SA1500)-->
<Rule Id="SA1214" Action="None" /> <!-- Error SA1214: Readonly fields should appear before non-readonly fields (SA1214)-->
<Rule Id="SA1214" Action="Error" /> <!-- Error SA1214: Readonly fields should appear before non-readonly fields (SA1214)-->
<Rule Id="SA1642" Action="None" /> <!-- Error SA1642: Constructor summary documentation should begin with standard text (SA1642) (PuppeteerSharp)-->
<Rule Id="SA1013" Action="None" /> <!-- Error SA1013: Closing brace should be preceded by a space. (SA1013) -->
<Rule Id="SA1515" Action="None" /> <!-- Error SA1515: Single-line comment should be preceded by blank line (SA1515) -->
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ internal Connection(string url, int delay, bool enqueueAsyncMessages, IConnectio
}

#region Private Members
private int _lastId;
private readonly ConcurrentDictionary<int, MessageTask> _callbacks;
private readonly ConcurrentDictionary<string, CDPSession> _sessions;
private readonly AsyncDictionaryHelper<string, CDPSession> _asyncSessions;
private int _lastId;
#endregion

#region Properties
Expand Down
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp/FrameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace PuppeteerSharp
internal class FrameManager
{
private readonly ConcurrentDictionary<int, ExecutionContext> _contextIdToContext;
private bool _ensureNewDocumentNavigation;
private readonly ILogger _logger;
private readonly ConcurrentDictionary<string, Frame> _frames;
private const string RefererHeaderName = "referer";
private readonly AsyncDictionaryHelper<string, Frame> _asyncFrames;
private readonly List<string> _isolatedWorlds = new List<string>();
private bool _ensureNewDocumentNavigation;
private const string RefererHeaderName = "referer";
private const string UtilityWorldName = "__puppeteer_utility_world__";

private FrameManager(CDPSession client, Page page, bool ignoreHTTPSErrors, TimeoutSettings timeoutSettings)
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/Helpers/AsyncMessageQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace PuppeteerSharp.Helpers
/// </summary>
internal class AsyncMessageQueue : IDisposable
{
private bool _disposed;
private readonly List<MessageTask> _pendingTasks;
private readonly bool _enqueueAsyncMessages;
private readonly ILogger _logger;
private bool _disposed;

public AsyncMessageQueue(bool enqueueAsyncMessages, ILogger logger = null)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/PuppeteerSharp/LifecycleWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ internal class LifecycleWatcher : IDisposable
private readonly IEnumerable<string> _expectedLifecycle;
private readonly int _timeout;
private readonly string _initialLoaderId;
private Request _navigationRequest;
private bool _hasSameDocumentNavigation;
private readonly TaskCompletionSource<bool> _newDocumentNavigationTaskWrapper;
private readonly TaskCompletionSource<bool> _sameDocumentNavigationTaskWrapper;
private readonly TaskCompletionSource<bool> _lifecycleTaskWrapper;
private readonly TaskCompletionSource<bool> _terminationTaskWrapper;
[SuppressMessage("Microsoft.Usage", "CA2213:DisposableFieldsShouldBeDisposed", Justification = "False positive, as it is disposed.")]
private readonly CancellationTokenSource _terminationCancellationToken;
private Request _navigationRequest;
private bool _hasSameDocumentNavigation;

public LifecycleWatcher(
FrameManager frameManager,
Expand Down
11 changes: 6 additions & 5 deletions lib/PuppeteerSharp/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,21 @@ internal class NetworkManager
new ConcurrentDictionary<string, FetchRequestPausedResponse>();

private readonly ILogger _logger;
private Dictionary<string, string> _extraHTTPHeaders;
private Credentials _credentials;
private readonly ConcurrentSet<string> _attemptedAuthentications = new ConcurrentSet<string>();
private bool _userRequestInterceptionEnabled;
private bool _protocolRequestInterceptionEnabled;
private readonly bool _ignoreHTTPSErrors;
private bool _userCacheDisabled;
private readonly InternalNetworkConditions _emulatedNetworkConditions = new InternalNetworkConditions
{
Offline = false,
Upload = -1,
Download = -1,
Latency = 0,
};

private Dictionary<string, string> _extraHTTPHeaders;
private Credentials _credentials;
private bool _userRequestInterceptionEnabled;
private bool _protocolRequestInterceptionEnabled;
private bool _userCacheDisabled;
#endregion

internal NetworkManager(CDPSession client, bool ignoreHTTPSErrors, FrameManager frameManager)
Expand Down
6 changes: 3 additions & 3 deletions lib/PuppeteerSharp/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public class Page : IDisposable, IAsyncDisposable
private readonly Dictionary<string, Delegate> _pageBindings;
private readonly IDictionary<string, Worker> _workers;
private readonly ILogger _logger;
private readonly TaskCompletionSource<bool> _closeCompletedTcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
private readonly TimeoutSettings _timeoutSettings;
private readonly ConcurrentDictionary<Guid, TaskCompletionSource<FileChooser>> _fileChooserInterceptors;
private PageGetLayoutMetricsResponse _burstModeMetrics;
private bool _screenshotBurstModeOn;
private ScreenshotOptions _screenshotBurstModeOptions;
private readonly TaskCompletionSource<bool> _closeCompletedTcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
private TaskCompletionSource<bool> _sessionClosedTcs;
private readonly TimeoutSettings _timeoutSettings;
private readonly ConcurrentDictionary<Guid, TaskCompletionSource<FileChooser>> _fileChooserInterceptors;

private static readonly Dictionary<string, decimal> _unitToPixels = new Dictionary<string, decimal> {
{"px", 1},
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/PageAccessibility/AXNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ internal class AXNode
public bool Focusable { get; set; }

private readonly string _name;
private string _role;
private readonly bool _richlyEditable;
private readonly bool _editable;
private readonly bool _expanded;
private readonly bool _hidden;
private string _role;
private bool? _cachedHasFocusableChild;

public AXNode(AccessibilityGetFullAXTreeResponse.AXTreeNode payload)
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/Worker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public class Worker
{
private readonly ILogger _logger;
private readonly CDPSession _client;
private ExecutionContext _executionContext;
private readonly Func<ConsoleType, JSHandle[], StackTrace, Task> _consoleAPICalled;
private readonly Action<EvaluateExceptionResponseDetails> _exceptionThrown;
private readonly TaskCompletionSource<ExecutionContext> _executionContextCallback;
private ExecutionContext _executionContext;
private Func<ExecutionContext, RemoteObject, JSHandle> _jsHandleFactory;

internal Worker(
Expand Down