Skip to content

Commit 2ee1140

Browse files
Merge pull request #76 from richardschneider/codacy
chore: use codacy for QA
2 parents 024a51d + 44db6ec commit 2ee1140

File tree

6 files changed

+43
-14
lines changed

6 files changed

+43
-14
lines changed

.codacy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
exclude_paths:
3+
- 'test/**/*'

IpfsCore.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpfsCoreTests", "test\IpfsC
88
EndProject
99
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DA715302-8746-4884-95F9-B56F069A0451}"
1010
ProjectSection(SolutionItems) = preProject
11+
.codacy.yml = .codacy.yml
1112
.travis.yml = .travis.yml
1213
appveyor.yml = appveyor.yml
1314
builddocs.cmd = builddocs.cmd

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![build status](https://ci.appveyor.com/api/projects/status/github/richardschneider/net-ipfs-core?branch=master&svg=true)](https://ci.appveyor.com/project/richardschneider/net-ipfs-core)
44
[![travis build](https://travis-ci.org/richardschneider/net-ipfs-core.svg?branch=master)](https://travis-ci.org/richardschneider/net-ipfs-core)
5+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a911c5ae1f044e92bfc006bbc945e135)](https://www.codacy.com/app/makaretu/net-ipfs-core?utm_source=github.com&utm_medium=referral&utm_content=richardschneider/net-ipfs-core&utm_campaign=Badge_Grade)
56
[![Coverage Status](https://coveralls.io/repos/richardschneider/net-ipfs-core/badge.svg?branch=master&service=github)](https://coveralls.io/github/richardschneider/net-ipfs-core?branch=master)
67
[![Version](https://img.shields.io/nuget/v/Ipfs.Core.svg)](https://www.nuget.org/packages/Ipfs.Core)
78
[![docs](https://cdn.rawgit.com/richardschneider/net-ipfs-core/master/doc/images/docs-latest-green.svg)](https://richardschneider.github.io/net-ipfs-core/articles/intro.html)
@@ -11,7 +12,6 @@ The core objects and interfaces of the [IPFS](https://github.com/ipfs/ipfs) (Int
1112
The interplanetary file system is the permanent web. It is a new hypermedia distribution protocol, addressed by content and identities. IPFS enables the creation of completely distributed applications. It aims to make the web faster, safer, and more open.
1213

1314
It supports the following runtimes
14-
1515
- .NET Framework 4.5
1616
- .NET Standard 1.4
1717
- .NET Standard 2.0
@@ -64,16 +64,16 @@ Most binary data (objects) in IPFS is represented as a [Base-58](https://en.wiki
6464

6565
> Base58 is a group of binary-to-text encoding schemes used to represent large integers as alphanumeric text. It is similar to Base64 but has been modified to avoid both non-alphanumeric characters and letters which might look ambiguous when printed. It is therefore designed for human users who manually enter the data, copying from some visual source, but also allows easy copy and paste because a double-click will usually select the whole string.
6666
67-
# Related Projects
67+
## Related Projects
6868

6969
- [IPFS DSL](https://github.com/cloveekprojeqt/ipfs-dsl) - A declarative embedded language for building compositional programs and protocols over the InterPlanetary File System.
7070
- [IPFS HTTP Client](https://github.com/richardschneider/net-ipfs-http-client) - A .Net client library for the IPFS HTTP API.
7171
- [IPFS Engine](https://github.com/richardschneider/net-ipfs-engine) - Implements the Core API.
7272
- [Peer Talk](https://github.com/richardschneider/peer-talk) - Peer to peer communication
7373

74-
# License
75-
Copyright © 2015-2018 Richard Schneider ([email protected])
74+
## License
75+
Copyright © 2015-2019 Richard Schneider ([email protected])
7676

77-
The IPFS Core library is licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php "Read more about the MIT license form") license. Refere to the [LICENSE](https://github.com/richardschneider/net-ipfs-core/blob/master/LICENSE) file for more information.
77+
The IPFS Core library is licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php "Read more about the MIT license form") license. Refer to the [LICENSE](https://github.com/richardschneider/net-ipfs-core/blob/master/LICENSE) file for more information.
7878

7979
<a href="https://www.buymeacoffee.com/kmXOxKJ4E" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>

src/Cid.cs

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ public class Cid : IEquatable<Cid>
5151
void EnsureMutable()
5252
{
5353
if (encodedValue != null)
54+
{
5455
throw new NotSupportedException("CID cannot be changed.");
56+
}
5557
}
5658

5759
/// <summary>
@@ -213,8 +215,9 @@ public override string ToString()
213215
public string Encode()
214216
{
215217
if (encodedValue != null)
218+
{
216219
return encodedValue;
217-
220+
}
218221
if (Version == 0)
219222
{
220223
encodedValue = Hash.ToBase58();
@@ -421,7 +424,9 @@ public static Cid Read(byte[] buffer)
421424
public byte[] ToArray()
422425
{
423426
if (Version == 0)
427+
{
424428
return Hash.ToArray();
429+
}
425430

426431
using (var ms = new MemoryStream())
427432
{
@@ -487,10 +492,18 @@ public bool Equals(Cid that)
487492
/// </summary>
488493
public static bool operator ==(Cid a, Cid b)
489494
{
490-
if (object.ReferenceEquals(a, b)) return true;
491-
if (object.ReferenceEquals(a, null)) return false;
492-
if (object.ReferenceEquals(b, null)) return false;
493-
495+
if (object.ReferenceEquals(a, b))
496+
{
497+
return true;
498+
}
499+
if (object.ReferenceEquals(a, null))
500+
{
501+
return false;
502+
}
503+
if (object.ReferenceEquals(b, null))
504+
{
505+
return false;
506+
}
494507
return a.Equals(b);
495508
}
496509

@@ -499,10 +512,18 @@ public bool Equals(Cid that)
499512
/// </summary>
500513
public static bool operator !=(Cid a, Cid b)
501514
{
502-
if (object.ReferenceEquals(a, b)) return false;
503-
if (object.ReferenceEquals(a, null)) return true;
504-
if (object.ReferenceEquals(b, null)) return true;
505-
515+
if (object.ReferenceEquals(a, b))
516+
{
517+
return false;
518+
}
519+
if (object.ReferenceEquals(a, null))
520+
{
521+
return true;
522+
}
523+
if (object.ReferenceEquals(b, null))
524+
{
525+
return true;
526+
}
506527
return !a.Equals(b);
507528
}
508529

src/MultiAddress.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ void Read(CodedInputStream stream)
306306
void Read(TextReader stream)
307307
{
308308
if (stream.Read() != '/')
309+
{
309310
throw new FormatException("An IFPS multiaddr must start with '/'.");
311+
}
310312

311313
var name = new StringBuilder();
312314
Protocols.Clear();

src/MultiHash.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ public MultiHash(string algorithmName, byte[] digest)
107107
throw new ArgumentNullException("digest");
108108

109109
if (!HashingAlgorithm.Names.TryGetValue(algorithmName, out HashingAlgorithm a))
110+
{
110111
throw new ArgumentException(string.Format("The IPFS hashing algorithm '{0}' is unknown.", algorithmName));
112+
}
111113
Algorithm = a;
112114

113115
if (Algorithm.DigestSize != 0 && Algorithm.DigestSize != digest.Length)

0 commit comments

Comments
 (0)