Skip to content

Commit

Permalink
Autofix: trailing-spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-bot authored and jankeromnes committed Jun 9, 2021
1 parent b630003 commit e8762f2
Show file tree
Hide file tree
Showing 38 changed files with 85 additions and 85 deletions.
2 changes: 1 addition & 1 deletion components/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function App() {
</Route>
<Route path="*" render={
(match) => {

return isGitpodIo() ?
// delegate to our website to handle the request
(window.location.host = 'www.gitpod.io') :
Expand Down
4 changes: 2 additions & 2 deletions components/ee/db-sync/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const parser = new ArgumentParser({
addHelp: true,
description: "Process for synchronising a cache database with a central master"
});
const subparser = parser.addSubparsers({
const subparser = parser.addSubparsers({
title: 'commands',
dest: 'cmd'
});
Expand All @@ -38,7 +38,7 @@ container.load(productionContainerModule);

let commands = container.getAll(ICommand) as ICommand[];
commands.forEach(c => {
const cmdparser = subparser.addParser(c.name, {
const cmdparser = subparser.addParser(c.name, {
addHelp: true ,
help: c.help
});
Expand Down
2 changes: 1 addition & 1 deletion components/ee/payment-endpoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"devDependencies": {
"@types/body-parser": "^1.16.5",
"@types/jsonwebtoken": "^8.3.2",
"@types/passport-http": "^0.3.0",
"@types/passport-http": "^0.3.0",
"@types/chai": "^4.2.2",
"@types/node-fetch": "^2.5.0",
"chai": "^4.1.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ export class AccountServiceImpl implements AccountService {
// Gather all expected changes to our credits from now (statement.endDate) into the future
const projectedCreditChanges = this.projectCreditChanges(statement, considerNextPeriod);
const creditChangesSorted = new SortedArray(projectedCreditChanges, (c1, c2) => orderByDateAscPosFirst(c1, c2));

// Starting point: the credits we have now are the cummulated remainingAmounts of all credits in the statement
// that are still valid at statement.endDate
// that are still valid at statement.endDate
const creditsNow = statement.credits
.filter(c => within(statement.endDate, c))
.reduce((v, c) => (v + (c.remainingAmount !== undefined ? c.remainingAmount : c.amount)), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const end = new Date(Date.UTC(2000, 2, 1)).toISOString();

// The following is a bug where we did not calculate the current remainingHours properly.
// In case someone cancelled two subscriptions (with equal hours) + regular usage within on month time frame
// they would run out of hours, regardless of having an unlimited plan.
// they would run out of hours, regardless of having an unlimited plan.
const subscription = async (plan: Plan, startDate: string, endDate?: string) => {
const s = await this.accountingDb.newSubscription({
userId: 'Sven',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const s8 = { startDate: '2018-11-27T15:25:48.000Z', endDate: undefined } as Subs
expect([s1, s2].sort(orderByEndDateDescThenStartDateDesc)).to.deep.equal([s2, s1]);
expect([s2, s1].sort(orderByEndDateDescThenStartDateDesc)).to.deep.equal([s2, s1]);
}

@test test_orderByEndDateDescThenStartDateDesc_sameEndDate() {
expect([s2, s3].sort(orderByEndDateDescThenStartDateDesc)).to.deep.equal([s2, s3]);
expect([s3, s2].sort(orderByEndDateDescThenStartDateDesc)).to.deep.equal([s2, s3]);
}

@test test_orderByEndDateDescThenStartDateDesc_sameStartDate() {
expect([s1, s3].sort(orderByEndDateDescThenStartDateDesc)).to.deep.equal([s3, s1]);
expect([s3, s1].sort(orderByEndDateDescThenStartDateDesc)).to.deep.equal([s3, s1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class SortedArray<T> {
protected readonly comparator: (t1: T, t2: T) => number) {
this.array.sort(this.comparator);
}

push(t: T) {
this.array.push(t);
this.array.sort(this.comparator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ export class SubscriptionService {

return this.accountingDB.transaction(async db => {
await this.doUnsubscribe(db, userId, startDate, plan.chargebeeId);
const newSubscription = <Subscription> {
userId,
amount: Plans.getHoursPerMonth(plan),
planId: plan.chargebeeId,
paymentReference,
startDate,
const newSubscription = <Subscription> {
userId,
amount: Plans.getHoursPerMonth(plan),
planId: plan.chargebeeId,
paymentReference,
startDate,
endDate };
log.info({ userId }, 'Creating subscription', { subscription: newSubscription });
return db.newSubscription(newSubscription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface EventHandler<E> {
@injectable()
export class CompositeEventHandler {
@multiInject(EventHandler) @optional() protected readonly _handlers?: EventHandler<any>[];

async handle(event: any): Promise<boolean> {

const handlers = this._handlers || [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export namespace Chargebee {

// A more specific code allowing you to handle the specific errors.
api_error_code: string;

/**
* An optional attribute which is filled if the error was due to a specific parameter. The parameter name format that is sent is based on the underlying Chargebee's REST api format which can be referred in cURL api documentation.
* For example, in create subscription for a customer API call if the plan referred in the plan_id parameter is not present in the site, then param value set as plan_id. For 'multivalued' parameters , the index is part of the parameter name. For the same API, if the second addon id is wrongly passed then the param value is set as addons[id][2].
Expand Down Expand Up @@ -250,7 +250,7 @@ export namespace Chargebee {
applied_count: number;

/*
* The coupon code used to redeem the coupon.
* The coupon code used to redeem the coupon.
* Will be present only when associated code for a coupon is used.
*/
coupon_code?: string;
Expand Down Expand Up @@ -450,7 +450,7 @@ export namespace Chargebee {
export type PaymentSourceStatus = "valid" | "expiring" | "expired" | "invalid" | "pending_verification";
/** // There are a gazillion other types not listed here for brevity: https://apidocs.chargebee.com/docs/api/payment_sources#payment_source_gateway */
export type Gateway = "chargebee" | "stripe";

export interface BankAccount {
// not relevant yet
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class SubscriptionHandler implements EventHandler<chargebee.SubscriptionE
try {
await this.storeAdditionalData(event.content.subscription, event.content.invoice);
} catch(err) {
log.error(logContext, 'Failed to store additional subscription data', event);
log.error(logContext, 'Failed to store additional subscription data', event);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,14 @@ import { Plans, ABSOLUTE_MAX_USAGE } from '@gitpod/gitpod-protocol/lib/plans';
endDate: "2019-04-07T13:17:58.000Z",
cancellationDate: '2019-04-07T13:17:58.000Z',
amount: 100,
uid: '7f76687f-8b09-482b-b059-5779e51c3a44',
uid: '7f76687f-8b09-482b-b059-5779e51c3a44',
planId: "free"
},
{
userId: '643ac637-74ae-4f82-9a86-c8527eb1e496',
startDate: '2019-04-07T13:17:58.000Z',
amount: 5952,
uid: '7f76687f-8b09-482b-b059-5779e51c3a22',
uid: '7f76687f-8b09-482b-b059-5779e51c3a22',
planId: 'professional-eur',
paymentReference: '1mkVvmiRMxfTZj1JGs',
paymentData: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class TeamSubscriptionHandler implements EventHandler<chargebee.Subscript
}
return false;
}

async handleSingleEvent(event: chargebee.Event<chargebee.SubscriptionEventV2>): Promise<boolean> {
const chargebeeSubscription = event.content.subscription;
const userId = chargebeeSubscription.customer_id;
Expand Down
12 changes: 6 additions & 6 deletions components/ee/payment-endpoint/src/chargebee/upgrade-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export class UpgradeHelper {
/**
* Uses subscription.add_charge_at_term_end to 'manually' add a charge to the given Chargebee Subscription
* (see https://apidocs.chargebee.com/docs/api/subscriptions#add_charge_at_term_end)
*
* @param userId
* @param chargebeeSubscriptionId
* @param amountInCents
* @param description
* @param upgradeTimestamp
*
* @param userId
* @param chargebeeSubscriptionId
* @param amountInCents
* @param description
* @param upgradeTimestamp
*/
async chargeForUpgrade(userId: string, chargebeeSubscriptionId: string, amountInCents: number, description: string, upgradeTimestamp: string) {
const logContext: LogContext = { userId };
Expand Down
2 changes: 1 addition & 1 deletion components/ee/payment-endpoint/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const init = async () => {
const container = new Container();
container.load(productionContainerModule);
container.load(dbContainerModule);

const server = container.get(Server);
const app = express();

Expand Down
2 changes: 1 addition & 1 deletion components/gitpod-cli/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Create a Gitpod configuration for this project.
tasks:
- init: echo 'init script' # runs during prebuild
command: echo 'start script'
# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
ports:
- port: 3000
Expand Down
4 changes: 2 additions & 2 deletions components/gitpod-db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Contains all the database related functionality, implemented using [typeorm](htt

### Adding a new table
1. Create a [migration](./src/typeorm/migration/README.md) - use the [baseline](./src/typeorm/migration/1592203031938-Baseline.ts) as an exemplar
1. Create a new entity that implements the requisite interface or extend an existing entity as required - see [db-user.ts](./src/typeorm/entity/db-user.ts)
1. Create a new entity that implements the requisite interface or extend an existing entity as required - see [db-user.ts](./src/typeorm/entity/db-user.ts)
1. If it is a new table, create the matching injectable ORM implementation and interface (if required) - see [user-db-impl.ts](./src/typeorm/user-db-impl.ts) and [user-db.ts](./src/user-db.ts). Otherwise extend the existing interface and implementation as required.
1. Add the injectable implementation to the [DB container module](./src/container-module.ts), binding the interface and implementation as appropriate, otherwise it will not be instantiated correctly e.g.
1. Add the injectable implementation to the [DB container module](./src/container-module.ts), binding the interface and implementation as appropriate, otherwise it will not be instantiated correctly e.g.
```
bind(TypeORMUserDBImpl).toSelf().inSingletonScope();
bind(UserDB).toService(TypeORMUserDBImpl);
Expand Down
4 changes: 2 additions & 2 deletions components/gitpod-db/src/accounting-db.spec.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class AccountingDBSpec {
await manager.clear(DBSubscription);
await manager.clear(DBWorkspaceInstance);
await manager.clear(DBWorkspace);

this.queryRunner = connection.createQueryRunner();
await this.queryRunner.connect();
await this.queryRunner.startTransaction();
Expand Down Expand Up @@ -132,7 +132,7 @@ export class AccountingDBSpec {
expectExactlyOne(await this.db.findActiveSubscriptionsForUser(subscription.userId, later), subscription);
Subscription.cancelSubscription(dbSubscription, later);
await this.db.storeSubscription(dbSubscription);

expectExactlyOne(await this.db.findActiveSubscriptionsForUser(subscription.userId, rightBefore(later)), dbSubscription);
expect(await this.db.findActiveSubscriptionsForUser(subscription.userId, later)).to.be.an('array').and.empty;
}
Expand Down
2 changes: 1 addition & 1 deletion components/gitpod-db/src/typeorm/email-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class TypeORMEMailDBImpl implements EMailDB {

return await query.getMany();
}

async findEMailsByCampaignAndUserId(campaignId: string, userId: string): Promise<EMail[]> {
const repo = await this.getEMailRepo();
const qb = repo.createQueryBuilder('email')
Expand Down
8 changes: 4 additions & 4 deletions components/gitpod-db/src/typeorm/entity/db-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class DBSubscriptionAdditionalData {
transformer: Transformer.MAP_EMPTY_STR_TO_UNDEFINED
})
nextBilling?: string;

@Column({
type: 'timestamp',
precision: 6,
Expand All @@ -111,8 +111,8 @@ export interface CouponData {
coupon_id: string;

/*
* The date till the coupon is to be applied.
* Applicable for "limited months" coupons.
* The date till the coupon is to be applied.
* Applicable for "limited months" coupons.
* optional, timestamp(UTC) in seconds
*/
apply_till?: number;
Expand All @@ -123,7 +123,7 @@ export interface CouponData {
applied_count: number;

/*
* The coupon code used to redeem the coupon.
* The coupon code used to redeem the coupon.
* Will be present only when associated code for a coupon is used.
*/
coupon_code?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class TeamSubscriptionDBImpl implements TeamSubscriptionDB {
.andWhere('ts.endDate = "" OR ts.endDate > :date', { date: date });
return query.getMany();
}

async findTeamSubscriptions(partial: DeepPartial<TeamSubscription>): Promise<TeamSubscription[]> {
const repo = await this.getRepo();
return repo.find(partial);
Expand Down
2 changes: 1 addition & 1 deletion components/gitpod-db/src/typeorm/user-db-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export class TypeORMUserDBImpl implements UserDB {
const userAndToken = await this.findUserByGitpodToken(tokenHash);
if (userAndToken) {
// Yes, update it (~)
// NOTE(rl): as we don't support refresh tokens yet this is not really required
// NOTE(rl): as we don't support refresh tokens yet this is not really required
// since the OAuth server lib calls issueRefreshToken immediately after issueToken
// We do not allow changes of name, type, user or scope.
dbToken = userAndToken.token as GitpodToken & { user: DBUser };
Expand Down
2 changes: 1 addition & 1 deletion components/local-app-api/go/BUILD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ packages:
dontTest: false
deps:
- components/supervisor-api/go:lib

6 changes: 3 additions & 3 deletions components/server/ee/src/container-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import { MonitoringEndpointsApp } from "../../src/monitoring-endpoints";
import { WorkspaceHealthMonitoring } from "./workspace/workspace-health-monitoring";
import { EnvEE } from "./env";
import { Env } from "../../src/env";
import { AccountService } from "@gitpod/gitpod-payment-endpoint/lib/accounting/account-service";
import { AccountServiceImpl, SubscriptionService, TeamSubscriptionService } from "@gitpod/gitpod-payment-endpoint/lib/accounting";
import { ChargebeeProvider, ChargebeeProviderOptions, UpgradeHelper } from "@gitpod/gitpod-payment-endpoint/lib/chargebee";
import { AccountService } from "@gitpod/gitpod-payment-endpoint/lib/accounting/account-service";
import { AccountServiceImpl, SubscriptionService, TeamSubscriptionService } from "@gitpod/gitpod-payment-endpoint/lib/accounting";
import { ChargebeeProvider, ChargebeeProviderOptions, UpgradeHelper } from "@gitpod/gitpod-payment-endpoint/lib/chargebee";
import { ChargebeeCouponComputer } from "./user/coupon-computer";
import { ChargebeeService } from "./user/chargebee-service";
import { EligibilityService } from "./user/eligibility-service";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type CachedAccountStatement = Pick<AccountStatement, "remainingHours" | "
@injectable()
export class AccountStatementProvider {
@inject(AccountService) protected readonly accountService: AccountService;

protected cachedStatement: CachedAccountStatement | undefined;

setCachedStatement(cachedStatement: CachedAccountStatement) {
Expand Down
4 changes: 2 additions & 2 deletions components/server/ee/src/user/eligibility-service.spec.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const userServiceTestContainerModule = new ContainerModule((bind, unbind, isBoun
bind(ConsensusLeaderMessenger).to(InMemoryConsensusLeaderMessenger).inSingletonScope();
bindDbWithTracing(TracedWorkspaceDB, bind, WorkspaceDB).inSingletonScope();
bind(TracingManager).toSelf().inSingletonScope();

// TODO: something pulls in env which makes this test really difficult.
// How do we deal with this in other scenarios?
bind(Env).toSelf();
Expand All @@ -58,7 +58,7 @@ function getContainer() {
const userServiceTestContainer = testContainer.createChild();
userServiceTestContainer.load(userServiceTestContainerModule);
return userServiceTestContainer;
}
}

@suite.skip
export class EligibilityServiceSpec {
Expand Down
Loading

0 comments on commit e8762f2

Please sign in to comment.