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.

daviddavid

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

daviddavid

This can use the method() sugar.

daviddavid

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

daviddavid

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

daviddavid

Template string?

daviddavid

Template string?

daviddavid

const?

daviddavid

Can you align the - with "offset"?

daviddavid

Alignment?

daviddavid

This should be indented 2 more spaces.

daviddavid

Should be indented 2 more spaces.

daviddavid

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

daviddavid

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

daviddavid

Can be const.

daviddavid
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)