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)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    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. This will iterate over non-own properties too. How about:

    for (let property of Object.keys(this.attributes.lineCounts)) {
    
  4. This can use the method() sugar.

  5. How about:

    for (let [i, diffCommit] of Array.entries(this.collection.models)) {
    
  6. 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. Can you align the - with "offset"?

  8. 
      
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. This should be indented 2 more spaces.

  3. 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)
     
     
     
     
     
     
     
     

    Ooh, even better:

    return Object.values(this.get('lineCounts'))
        .reduce((a, b) => a + b);
    
  3. return this.collection.any(
        model => model.get('historyEntrySymbol') !== ' ');
    
  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. Ship It!
  2. 
      
brennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to dvcs (94ca2eb)
Loading...