refactor: ensure all 'TODO's are consistent (#23252)

PR Close #23252
This commit is contained in:
Rafael 2018-04-08 18:19:25 -03:00 committed by Igor Minar
parent aa27155618
commit 639d52fe71
26 changed files with 41 additions and 41 deletions

View File

@ -15,7 +15,7 @@ export class BackendService {
getAll(type: Type<any>): PromiseLike<any[]> { getAll(type: Type<any>): PromiseLike<any[]> {
if (type === Hero) { if (type === Hero) {
// TODO get from the database // TODO: get from the database
return Promise.resolve<Hero[]>(HEROES); return Promise.resolve<Hero[]>(HEROES);
} }
let err = new Error('Cannot get object of this type'); let err = new Error('Cannot get object of this type');

View File

@ -8,7 +8,7 @@ import { MinimalLogger } from './minimal-logger.service';
@Component({ @Component({
selector: 'app-hero-of-the-month', selector: 'app-hero-of-the-month',
templateUrl: './hero-of-the-month.component.html', templateUrl: './hero-of-the-month.component.html',
// Todo: move this aliasing, `useExisting` provider to the AppModule // TODO: move this aliasing, `useExisting` provider to the AppModule
providers: [{ provide: MinimalLogger, useExisting: LoggerService }] providers: [{ provide: MinimalLogger, useExisting: LoggerService }]
}) })
export class HeroOfTheMonthComponent { export class HeroOfTheMonthComponent {

View File

@ -5,7 +5,7 @@ import { Hero } from './hero';
@Injectable() @Injectable()
export class HeroService { export class HeroService {
// TODO move to database // TODO: move to database
private heroes: Array<Hero> = [ private heroes: Array<Hero> = [
new Hero(1, 'RubberMan', 'Hero of many talents', '123-456-7899'), new Hero(1, 'RubberMan', 'Hero of many talents', '123-456-7899'),
new Hero(2, 'Magma', 'Hero of all trades', '555-555-5555'), new Hero(2, 'Magma', 'Hero of all trades', '555-555-5555'),

View File

@ -151,7 +151,7 @@ export class BethComponent implements Parent {
// #docregion alex-1 // #docregion alex-1
}) })
// #enddocregion alex-1 // #enddocregion alex-1
// Todo: Add `... implements Parent` to class signature // TODO: Add `... implements Parent` to class signature
// #docregion alex-1 // #docregion alex-1
// #docregion alex-class-signature // #docregion alex-class-signature
export class AlexComponent extends Base export class AlexComponent extends Base

View File

@ -7,7 +7,7 @@ export class User {
public isAuthorized = false) { } public isAuthorized = false) { }
} }
// Todo: get the user; don't 'new' it. // TODO: get the user; don't 'new' it.
let alice = new User('Alice', true); let alice = new User('Alice', true);
let bob = new User('Bob', false); let bob = new User('Bob', false);

View File

@ -8,8 +8,8 @@ import { TextboxQuestion } from './question-textbox';
@Injectable() @Injectable()
export class QuestionService { export class QuestionService {
// Todo: get from a remote source of question metadata // TODO: get from a remote source of question metadata
// Todo: make asynchronous // TODO: make asynchronous
getQuestions() { getQuestions() {
let questions: QuestionBase<any>[] = [ let questions: QuestionBase<any>[] = [

View File

@ -14,7 +14,7 @@ export class UploadInterceptor implements HttpInterceptor {
if (req.url.indexOf('/upload/file') === -1) { if (req.url.indexOf('/upload/file') === -1) {
return next.handle(req); return next.handle(req);
} }
const delay = 300; // Todo: inject delay? const delay = 300; // TODO: inject delay?
return createUploadEvents(delay); return createUploadEvents(delay);
} }
} }

View File

@ -23,7 +23,7 @@ export class HeroListComponent implements OnInit {
getHeroes() { getHeroes() {
this.isLoading = true; this.isLoading = true;
this.heroes = this.heroService.getHeroes() this.heroes = this.heroService.getHeroes()
// Todo: error handling // TODO: error handling
.pipe(finalize(() => this.isLoading = false)); .pipe(finalize(() => this.isLoading = false));
this.selectedHero = undefined; this.selectedHero = undefined;
} }

View File

@ -1,6 +1,6 @@
// #docplaster // #docplaster
// #docregion // #docregion
// TODO SOMEDAY: Feature Componetized like HeroCenter // TODO: Feature Componetized like HeroCenter
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';

View File

@ -1,6 +1,6 @@
// #docplaster // #docplaster
// #docregion // #docregion
// TODO SOMEDAY: Feature Componetized like CrisisCenter // TODO: Feature Componetized like CrisisCenter
// #docregion rxjs-imports // #docregion rxjs-imports
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { switchMap } from 'rxjs/operators'; import { switchMap } from 'rxjs/operators';

View File

@ -15,7 +15,7 @@ describe ('HeroesService (with spies)', () => {
let heroService: HeroService; let heroService: HeroService;
beforeEach(() => { beforeEach(() => {
// Todo: spy on other methods too // TODO: spy on other methods too
httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']); httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']);
heroService = new HeroService(<any> httpClientSpy); heroService = new HeroService(<any> httpClientSpy);
}); });

View File

@ -26,7 +26,7 @@ export class HeroService {
// #docregion getHeroes, getHeroes-1 // #docregion getHeroes, getHeroes-1
getHeroes(): Observable<Hero[]> { getHeroes(): Observable<Hero[]> {
// #enddocregion getHeroes-1 // #enddocregion getHeroes-1
// Todo: send the message _after_ fetching the heroes // TODO: send the message _after_ fetching the heroes
this.messageService.add('HeroService: fetched heroes'); this.messageService.add('HeroService: fetched heroes');
// #docregion getHeroes-1 // #docregion getHeroes-1
return of(HEROES); return of(HEROES);

View File

@ -12,14 +12,14 @@ export class HeroService {
constructor(private messageService: MessageService) { } constructor(private messageService: MessageService) { }
getHeroes(): Observable<Hero[]> { getHeroes(): Observable<Hero[]> {
// Todo: send the message _after_ fetching the heroes // TODO: send the message _after_ fetching the heroes
this.messageService.add('HeroService: fetched heroes'); this.messageService.add('HeroService: fetched heroes');
return of(HEROES); return of(HEROES);
} }
// #docregion getHero // #docregion getHero
getHero(id: number): Observable<Hero> { getHero(id: number): Observable<Hero> {
// Todo: send the message _after_ fetching the hero // TODO: send the message _after_ fetching the hero
this.messageService.add(`HeroService: fetched hero id=${id}`); this.messageService.add(`HeroService: fetched hero id=${id}`);
return of(HEROES.find(hero => hero.id === id)); return of(HEROES.find(hero => hero.id === id));
} }

View File

@ -78,7 +78,7 @@ export class ApiListComponent implements OnInit {
this.initializeSearchCriteria(); this.initializeSearchCriteria();
} }
// Todo: may need to debounce as the original did // TODO: may need to debounce as the original did
// although there shouldn't be any perf consequences if we don't // although there shouldn't be any perf consequences if we don't
setQuery(query: string) { setQuery(query: string) {
this.setSearchCriteria({query: (query || '').toLowerCase().trim() }); this.setSearchCriteria({query: (query || '').toLowerCase().trim() });

View File

@ -75,7 +75,7 @@ export class ApiService implements OnDestroy {
.subscribe( .subscribe(
sections => this.sectionsSubject.next(sections), sections => this.sectionsSubject.next(sections),
(err: HttpErrorResponse) => { (err: HttpErrorResponse) => {
// Todo: handle error // TODO: handle error
this.logger.error(err); this.logger.error(err);
throw err; // rethrow for now. throw err; // rethrow for now.
} }

View File

@ -37,7 +37,7 @@ export class LocationService {
swUpdates.updateActivated.subscribe(() => this.swUpdateActivated = true); swUpdates.updateActivated.subscribe(() => this.swUpdateActivated = true);
} }
// TODO?: ignore if url-without-hash-or-search matches current location? // TODO: ignore if url-without-hash-or-search matches current location?
go(url: string|null|undefined) { go(url: string|null|undefined) {
if (!url) { return; } if (!url) { return; }
url = this.stripSlashes(url); url = this.stripSlashes(url);

View File

@ -73,7 +73,7 @@ export class Runner {
// This might still create instances twice. We are creating a new injector with all the // This might still create instances twice. We are creating a new injector with all the
// providers. // providers.
// Only WebDriverAdapter is reused. // Only WebDriverAdapter is reused.
// TODO vsavkin consider changing it when toAsyncFactory is added back or when child // TODO(vsavkin): consider changing it when toAsyncFactory is added back or when child
// injectors are handled better. // injectors are handled better.
const injector = Injector.create([ const injector = Injector.create([
sampleProviders, {provide: Options.CAPABILITIES, useValue: capabilities}, sampleProviders, {provide: Options.CAPABILITIES, useValue: capabilities},

View File

@ -248,7 +248,7 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
this._removalsHead = this._removalsTail = null; this._removalsHead = this._removalsTail = null;
this._identityChangesHead = this._identityChangesTail = null; this._identityChangesHead = this._identityChangesTail = null;
// todo(vicb) when assert gets supported // TODO(vicb): when assert gets supported
// assert(!this.isDirty); // assert(!this.isDirty);
} }
} }
@ -420,11 +420,11 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
this._insertAfter(record, prevRecord, index); this._insertAfter(record, prevRecord, index);
if (this._additionsTail === null) { if (this._additionsTail === null) {
// todo(vicb) // TODO(vicb):
// assert(this._additionsHead === null); // assert(this._additionsHead === null);
this._additionsTail = this._additionsHead = record; this._additionsTail = this._additionsHead = record;
} else { } else {
// todo(vicb) // TODO(vicb):
// assert(_additionsTail._nextAdded === null); // assert(_additionsTail._nextAdded === null);
// assert(record._nextAdded === null); // assert(record._nextAdded === null);
this._additionsTail = this._additionsTail._nextAdded = record; this._additionsTail = this._additionsTail._nextAdded = record;
@ -436,14 +436,14 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
_insertAfter( _insertAfter(
record: IterableChangeRecord_<V>, prevRecord: IterableChangeRecord_<V>|null, record: IterableChangeRecord_<V>, prevRecord: IterableChangeRecord_<V>|null,
index: number): IterableChangeRecord_<V> { index: number): IterableChangeRecord_<V> {
// todo(vicb) // TODO(vicb):
// assert(record != prevRecord); // assert(record != prevRecord);
// assert(record._next === null); // assert(record._next === null);
// assert(record._prev === null); // assert(record._prev === null);
const next: IterableChangeRecord_<V>|null = const next: IterableChangeRecord_<V>|null =
prevRecord === null ? this._itHead : prevRecord._next; prevRecord === null ? this._itHead : prevRecord._next;
// todo(vicb) // TODO(vicb):
// assert(next != record); // assert(next != record);
// assert(prevRecord != record); // assert(prevRecord != record);
record._next = next; record._next = next;
@ -482,7 +482,7 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
const prev = record._prev; const prev = record._prev;
const next = record._next; const next = record._next;
// todo(vicb) // TODO(vicb):
// assert((record._prev = null) === null); // assert((record._prev = null) === null);
// assert((record._next = null) === null); // assert((record._next = null) === null);
@ -502,7 +502,7 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
/** @internal */ /** @internal */
_addToMoves(record: IterableChangeRecord_<V>, toIndex: number): IterableChangeRecord_<V> { _addToMoves(record: IterableChangeRecord_<V>, toIndex: number): IterableChangeRecord_<V> {
// todo(vicb) // TODO(vicb):
// assert(record._nextMoved === null); // assert(record._nextMoved === null);
if (record.previousIndex === toIndex) { if (record.previousIndex === toIndex) {
@ -510,11 +510,11 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
} }
if (this._movesTail === null) { if (this._movesTail === null) {
// todo(vicb) // TODO(vicb):
// assert(_movesHead === null); // assert(_movesHead === null);
this._movesTail = this._movesHead = record; this._movesTail = this._movesHead = record;
} else { } else {
// todo(vicb) // TODO(vicb):
// assert(_movesTail._nextMoved === null); // assert(_movesTail._nextMoved === null);
this._movesTail = this._movesTail._nextMoved = record; this._movesTail = this._movesTail._nextMoved = record;
} }
@ -531,12 +531,12 @@ export class DefaultIterableDiffer<V> implements IterableDiffer<V>, IterableChan
record._nextRemoved = null; record._nextRemoved = null;
if (this._removalsTail === null) { if (this._removalsTail === null) {
// todo(vicb) // TODO(vicb):
// assert(_removalsHead === null); // assert(_removalsHead === null);
this._removalsTail = this._removalsHead = record; this._removalsTail = this._removalsHead = record;
record._prevRemoved = null; record._prevRemoved = null;
} else { } else {
// todo(vicb) // TODO(vicb):
// assert(_removalsTail._nextRemoved === null); // assert(_removalsTail._nextRemoved === null);
// assert(record._nextRemoved === null); // assert(record._nextRemoved === null);
record._prevRemoved = this._removalsTail; record._prevRemoved = this._removalsTail;
@ -607,7 +607,7 @@ class _DuplicateItemRecordList<V> {
record._nextDup = null; record._nextDup = null;
record._prevDup = null; record._prevDup = null;
} else { } else {
// todo(vicb) // TODO(vicb):
// assert(record.item == _head.item || // assert(record.item == _head.item ||
// record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN); // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
this._tail !._nextDup = record; this._tail !._nextDup = record;
@ -636,7 +636,7 @@ class _DuplicateItemRecordList<V> {
* Returns whether the list of duplicates is empty. * Returns whether the list of duplicates is empty.
*/ */
remove(record: IterableChangeRecord_<V>): boolean { remove(record: IterableChangeRecord_<V>): boolean {
// todo(vicb) // TODO(vicb):
// assert(() { // assert(() {
// // verify that the record being removed is in the list. // // verify that the record being removed is in the list.
// for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) { // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {

View File

@ -21,6 +21,6 @@ export function isPromise(obj: any): obj is Promise<any> {
* Determine if the argument is an Observable * Determine if the argument is an Observable
*/ */
export function isObservable(obj: any | Observable<any>): obj is Observable<any> { export function isObservable(obj: any | Observable<any>): obj is Observable<any> {
// TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved // TODO: use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
return !!obj && typeof obj.subscribe === 'function'; return !!obj && typeof obj.subscribe === 'function';
} }

View File

@ -23,7 +23,7 @@ class ComplexItem {
toString() { return `{id: ${this.id}, color: ${this.color}}`; } toString() { return `{id: ${this.id}, color: ${this.color}}`; }
} }
// todo(vicb): UnmodifiableListView / frozen object when implemented // TODO(vicb): UnmodifiableListView / frozen object when implemented
{ {
describe('iterable differ', function() { describe('iterable differ', function() {
describe('DefaultIterableDiffer', function() { describe('DefaultIterableDiffer', function() {

View File

@ -11,7 +11,7 @@ import {DefaultKeyValueDiffer, DefaultKeyValueDifferFactory} from '@angular/core
import {kvChangesAsString, testChangesAsString} from '../../change_detection/util'; import {kvChangesAsString, testChangesAsString} from '../../change_detection/util';
// todo(vicb): Update the code & tests for object equality // TODO(vicb): Update the code & tests for object equality
{ {
describe('keyvalue differ', function() { describe('keyvalue differ', function() {
describe('DefaultKeyValueDiffer', function() { describe('DefaultKeyValueDiffer', function() {

View File

@ -19,7 +19,7 @@ import {take} from 'rxjs/operators';
* @deprecated use @angular/common/http instead * @deprecated use @angular/common/http instead
*/ */
export class MockConnection implements Connection { export class MockConnection implements Connection {
// TODO Name `readyState` should change to be more generic, and states could be made to be more // TODO: Name `readyState` should change to be more generic, and states could be made to be more
// descriptive than ResourceLoader states. // descriptive than ResourceLoader states.
/** /**
* Describes the state of the connection, based on `XMLHttpRequest.readyState`, but with * Describes the state of the connection, based on `XMLHttpRequest.readyState`, but with

View File

@ -12,7 +12,7 @@ import {MessageBus, MessageBusSink, MessageBusSource} from './message_bus';
// TODO(jteplitz602) Replace this with the definition in lib.webworker.d.ts(#3492) // TODO(jteplitz602): Replace this with the definition in lib.webworker.d.ts(#3492)
export interface PostMessageTarget { export interface PostMessageTarget {
postMessage: (message: any, transfer?: [ArrayBuffer]) => void; postMessage: (message: any, transfer?: [ArrayBuffer]) => void;
} }

View File

@ -33,7 +33,7 @@ export function errorHandler(): ErrorHandler {
} }
// TODO(jteplitz602) remove this and compile with lib.webworker.d.ts (#3492) // TODO(jteplitz602): remove this and compile with lib.webworker.d.ts (#3492)
const _postMessage = { const _postMessage = {
postMessage: (message: any, transferrables?: [ArrayBuffer]) => { postMessage: (message: any, transferrables?: [ArrayBuffer]) => {
(<any>postMessage)(message, transferrables); (<any>postMessage)(message, transferrables);

View File

@ -9,7 +9,7 @@ source ${thisDir}/_travis-fold.sh
# Run unit tests for our tools/ directory # Run unit tests for our tools/ directory
travisFoldStart "test.unit.tools" travisFoldStart "test.unit.tools"
# TODO(i) could this be rolled into the tools tests above? why is it separate? # TODO(i): could this be rolled into the tools tests above? why is it separate?
travisFoldStart "test.unit.validate-commit-message" travisFoldStart "test.unit.validate-commit-message"
( (
cd tools/validate-commit-message cd tools/validate-commit-message

View File

@ -13,7 +13,7 @@ module.exports = (gulp) => () => {
const path = require('path'); const path = require('path');
return gulp return gulp
.src([ .src([
// todo(vicb): add .js files when supported // TODO(vicb): add .js files when supported
// see https://github.com/palantir/tslint/pull/1515 // see https://github.com/palantir/tslint/pull/1515
'./modules/**/*.ts', './modules/**/*.ts',
'./modules/**/*.js', './modules/**/*.js',
@ -34,7 +34,7 @@ module.exports = (gulp) => () => {
'!**/*.externs.js', '!**/*.externs.js',
// Ignore generated files due to lack of copyright header // Ignore generated files due to lack of copyright header
// todo(alfaproject): make generated files lintable // TODO(alfaproject): make generated files lintable
'!**/*.d.ts', '!**/*.d.ts',
'!**/*.ngfactory.ts', '!**/*.ngfactory.ts',
]) ])