Skip to content

Commit

Permalink
🔧 codeclimate - ignore a few small duplication issues
Browse files Browse the repository at this point in the history
* I disagree with codeclimate about these being real issues.
* they are things like this, where it's just a few lines:
  (each with mass=45)

  Query.prototype.byName = function (name) {
    this.queryBy = 'name';
    this.name = name;
    return this;
  };

  Query.prototype.bySchoolCode = function (schoolCode) {
    this.queryBy = 'school_code';
    this.school_code = schoolCode;
    return this;
  };

  Query.prototype.byBounds = function (bounds) {
    this.queryBy = 'bounds';
    this.bounds = bounds;
    return this;
  };

* I wish codeclimate's duplication engine would let us differentiate between similar
  3-line functions and similar 10+ line functions.

* Perhaps something like this would work but it seems like unnecessary complexity
to avoid three 3-line functions (and save 5 lines):

  Query.prototype.byName = Query.by('name', name);
  Query.prototype.bySchoolCode = Query.by('school_code', schoolCode);
  Query.prototype.byBounds = Query.by('bounds', bounds);

  Query.prototype.by = function(param, value) {
    return function(value) {
     this.queryBy = param;
     this[param] = value;
     return this;
    }
  }
  • Loading branch information
techieshark committed Nov 28, 2016
1 parent e0b6f6d commit 1cdc2cb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .codeclimate.yml
Expand Up @@ -4,6 +4,12 @@ engines:
enabled: true
duplication:
enabled: true
# ... CONFIG CONTENT ...
exclude_fingerprints:
- 86e657794bdefa94748a3cc3863a1819
- aae70d598280bb1c4cdabb95c64a30a9
- 866f47e60dd2327bae9048020bc62c15
# ... CONFIG CONTENT ...
config:
languages:
javascript:
Expand Down

0 comments on commit 1cdc2cb

Please sign in to comment.