Skip to content

Commit 94751b5

Browse files
committed
cleaned up ReSharper code issues
1 parent d29327e commit 94751b5

12 files changed

+33
-46
lines changed

erl.Oracle.TnsNames/ANTLR/DatabaseAddressNode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace erl.Oracle.TnsNames.ANTLR
77
/// <summary>
88
/// Used for internal representation during parse of TNS names file
99
/// </summary>
10-
[DebuggerDisplay("{DebuggerDisplay,nq}")]
10+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1111
public sealed class DatabaseAddressNode
1212
{
1313
public DatabaseAddressNode(TnsNamesParser.ParameterContext parameterContext)

erl.Oracle.TnsNames/ANTLR/TnsNameNode.cs

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@ namespace erl.Oracle.TnsNames.ANTLR
99
/// <summary>
1010
/// Used for internal representation during parse of TNS names file
1111
/// </summary>
12-
[DebuggerDisplay("{DebuggerDisplay,nq}")]
12+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1313
public sealed class TnsNameNode
1414
{
1515
internal TnsNameNode([NotNull] string tnsName, [NotNull] TnsNamesParser.ParameterContext parameterContext)
1616
{
17-
if (tnsName == null) throw new ArgumentNullException(nameof(tnsName));
18-
if (parameterContext == null) throw new ArgumentNullException(nameof(parameterContext));
19-
20-
TnsName = tnsName;
21-
ParameterContext = parameterContext;
17+
TnsName = tnsName ?? throw new ArgumentNullException(nameof(tnsName));
18+
ParameterContext = parameterContext ?? throw new ArgumentNullException(nameof(parameterContext));
2219
}
2320

2421
public TnsNamesParser.ParameterContext ParameterContext { get; }

erl.Oracle.TnsNames/ANTLR/TnsNamesListenerErrorNode.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
using JetBrains.Annotations;
2+
13
#pragma warning disable 1591 // Missing comments
24

35
namespace erl.Oracle.TnsNames.ANTLR
46
{
7+
[PublicAPI]
58
public class TnsNamesListenerErrorNode
69
{
710
public TnsNamesListenerErrorNode(TnsNamesParser.ParameterContext parameterContext, TnsNamesParseError parseError)

erl.Oracle.TnsNames/Helper/JunctionPoint.cs

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
// ReSharper disable UnusedMember.Local
88
// ReSharper disable FieldCanBeMadeReadOnly.Local
99
// ReSharper disable InconsistentNaming
10+
// ReSharper disable MemberCanBePrivate.Local
11+
// ReSharper disable UnusedMember.Global
1012

1113
// Fetched from: http://www.codeproject.com/Articles/15633/Manipulating-NTFS-Junction-Points-in-NET
1214

erl.Oracle.TnsNames/IpDatabaseAddress.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace erl.Oracle.TnsNames
77
/// <summary>
88
/// Database address for a TNS name.
99
/// </summary>
10-
[DebuggerDisplay("{DebuggerDisplay,nq}")]
10+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1111
[PublicAPI]
1212
public sealed class IpDatabaseAddress : IDatabaseAddress
1313
{
@@ -20,14 +20,11 @@ public sealed class IpDatabaseAddress : IDatabaseAddress
2020
/// <param name="rawAddress"></param>
2121
public IpDatabaseAddress([NotNull] string protocol, [NotNull] string host, int port, [NotNull] string rawAddress)
2222
{
23-
if (protocol == null) throw new ArgumentNullException(nameof(protocol));
24-
if (host == null) throw new ArgumentNullException(nameof(host));
2523
if (port < 1 || port > 65535) throw new ArgumentOutOfRangeException(nameof(port), port, "Port should be in range 1-65535.");
26-
if (rawAddress == null) throw new ArgumentNullException(nameof(rawAddress));
27-
Protocol = protocol;
28-
Host = host;
24+
Protocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
25+
Host = host ?? throw new ArgumentNullException(nameof(host));
2926
Port = port;
30-
RawAddress = rawAddress;
27+
RawAddress = rawAddress ?? throw new ArgumentNullException(nameof(rawAddress));
3128
}
3229

3330
/// <inheritdoc />

erl.Oracle.TnsNames/IpcDatabaseAddress.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace erl.Oracle.TnsNames
77
/// <summary>
88
///
99
/// </summary>
10-
[DebuggerDisplay("{DebuggerDisplay,nq}")]
10+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1111
[PublicAPI]
1212
public sealed class IpcDatabaseAddress : IDatabaseAddress
1313
{
@@ -19,12 +19,9 @@ public sealed class IpcDatabaseAddress : IDatabaseAddress
1919
/// <param name="rawAddress"></param>
2020
public IpcDatabaseAddress([NotNull] string protocol, [NotNull] string key, [NotNull] string rawAddress)
2121
{
22-
if (protocol == null) throw new ArgumentNullException(nameof(protocol));
23-
if (key == null) throw new ArgumentNullException(nameof(key));
24-
if (rawAddress == null) throw new ArgumentNullException(nameof(rawAddress));
25-
Protocol = protocol;
26-
Key = key;
27-
RawAddress = rawAddress;
22+
Protocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
23+
Key = key ?? throw new ArgumentNullException(nameof(key));
24+
RawAddress = rawAddress ?? throw new ArgumentNullException(nameof(rawAddress));
2825
}
2926

3027
/// <inheritdoc />

erl.Oracle.TnsNames/JetBrains.Annotations.cs

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2929
// ReSharper disable IntroduceOptionalParameters.Global
3030
// ReSharper disable MemberCanBeProtected.Global
3131
// ReSharper disable InconsistentNaming
32+
// ReSharper disable once CheckNamespace
33+
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Local
3234

3335
namespace JetBrains.Annotations
3436
{

erl.Oracle.TnsNames/NamedPipeDatabaseAddress.cs

+5-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace erl.Oracle.TnsNames
88
/// <summary>
99
///
1010
/// </summary>
11-
[DebuggerDisplay("{DebuggerDisplay,nq}")]
11+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1212
[PublicAPI]
1313
public sealed class NamedPipeDatabaseAddress : IDatabaseAddress
1414
{
@@ -21,15 +21,10 @@ public sealed class NamedPipeDatabaseAddress : IDatabaseAddress
2121
/// <param name="rawAddress"></param>
2222
public NamedPipeDatabaseAddress([NotNull] string protocol, [NotNull] string server, [NotNull] string pipe, [NotNull] string rawAddress)
2323
{
24-
if (protocol == null) throw new ArgumentNullException(nameof(protocol));
25-
if (server == null) throw new ArgumentNullException(nameof(server));
26-
if (pipe == null) throw new ArgumentNullException(nameof(pipe));
27-
if (rawAddress == null) throw new ArgumentNullException(nameof(rawAddress));
28-
29-
Protocol = protocol;
30-
Server = server;
31-
Pipe = pipe;
32-
RawAddress = rawAddress;
24+
Protocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
25+
Server = server ?? throw new ArgumentNullException(nameof(server));
26+
Pipe = pipe ?? throw new ArgumentNullException(nameof(pipe));
27+
RawAddress = rawAddress ?? throw new ArgumentNullException(nameof(rawAddress));
3328
}
3429

3530
/// <inheritdoc />

erl.Oracle.TnsNames/TnsNameInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace erl.Oracle.TnsNames
66
/// <summary>
77
/// Info about a TNS name.
88
/// </summary>
9-
[DebuggerDisplay("{DebuggerDisplay,nq}")]
9+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1010
[PublicAPI]
1111
public sealed class TnsNameInfo
1212
{

erl.Oracle.TnsNames/TnsNamesFile.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace erl.Oracle.TnsNames
77
/// <summary>
88
/// Content of a TNS names file.
99
/// </summary>
10-
[DebuggerDisplay("{DebuggerDisplay, nq}")]
10+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1111
[PublicAPI]
1212
public sealed class TnsNamesFile
1313
{
@@ -27,15 +27,13 @@ public sealed class TnsNamesFile
2727
public TnsNamesFile(TnsNamesFileInfo info, [NotNull] TnsNamesFileInfo[] iFileEntries, [NotNull] TnsNameInfo[] tnsNames)
2828
{
2929
if (info == null) throw new ArgumentNullException(nameof(info));
30-
if (iFileEntries == null) throw new ArgumentNullException(nameof(iFileEntries));
31-
if (tnsNames == null) throw new ArgumentNullException(nameof(tnsNames));
3230

3331
Parent = info.Parent;
3432
Filepath = info.Filepath;
3533
Source = info.Source;
3634
SourceOrder = info.SourceOrder;
37-
TnsNames = tnsNames;
38-
IfileEntries = iFileEntries;
35+
TnsNames = tnsNames ?? throw new ArgumentNullException(nameof(tnsNames));
36+
IfileEntries = iFileEntries ?? throw new ArgumentNullException(nameof(iFileEntries));
3937

4038
foreach (var tnsNameInfo in tnsNames)
4139
{

erl.Oracle.TnsNames/TnsNamesFileInfo.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@ namespace erl.Oracle.TnsNames
77
/// <summary>
88
/// Info about a TNS names file.
99
/// </summary>
10-
[DebuggerDisplay("{DebuggerDisplay, nq}")]
10+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1111
[PublicAPI]
1212
public sealed class TnsNamesFileInfo
1313
{
1414
public TnsNamesFileInfo(string filepath, TnsNamesSource source, TnsNamesFileInfo parent = null, int sourceOrder = 1)
1515
{
16-
if (filepath == null) throw new ArgumentNullException(nameof(filepath));
17-
18-
Filepath = filepath;
16+
Filepath = filepath ?? throw new ArgumentNullException(nameof(filepath));
1917
Source = source;
2018
SourceOrder = sourceOrder;
2119
Parent = parent;

erl.Oracle.TnsNames/UnknownDatabaseAddress.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace erl.Oracle.TnsNames
77
/// <summary>
88
///
99
/// </summary>
10-
[DebuggerDisplay("{DebuggerDisplay, nq}")]
10+
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + ",nq}")]
1111
[PublicAPI]
1212
public class UnknownDatabaseAddress : IDatabaseAddress
1313
{
@@ -18,10 +18,8 @@ public class UnknownDatabaseAddress : IDatabaseAddress
1818
/// <param name="rawAddress"></param>
1919
public UnknownDatabaseAddress([NotNull] string protocol, [NotNull] string rawAddress)
2020
{
21-
if (protocol == null) throw new ArgumentNullException(nameof(protocol));
22-
if (rawAddress == null) throw new ArgumentNullException(nameof(rawAddress));
23-
Protocol = protocol;
24-
RawAddress = rawAddress;
21+
Protocol = protocol ?? throw new ArgumentNullException(nameof(protocol));
22+
RawAddress = rawAddress ?? throw new ArgumentNullException(nameof(rawAddress));
2523
}
2624

2725
/// <inheritdoc />

0 commit comments

Comments
 (0)