jakearchibald/tweetdeck-prototype

View on GitHub

Showing 58 of 58 total issues

Function makeIntervalConstructor has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function makeIntervalConstructor(compareValues) {

    /**
     * Interval
     * http://en.wikipedia.org/wiki/Interval_(mathematics)
Severity: Minor
Found in www/static/js/lib/interval.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

        <article className="tweet">
          <div className="tweet__content">
            <h1 className="tweet__title">
              <img className="tweet__avatar" src="https://pbs.twimg.com/profile_images/520827394379501568/-nr4H4-Y_bigger.jpeg" alt="" />
              <span className="tweet__title-text">
Severity: Major
Found in www/static/js/component/thread.js and 1 other location - About 1 day to fix
www/static/js/component/thread.js on lines 59..74

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 219.

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

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

        <article className="tweet">
          <div className="tweet__content">
            <h1 className="tweet__title">
              <img className="tweet__avatar" src="https://pbs.twimg.com/profile_images/520827394379501568/-nr4H4-Y_bigger.jpeg" alt="" />
              <span className="tweet__title-text">
Severity: Major
Found in www/static/js/component/thread.js and 1 other location - About 1 day to fix
www/static/js/component/thread.js on lines 43..58

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 219.

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

Function makeIntervalConstructor has 186 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function makeIntervalConstructor(compareValues) {

    /**
     * Interval
     * http://en.wikipedia.org/wiki/Interval_(mathematics)
Severity: Major
Found in www/static/js/lib/interval.js - About 7 hrs to fix

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

      it('calls to favorite callback', function () {
        var favCb = jest.genMockFn();
        var rtCb = jest.genMockFn();
        var activateCb = jest.genMockFn();
        var item = TestUtils.renderIntoDocument(
    Severity: Major
    Found in www/static/js/component/__tests__/column-item-test.js and 1 other location - About 6 hrs to fix
    www/static/js/component/__tests__/column-item-test.js on lines 51..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 167.

    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

      it('calls to retweet callback', function () {
        var favCb = jest.genMockFn();
        var rtCb = jest.genMockFn();
        var activateCb = jest.genMockFn();
        var item = TestUtils.renderIntoDocument(
    Severity: Major
    Found in www/static/js/component/__tests__/column-item-test.js and 1 other location - About 6 hrs to fix
    www/static/js/component/__tests__/column-item-test.js on lines 36..49

    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 167.

    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

      favoriteTweet(request) {
        return this.tweetStore.put(request.data)
          .then(tweet => this.tweetChanged(tweet))
          .then(tweet => this.upstream.favoriteTweet(request))
          .then(requestResult => {
    Severity: Major
    Found in www/static/js/lib/timeline-store.js and 1 other location - About 5 hrs to fix
    www/static/js/lib/timeline-store.js on lines 44..56

    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 149.

    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

      retweetTweet(request) {
        return this.tweetStore.put(request.data)
          .then(tweet => this.tweetChanged(tweet))
          .then(tweet => this.upstream.retweetTweet(request))
          .then(requestResult => {
    Severity: Major
    Found in www/static/js/lib/timeline-store.js and 1 other location - About 5 hrs to fix
    www/static/js/lib/timeline-store.js on lines 30..42

    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 149.

    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

      favoriteTweet(tweet) {
        var sourceTweet = tweet.source;
        const favorited = sourceTweet.favorited;
        const diff = favorited ? -1 : 1;
        const updatedTweet = update(sourceTweet, {
    Severity: Major
    Found in www/static/js/lib/tweetdeck/column.js and 1 other location - About 4 hrs to fix
    www/static/js/lib/tweetdeck/column.js on lines 70..85

    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 132.

    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

      retweetTweet(tweet) {
        var sourceTweet = tweet.source;
        const retweeted = sourceTweet.retweeted;
        const diff = retweeted ? -1 : 1;
        const updatedTweet = update(sourceTweet, {
    Severity: Major
    Found in www/static/js/lib/tweetdeck/column.js and 1 other location - About 4 hrs to fix
    www/static/js/lib/tweetdeck/column.js on lines 53..68

    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 132.

    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

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

        this.store = this.store
          .concat(
            requestResult.result.map(
              storeUtils.makeOrderedStoreObjectFromTweet
            )
    Severity: Major
    Found in www/static/js/lib/memory-ordered-store.js and 1 other location - About 2 hrs to fix
    www/static/js/lib/idb-ordered-store.js on lines 50..67

    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 81.

    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

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

            var newStore = (store || [])
              .concat(
                requestResult.result.map(
                  storeUtils.makeOrderedStoreObjectFromTweet
                )
    Severity: Major
    Found in www/static/js/lib/idb-ordered-store.js and 1 other location - About 2 hrs to fix
    www/static/js/lib/memory-ordered-store.js on lines 39..56

    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 81.

    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

    TweetdeckDbProto.setAccount = function(account) {
      if (IndexedDouchebag.supported) {
        return this.idb.put('keyval', 'account', account);
      }
      else {
    Severity: Major
    Found in www/static/js/lib/tweetdeckdb.js and 1 other location - About 2 hrs to fix
    www/static/js/lib/tweetdeckdb.js on lines 35..43

    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 78.

    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

    TweetdeckDbProto.setUser = function(user) {
      if (IndexedDouchebag.supported) {
        return this.idb.put('keyval', 'user', user);
      }
      else {
    Severity: Major
    Found in www/static/js/lib/tweetdeckdb.js and 1 other location - About 2 hrs to fix
    www/static/js/lib/tweetdeckdb.js on lines 58..66

    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 78.

    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

    Function render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const classes = cx({
          'thread': true,
          'thread--hero': this.props.item.heroImg,
          'blur-bg': this.state.blurBg
    Severity: Major
    Found in www/static/js/component/thread.js - About 2 hrs to fix

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

          Interval.prototype.fromComparator = function (a, b) {
              var ordering = Interval.compareEndpoints(a, b);
              if (ordering === 0) {
                  // Inclusive should sort before exclusive
                  ordering = b.inclusive - a.inclusive;
      Severity: Major
      Found in www/static/js/lib/interval.js and 1 other location - About 1 hr to fix
      www/static/js/lib/interval.js on lines 267..274

      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 72.

      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

          Interval.prototype.toComparator = function (a, b) {
              var ordering = Interval.compareEndpoints(a, b);
              if (ordering === 0) {
                  // Exclusive should sort before inclusive
                  ordering = a.inclusive - b.inclusive;
      Severity: Major
      Found in www/static/js/lib/interval.js and 1 other location - About 1 hr to fix
      www/static/js/lib/interval.js on lines 258..265

      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 72.

      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

      Function transformLoginResponse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      TD.transformLoginResponse = function (res) {
        if (res.screen_name) {
          return new User({
            screenName: res.screen_name,
            id: res.user_id,
      Severity: Minor
      Found in www/static/js/lib/tweetdeck/index.js - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const classes = cx({
            'tweet--hero': this.props.item.heroImg,
            'tweet': true,
            'tweet--favorited': this.props.item.source.favorited,
      Severity: Minor
      Found in www/static/js/component/column-item.js - About 1 hr to fix

        Function addAll has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Cache.prototype.addAll = function addAll(requests) {
            var cache = this;
        
            // Since DOMExceptions are not constructable:
            function NetworkError(message) {
        Severity: Minor
        Found in www/static/js/lib/serviceworker-cache-polyfill.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language