• 
      

    Update the dvcs branch for ES6

    Review Request #8056 — Created March 12, 2016 and submitted

    Information

    Review Board
    dvcs

    Reviewers

    This patch updates the RB.DiffCommit model and
    RB.DiffCommitIndexView view to use ES6. As well, the doc comments
    have been updated to align with our style guide.

    Manually tested that the diff commit index still worked.

    Description From Last Updated

    This should probably just use a defaults object instead of a method.

    david david

    This will iterate over non-own properties too. How about: for (let property of Object.keys(this.attributes.lineCounts)) {

    david david

    This can use the method() sugar.

    david david

    How about: for (let [i, diffCommit] of Array.entries(this.collection.models)) {

    david david

    Can you move this up above the "tr" definition? This seems like it doesn't fit in with the rest of …

    david david

    Template string?

    david david

    Template string?

    david david

    const?

    david david

    Can you align the - with "offset"?

    david david

    Alignment?

    david david

    This should be indented 2 more spaces.

    david david

    Should be indented 2 more spaces.

    david david

    Ooh, even better: return Object.values(this.get('lineCounts')) .reduce((a, b) => a + b);

    david david

    return this.collection.any( model => model.get('historyEntrySymbol') !== ' ');

    david david

    Can be const.

    david david
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
    2. 
        
    david
    1. 
        
    2. reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js (Diff revision 1)
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
      Show all issues

      This should probably just use a defaults object instead of a method.

      1. lineCounts is an object, so we should use a function here.

    3. Show all issues

      This will iterate over non-own properties too. How about:

      for (let property of Object.keys(this.attributes.lineCounts)) {
      
    4. Show all issues

      This can use the method() sugar.

    5. Show all issues

      How about:

      for (let [i, diffCommit] of Array.entries(this.collection.models)) {
      
    6. Show all issues

      Can you move this up above the "tr" definition? This seems like it doesn't fit in with the rest of the code around it.

    7. Show all issues

      Template string?

    8. Show all issues

      Template string?

    9. Show all issues

      const?

    10. Show all issues

      Can you align the - with "offset"?

    11. Show all issues

      Alignment?

    12. 
        
    brennie
    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
    2. 
        
    david
    1. 
        
    2. Show all issues

      This should be indented 2 more spaces.

    3. Show all issues

      Should be indented 2 more spaces.

    4. 
        
    brennie
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
    2. 
        
    david
    1. A couple more suggestions to tighten things up:

    2. reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js (Diff revision 3)
       
       
       
       
       
       
       
       
      Show all issues

      Ooh, even better:

      return Object.values(this.get('lineCounts'))
          .reduce((a, b) => a + b);
      
    3. Show all issues

      return this.collection.any(
          model => model.get('historyEntrySymbol') !== ' ');
      
    4. Show all issues

      Can be const.

    5. 
        
    brennie
    reviewbot
    1. Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
      
      Tool: Pyflakes
      Processed Files:
          reviewboard/staticbundles.py
      
      Ignored Files:
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.es6.js
          reviewboard/static/rb/js/diffviewer/views/diffCommitIndexView.es6.js
          reviewboard/static/rb/js/diffviewer/models/diffCommitModel.js
      
      
    2. 
        
    david
    1. Ship It!
    2. 
        
    brennie
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to dvcs (94ca2eb)