Skip to content

Commit

Permalink
fix: fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
WitoDelnat committed Sep 7, 2023
1 parent f45d6a1 commit 35a3999
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ const ProblemRenderer: React.FC<IProps> = props => {
)}
</div>

<Tooltip
mouseEnterDelay={TOOLTIP_DELAY}
title={groupByFilterValue === 'group-by-file' ? 'File content line' : 'Resource content line'}
>
<ProblemStartLine $isSelected={isSelected}>
{
node.problem.locations[groupByFilterValue === 'group-by-file' ? 0 : 1].physicalLocation?.region
?.startLine
}
</ProblemStartLine>
</Tooltip>

<ProblemIcon level={node.problem.level ?? 'error'} style={{fontSize: '8px', marginRight: '-8px'}} />
<ProblemText $isSuppressed={suppressed || absent}>{node.problem.message.text}</ProblemText>
{suppressed ? '(suppressed)' : ''}
Expand Down
19 changes: 9 additions & 10 deletions packages/validation/src/MonokleValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ import {ResourceParser} from './common/resourceParser.js';
import type {Suppression, Tool, ValidationResponse, ValidationResult, ValidationRun} from './common/sarif.js';
import type {CustomSchema, Plugin, Resource} from './common/types.js';
import {Config} from './config/parse.js';
import {CIS_TAXONOMY, NSA_TAXONOMY} from './taxonomies';
import {CIS_TAXONOMY, NSA_TAXONOMY} from './taxonomies/index.js';
import {PluginMetadataWithConfig, PluginName, RuleMetadataWithConfig, ValidateParams, Validator} from './types.js';
import {nextTick, throwIfAborted} from './utils/abort.js';
import {extractSchema, findDefaultVersion} from './utils/customResourceDefinitions.js';
import {PluginLoadError} from './utils/error.js';
import invariant from './utils/invariant.js';
import {isDefined} from './utils/isDefined.js';
import {Fixer, Suppressor} from './sarif';
import {Fixer, Suppressor} from './sarif/index.js';
import {SuppressEngine} from './sarif/suppressions/engine.js';
import {SchemaLoader} from './validators';
import {SchemaLoader} from './validators/index.js';
import {PluginLoader} from './pluginLoaders/PluginLoader.js';
import {ValidationConfig} from '@monokle/types';
import {noop} from "lodash";
import {PluginContext} from "./pluginLoaders/types";
import {PluginContext} from './pluginLoaders/types.js';

export type ValidatorInit = {
loader: PluginLoader;
Expand Down Expand Up @@ -48,9 +47,9 @@ export class MonokleValidator implements Validator {
parser: init.parser,
fixer: init.fixer,
schemaLoader: init.schemaLoader,
}
};
this._suppressor = new SuppressEngine(init.suppressors ?? []);
if (config) this.preload(config).catch(noop);
if (config) this.preload(config).catch(() => {});
}

get config(): Config {
Expand Down Expand Up @@ -106,9 +105,9 @@ export class MonokleValidator implements Validator {
* @param config - the new configuration of the validator.
* @param suppressions - a list with suppression requests.
*/
async preload(config: Config, suppressions?: Suppression[]): Promise<void> {
this._config = config;
this._suppressions = suppressions || [];
async preload(config?: Config, suppressions?: Suppression[]): Promise<void> {
this._config = config ?? {};
this._suppressions = suppressions ?? [];
return this.load();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect, it} from 'vitest';
import {MonokleValidator} from '../MonokleValidator.js';
import {processRefs} from '../references';
import {processRefs} from '../references/index.js';

// Usage note: This library relies on fetch being on global scope!
import 'isomorphic-fetch';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect, it} from 'vitest';
import {MonokleValidator} from '../MonokleValidator.js';
import {processRefs} from '../references';
import {processRefs} from '../references/index.js';

// Usage note: This library relies on fetch being on global scope!
import 'isomorphic-fetch';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect, it} from 'vitest';
import {MonokleValidator} from '../MonokleValidator.js';
import {processRefs} from '../references';
import {processRefs} from '../references/index.js';

// Usage note: This library relies on fetch being on global scope!
import 'isomorphic-fetch';
Expand Down
2 changes: 1 addition & 1 deletion packages/validation/src/__tests__/MonokleValidator.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ajv from 'ajv';
import {expect, it} from 'vitest';
import {MonokleValidator} from '../MonokleValidator.js';
import {processRefs} from '../references';
import {processRefs} from '../references/index.js';

// Usage note: This library relies on fetch being on global scope!
import 'isomorphic-fetch';
Expand Down
2 changes: 1 addition & 1 deletion packages/validation/src/pluginLoaders/PluginLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
YamlValidator
} from '../validators';
import {PluginContext} from './types.js';
import {RemoteWasmLoader} from "../validators/open-policy-agent/wasmLoader/RemoteWasmLoader.node";
import {RemoteWasmLoader} from "../validators/open-policy-agent/wasmLoader/RemoteWasmLoader.browser";

export interface PluginLoader {
load(plugin: string, ctx: PluginContext, settings?: Record<string, any>): Plugin | Promise<Plugin>;
Expand Down

0 comments on commit 35a3999

Please sign in to comment.