Skip to content

Commit ef4a311

Browse files
committed
chore: run prettier on all tracked files
1 parent 62c30fc commit ef4a311

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1252
-1219
lines changed

.github/workflows/deploy-BETA.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- run: |
4343
git config --global user.name ${{ vars.USER_NAME }}
4444
git config --global user.email ${{ vars.USER_EMAIL }}
45-
- run: BETAID=$(date '+%Y%m%d%H%M') && npm version prerelease --preid="beta$BETAID"
45+
- run: npm version prerelease --preid="beta"
4646
shell: bash
4747
- run: npm publish --tag beta
4848
env:

src/data/CustomRuleExample.ts

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
1-
import { Flow, FlowAttribute, FlowType, IRuleDefinition, ResultDetails, RuleResult } from '../main/internals/internals';
2-
3-
export class CustomNamingConvention implements IRuleDefinition{
1+
import {
2+
Flow,
3+
FlowAttribute,
4+
FlowType,
5+
IRuleDefinition,
6+
ResultDetails,
7+
RuleResult,
8+
} from "../main/internals/internals";
49

10+
export class CustomNamingConvention implements IRuleDefinition {
511
name: string;
612
label: string;
713
description: string;
8-
type:string;
9-
supportedTypes:string[];
14+
type: string;
15+
supportedTypes: string[];
1016
isConfigurable: boolean;
1117
autoFixable: boolean;
1218
docRefs: any;
1319

14-
constructor(){
15-
this.name = 'CustomNamingConvention';
16-
this.label = 'Custom Naming Convention';
17-
this.description='custom execute function ';
18-
this.type = 'flow';
20+
constructor() {
21+
this.name = "CustomNamingConvention";
22+
this.label = "Custom Naming Convention";
23+
this.description = "custom execute function ";
24+
this.type = "flow";
1925
this.supportedTypes = FlowType.allTypes();
20-
this.isConfigurable = true;
26+
this.isConfigurable = true;
2127
this.autoFixable = false;
22-
2328
}
2429

2530
public execute(flow: Flow, options?: { expression: string }): RuleResult {
26-
27-
const conventionApplied = (flow.name)?.startsWith('AcmeCorp_]');
28-
return (!conventionApplied ?
29-
new RuleResult(this, [new ResultDetails(new FlowAttribute(flow.name, 'name', 'The Name needs to start with AcmeCorp_'))]) :
30-
new RuleResult(this, []));
31+
const conventionApplied = flow.name?.startsWith("AcmeCorp_]");
32+
return !conventionApplied
33+
? new RuleResult(this, [
34+
new ResultDetails(
35+
new FlowAttribute(flow.name, "name", "The Name needs to start with AcmeCorp_")
36+
),
37+
])
38+
: new RuleResult(this, []);
3139
}
3240
}

src/index.ts

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import {IRuleDefinition} from './main/interfaces/IRuleDefinition';
2-
import { IRulesConfig } from './main/interfaces/IRulesConfig';
3-
import { FixFlows } from './main/libs/FixFlows';
4-
import { GetRuleDefinitions } from './main/libs/GetRuleDefinitions';
5-
import { ParseFlows } from './main/libs/ParseFlows';
6-
import { ScanFlows } from './main/libs/ScanFlows';
7-
import {Flow} from './main/models/Flow';
8-
import { ParsedFlow } from './main/models/ParsedFlow';
9-
import {ResultDetails} from './main/models/ResultDetails';
10-
import {RuleResult} from './main/models/RuleResult';
11-
import {ScanResult} from './main/models/ScanResult';
1+
import { IRuleDefinition } from "./main/interfaces/IRuleDefinition";
2+
import { IRulesConfig } from "./main/interfaces/IRulesConfig";
3+
import { FixFlows } from "./main/libs/FixFlows";
4+
import { GetRuleDefinitions } from "./main/libs/GetRuleDefinitions";
5+
import { ParseFlows } from "./main/libs/ParseFlows";
6+
import { ScanFlows } from "./main/libs/ScanFlows";
7+
import { Flow } from "./main/models/Flow";
8+
import { ParsedFlow } from "./main/models/ParsedFlow";
9+
import { ResultDetails } from "./main/models/ResultDetails";
10+
import { RuleResult } from "./main/models/RuleResult";
11+
import { ScanResult } from "./main/models/ScanResult";
1212

1313
export function getRules(ruleNames?: string[]): IRuleDefinition[] {
1414
if (ruleNames && ruleNames.length > 0) {
15-
const ruleSeverityMap = new Map<string, string>(ruleNames.map((name) => [name, 'error']));
15+
const ruleSeverityMap = new Map<string, string>(ruleNames.map((name) => [name, "error"]));
1616
return GetRuleDefinitions(ruleSeverityMap);
1717
} else {
1818
return GetRuleDefinitions();
@@ -23,13 +23,10 @@ export function parse(selectedUris: any): Promise<ParsedFlow[]> {
2323
return ParseFlows(selectedUris);
2424
}
2525

26-
27-
2826
export function scan(parsedFlows: ParsedFlow[], ruleOptions?: IRulesConfig): ScanResult[] {
29-
3027
let flows: Flow[] = [];
31-
for(let flow of parsedFlows){
32-
if(!flow.errorMessage && flow.flow){
28+
for (let flow of parsedFlows) {
29+
if (!flow.errorMessage && flow.flow) {
3330
flows.push(flow.flow);
3431
}
3532
}
@@ -62,33 +59,35 @@ export function scan(parsedFlows: ParsedFlow[], ruleOptions?: IRulesConfig): Sca
6259
return scanResults;
6360
}
6461

65-
export function fix(results : ScanResult[]): ScanResult[] {
66-
62+
export function fix(results: ScanResult[]): ScanResult[] {
6763
let newResults = [];
68-
for (let result of results){
69-
if(result.ruleResults && result.ruleResults.length > 0){
70-
let fixables:RuleResult[] = result.ruleResults.filter((r) => r.ruleName === 'UnusedVariable' && r.occurs || r.ruleName === 'UnconnectedElement' && r.occurs );
71-
if(fixables && fixables.length > 0){
64+
for (let result of results) {
65+
if (result.ruleResults && result.ruleResults.length > 0) {
66+
let fixables: RuleResult[] = result.ruleResults.filter(
67+
(r) =>
68+
(r.ruleName === "UnusedVariable" && r.occurs) ||
69+
(r.ruleName === "UnconnectedElement" && r.occurs)
70+
);
71+
if (fixables && fixables.length > 0) {
7272
const newFlow: Flow = FixFlows(result.flow, fixables);
7373
result.flow = newFlow;
7474
newResults.push(result);
7575
}
7676
}
77-
7877
}
7978

80-
return newResults
79+
return newResults;
8180
}
8281

83-
export { Flow } from './main/models/Flow';
84-
export { FlowAttribute } from './main/models/FlowAttribute';
85-
export { FlowElement } from './main/models/FlowElement';
86-
export { FlowNode } from './main/models/FlowNode';
87-
export { FlowResource } from './main/models/FlowResource';
88-
export { FlowType } from './main/models/FlowType';
89-
export { FlowVariable } from './main/models/FlowVariable';
90-
export { Compiler } from './main/libs/Compiler';
91-
export { ScanResult } from './main/models/ScanResult';
92-
export { RuleResult } from './main/models/RuleResult';
93-
export { ResultDetails } from './main/models/ResultDetails';
94-
export { IRuleDefinition } from './main/interfaces/IRuleDefinition';
82+
export { Flow } from "./main/models/Flow";
83+
export { FlowAttribute } from "./main/models/FlowAttribute";
84+
export { FlowElement } from "./main/models/FlowElement";
85+
export { FlowNode } from "./main/models/FlowNode";
86+
export { FlowResource } from "./main/models/FlowResource";
87+
export { FlowType } from "./main/models/FlowType";
88+
export { FlowVariable } from "./main/models/FlowVariable";
89+
export { Compiler } from "./main/libs/Compiler";
90+
export { ScanResult } from "./main/models/ScanResult";
91+
export { RuleResult } from "./main/models/RuleResult";
92+
export { ResultDetails } from "./main/models/ResultDetails";
93+
export { IRuleDefinition } from "./main/interfaces/IRuleDefinition";

src/main/interfaces/IExceptions.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export interface IExceptions {
2-
[exceptionName: string]: {
3-
[property: string]: any[];
4-
};
5-
}
6-
2+
[exceptionName: string]: {
3+
[property: string]: any[];
4+
};
5+
}

src/main/interfaces/IRuleConfig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export interface IRuleConfig {
2-
severity?: string;
3-
path?: string;
4-
}
2+
severity?: string;
3+
path?: string;
4+
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import {Flow} from '../models/Flow';
2-
import {RuleResult} from '../models/RuleResult';
1+
import { Flow } from "../models/Flow";
2+
import { RuleResult } from "../models/RuleResult";
33

44
export interface IRuleDefinition {
55
name: string;
66
label: string;
77
description: string;
88
supportedTypes: string[];
9-
docRefs: { label: string, path: string }[];
9+
docRefs: { label: string; path: string }[];
1010
isConfigurable: boolean;
1111
autoFixable: boolean;
1212
uri?: string;
1313
severity?: string;
1414

1515
execute(flow: Flow, ruleOptions?: {}): RuleResult;
16-
}
16+
}

src/main/interfaces/IRuleOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { IRuleConfig } from "./IRuleConfig";
22

33
export interface IRuleOptions {
44
[ruleName: string]: IRuleConfig;
5-
}
5+
}

src/main/interfaces/IRulesConfig.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { IExceptions } from "./IExceptions";
22
import { IRuleOptions } from "./IRuleOptions";
33

44
export interface IRulesConfig {
5-
rules?: IRuleOptions;
6-
exceptions?: IExceptions;
7-
}
8-
5+
rules?: IRuleOptions;
6+
exceptions?: IExceptions;
7+
}

src/main/internals/internals.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import {IRuleDefinition} from "../interfaces/IRuleDefinition";
2-
import {IRulesConfig} from "../interfaces/IRulesConfig";
3-
import {Compiler} from "../libs/Compiler";
4-
import {Flow} from "../models/Flow";
5-
import {FlowAttribute} from "../models/FlowAttribute";
6-
import {FlowElement} from "../models/FlowElement";
7-
import {FlowType} from "../models/FlowType";
8-
import {FlowNode} from "../models/FlowNode";
9-
import {FlowResource} from "../models/FlowResource";
10-
import {FlowVariable} from "../models/FlowVariable";
11-
import {ResultDetails} from "../models/ResultDetails";
12-
import {RuleResult} from "../models/RuleResult";
13-
import {ScanResult} from "../models/ScanResult";
1+
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
2+
import { IRulesConfig } from "../interfaces/IRulesConfig";
3+
import { Compiler } from "../libs/Compiler";
4+
import { Flow } from "../models/Flow";
5+
import { FlowAttribute } from "../models/FlowAttribute";
6+
import { FlowElement } from "../models/FlowElement";
7+
import { FlowType } from "../models/FlowType";
8+
import { FlowNode } from "../models/FlowNode";
9+
import { FlowResource } from "../models/FlowResource";
10+
import { FlowVariable } from "../models/FlowVariable";
11+
import { ResultDetails } from "../models/ResultDetails";
12+
import { RuleResult } from "../models/RuleResult";
13+
import { ScanResult } from "../models/ScanResult";
1414

1515
export {
1616
FlowAttribute,
@@ -25,5 +25,5 @@ export {
2525
RuleResult,
2626
ResultDetails,
2727
IRuleDefinition,
28-
IRulesConfig
29-
};
28+
IRulesConfig,
29+
};

src/main/libs/BuildFlow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { convertFlowNodes } from './ConvertFlowNodes';
1+
import { convertFlowNodes } from "./ConvertFlowNodes";
22

33
export function BuildFlow(nodesToMerge) {
44
let res = {};
55
for (const nodeToMerge of nodesToMerge) {
66
const subtype = nodeToMerge.subtype;
7-
const nodesOfType = nodesToMerge.filter(node => subtype === node.subtype);
7+
const nodesOfType = nodesToMerge.filter((node) => subtype === node.subtype);
88
res = convertFlowNodes(res, nodesOfType, subtype);
99
}
1010
return res;

0 commit comments

Comments
 (0)