Skip to content

Commit

Permalink
Various minor code cleanups, from WebStorm
Browse files Browse the repository at this point in the history
  • Loading branch information
lyricnz committed Dec 27, 2024
1 parent b882938 commit beb7b2f
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion drivers/ebs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { type InstrumentedResource, ToolingInterface } from './instrumentedResou
import { ec2Tagger } from './tags.js';

class InstrumentedEBS extends ToolingInterface {
private volumeARN: string;
private readonly volumeARN: string;

constructor(resource: CreateVolumeCommandOutput, volumeARN: string) {
super(resource);
Expand Down
2 changes: 1 addition & 1 deletion drivers/ec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { type InstrumentedResource, ToolingInterface } from './instrumentedResou
import { ec2Tagger } from './tags.js';

class InstrumentedEc2 extends ToolingInterface {
private instanceARN: string;
private readonly instanceARN: string;

constructor(resource: Instance, instanceARN: string) {
super(resource);
Expand Down
4 changes: 2 additions & 2 deletions drivers/instrumentedResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface InstrumentedResource {
export abstract class ToolingInterface implements InstrumentedResource {
public resource: any;
public actions: RevolverAction[];
private meta: any;
private readonly meta: any;

constructor(awsResource: any) {
this.resource = awsResource;
Expand All @@ -41,7 +41,7 @@ export abstract class ToolingInterface implements InstrumentedResource {
}
// Try and see if we already have an action that can swallow this one
for (const xa of this.actions.filter((xxa) => xxa.what === action.what)) {
if (xa.swallow(action) === true) {
if (xa.swallow(action)) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/redshiftClusterSnapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { type InstrumentedResource, ToolingInterface } from './instrumentedResou

class InstrumentedRedshiftClusterSnapshot extends ToolingInterface {
public tags: Tag[] = [];
private snapshotARN: string;
private readonly snapshotARN: string;

constructor(resource: Cluster, snapshotARN: string) {
super(resource);
Expand Down
2 changes: 1 addition & 1 deletion lib/assume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface Creds {
}

class RemoteCredentials {
private creds: { [key: string]: Creds };
private readonly creds: { [key: string]: Creds };

constructor() {
this.creds = {};
Expand Down
1 change: 1 addition & 0 deletions lib/objectLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ abstract class AbstractOutputWriter {
}

// here as reference, unused
// noinspection JSUnusedLocalSymbols
private static decompress(compressedB64: string): string {
return zlib.inflateSync(Buffer.from(compressedB64, 'base64')).toString('utf-8');
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/parsers/strict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class ParsedAvailability {

function startOrStop(tag: string, timeNow: DateTime) {
const t = new ParsedAvailability(tag);
if (t.override === true) {
if (t.override) {
return ['NOOP', 'Availability override'];
} else if (t.available === '24x7') {
return ['START', 'Availability 24x7'];
Expand Down
8 changes: 4 additions & 4 deletions plugins/powercycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { RevolverPlugin } from './pluginInterface.js';
*/
export default class PowerCyclePlugin extends RevolverPlugin {
private parser: any;
private scheduleTagName: string;
private timezoneTagName: string;
private warningTagName: string;
private reasonTagName: string;
private readonly scheduleTagName: string;
private readonly timezoneTagName: string;
private readonly warningTagName: string;
private readonly reasonTagName: string;
protected supportedResources = [
'ec2',
'rdsCluster',
Expand Down
2 changes: 1 addition & 1 deletion revolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function main(config: any) {
}

// Filter final accounts list to be processed
const filteredAccountsList = await RevolverConfig.filterAccountsList(orgsAccountsList, config);
const filteredAccountsList = RevolverConfig.filterAccountsList(orgsAccountsList, config);

// Try to assume role on the listed accounts and remove from the list if fails
logger.info('Caching STS credentials...');
Expand Down
6 changes: 3 additions & 3 deletions test/lib/resourceLog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { ObjectLogCsv, ObjectLogHtml, ObjectLogJson, ObjectLogTable, ResourceTab

// A dummy AWS resource for testing
class FakeResource extends ToolingInterface {
private myResourceId: string;
private myResourceType: string;
private myResourceState: string;
private readonly myResourceId: string;
private readonly myResourceType: string;
private readonly myResourceState: string;
constructor(resourceId: string, resourceType: string, resourceState: string, resource: any) {
super(resource);
this.myResourceId = resourceId;
Expand Down
4 changes: 3 additions & 1 deletion tools/showSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ const zeroPad = (num: any, places: number) => String(num).padStart(places, '0');

/**
* Evaluate the schedule for every interval in the window and return a list of time:results.
* @param parser
* @param schedule a Revolver schedule string
* @param startTime when to start the test window
* @param testInterval how long between test steps
* @param testDuration total test duration
* @returns a Map of DateTime to boolean representing "matches schedule"
*/
async function runSchedule(
Expand All @@ -43,7 +46,6 @@ async function runSchedule(
/**
* Evaluate the schedule every `interval` within the `window` and print a table with results.
* @param schedule a Revolver schedule string
* @param startTime when to start the test window
* @returns a Map of DateTime to boolean representing "matches schedule"
*/
async function showSchedule(schedule: string) {
Expand Down

0 comments on commit beb7b2f

Please sign in to comment.