bruslim/peerface

View on GitHub

Showing 33 of 39 total issues

Similar blocks of code found in 10 locations. Consider refactoring.
Open

PeerConnection.prototype.fireEvent[Messages.Choke.Id] = function(part) {
  return this._constructAndFireEvent(Messages.Choke, 'choke', part);
};
Severity: Major
Found in lib/PeerConnection.js and 9 other locations - About 45 mins to fix
lib/PeerConnection.js on lines 176..178
lib/PeerConnection.js on lines 180..182
lib/PeerConnection.js on lines 184..186
lib/PeerConnection.js on lines 188..190
lib/PeerConnection.js on lines 192..194
lib/PeerConnection.js on lines 196..198
lib/PeerConnection.js on lines 200..202
lib/PeerConnection.js on lines 204..206
lib/PeerConnection.js on lines 208..210

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

PeerConnection.prototype.fireEvent[Messages.Piece.Id] = function(part) {
  return this._constructAndFireEvent(Messages.Piece, 'piece', part);
};
Severity: Major
Found in lib/PeerConnection.js and 9 other locations - About 45 mins to fix
lib/PeerConnection.js on lines 172..174
lib/PeerConnection.js on lines 176..178
lib/PeerConnection.js on lines 180..182
lib/PeerConnection.js on lines 184..186
lib/PeerConnection.js on lines 188..190
lib/PeerConnection.js on lines 192..194
lib/PeerConnection.js on lines 196..198
lib/PeerConnection.js on lines 204..206
lib/PeerConnection.js on lines 208..210

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

PeerConnection.prototype.fireEvent[Messages.Interested.Id] = function(part) {
  return this._constructAndFireEvent(Messages.Interested, 'interested', part);
};
Severity: Major
Found in lib/PeerConnection.js and 9 other locations - About 45 mins to fix
lib/PeerConnection.js on lines 172..174
lib/PeerConnection.js on lines 176..178
lib/PeerConnection.js on lines 184..186
lib/PeerConnection.js on lines 188..190
lib/PeerConnection.js on lines 192..194
lib/PeerConnection.js on lines 196..198
lib/PeerConnection.js on lines 200..202
lib/PeerConnection.js on lines 204..206
lib/PeerConnection.js on lines 208..210

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

PeerConnection.prototype.fireEvent[Messages.Request.Id] = function(part) {
  return this._constructAndFireEvent(Messages.Request, 'request', part);
};
Severity: Major
Found in lib/PeerConnection.js and 9 other locations - About 45 mins to fix
lib/PeerConnection.js on lines 172..174
lib/PeerConnection.js on lines 176..178
lib/PeerConnection.js on lines 180..182
lib/PeerConnection.js on lines 184..186
lib/PeerConnection.js on lines 188..190
lib/PeerConnection.js on lines 192..194
lib/PeerConnection.js on lines 200..202
lib/PeerConnection.js on lines 204..206
lib/PeerConnection.js on lines 208..210

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

PeerConnection.prototype.fireEvent[Messages.Bitfield.Id] = function(part) {
  return this._constructAndFireEvent(Messages.Bitfield, 'bitfield', part);
};
Severity: Major
Found in lib/PeerConnection.js and 9 other locations - About 45 mins to fix
lib/PeerConnection.js on lines 172..174
lib/PeerConnection.js on lines 176..178
lib/PeerConnection.js on lines 180..182
lib/PeerConnection.js on lines 184..186
lib/PeerConnection.js on lines 188..190
lib/PeerConnection.js on lines 196..198
lib/PeerConnection.js on lines 200..202
lib/PeerConnection.js on lines 204..206
lib/PeerConnection.js on lines 208..210

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Object.defineProperties(BaseRequestMessage.prototype,{
  _keys: {
    value: PeerMessage.prototype._keys.concat([
      '_index',
      '_begin',
Severity: Minor
Found in lib/dto/BaseRequestMessage.js and 1 other location - About 40 mins to fix
lib/dto/PieceMessage.js on lines 63..71

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Object.defineProperties(PieceMessage.prototype,{
  _keys: {
    value: PeerMessage.prototype._keys.concat([
      '_index',
      '_begin',
Severity: Minor
Found in lib/dto/PieceMessage.js and 1 other location - About 40 mins to fix
lib/dto/BaseRequestMessage.js on lines 56..64

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

Object.defineProperties(PeerMessage.prototype,{
  _keys: {
    value: KeepAlive.prototype._keys.concat([
      '_id'
    ])
Severity: Major
Found in lib/dto/PeerMessage.js and 3 other locations - About 35 mins to fix
lib/dto/BitfieldMessage.js on lines 45..51
lib/dto/HaveMessage.js on lines 44..50
lib/dto/PortMessage.js on lines 44..50

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    _pstrlen: {
      get: function() {
        var buffer = new Buffer(1);
        buffer.writeUInt8(this.pstrlen, 0);
        return buffer;
Severity: Minor
Found in lib/dto/Handshake.js and 1 other location - About 35 mins to fix
lib/dto/KeepAlive.js on lines 47..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

Object.defineProperties(HaveMessage.prototype,{
  _keys: {
    value: PeerMessage.prototype._keys.concat([
      '_pieceIndex'
    ])
Severity: Major
Found in lib/dto/HaveMessage.js and 3 other locations - About 35 mins to fix
lib/dto/BitfieldMessage.js on lines 45..51
lib/dto/PeerMessage.js on lines 31..37
lib/dto/PortMessage.js on lines 44..50

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      _len: {
        get: function() {
          var buffer = new Buffer(4);
          buffer.writeInt32BE(this.len,0);
          return buffer;
Severity: Minor
Found in lib/dto/KeepAlive.js and 1 other location - About 35 mins to fix
lib/dto/Handshake.js on lines 11..17

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

Object.defineProperties(PortMessage.prototype,{
  _keys: {
    value: PeerMessage.prototype._keys.concat([
      '_listenPort'
    ])
Severity: Major
Found in lib/dto/PortMessage.js and 3 other locations - About 35 mins to fix
lib/dto/BitfieldMessage.js on lines 45..51
lib/dto/HaveMessage.js on lines 44..50
lib/dto/PeerMessage.js on lines 31..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

Object.defineProperties(BitfieldMessage.prototype,{
  _keys: {
    value: PeerMessage.prototype._keys.concat([
      '_bitfield'
    ])
Severity: Major
Found in lib/dto/BitfieldMessage.js and 3 other locations - About 35 mins to fix
lib/dto/HaveMessage.js on lines 44..50
lib/dto/PeerMessage.js on lines 31..37
lib/dto/PortMessage.js on lines 44..50

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language