Skip to content

Commit

Permalink
lint(query): fix linting issues - #1107
Browse files Browse the repository at this point in the history
  • Loading branch information
gigalasr committed Jan 28, 2025
1 parent fd534fa commit b154465
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/documentation/print-query-wiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ With this query you can use flowR's alias-tracking capabilities to resolve ident
Using the example code \`${exampleCode}\`, the following query returns all values of 'x' in the code:
${
await showQuery(shell, exampleCode, [{
type: 'resolve-value',
criteria: ["2@x"]
type: 'resolve-value',
criteria: ['2@x']
}], { showCode: true })
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function executeResolveValueQuery({ dataflow: { graph, environment } }: B

const values = query.criteria
.map(criteria => recoverName(slicingCriterionToId(criteria, idMap), idMap))
.flatMap(ident => resolveToValues(ident, environment, graph))
.flatMap(ident => resolveToValues(ident, environment, graph));

results[key] = {
values: [... new Set(values)]
Expand Down
15 changes: 7 additions & 8 deletions test/functionality/dataflow/query/resolve-value-query.test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { assertQuery } from '../../_helper/query';
import { label } from '../../_helper/label';
import type { DataflowQuery } from '../../../../src/queries/catalog/dataflow-query/dataflow-query-format';
import { withShell } from '../../_helper/shell';
import { assert, describe } from 'vitest';
import { ResolveValueQuery, ResolveValueQueryResult } from '../../../../src/queries/catalog/resolve-value-query/resolve-value-query-format';
import type { ResolveValueQuery, ResolveValueQueryResult } from '../../../../src/queries/catalog/resolve-value-query/resolve-value-query-format';
import { fingerPrintOfQuery } from '../../../../src/queries/catalog/resolve-value-query/resolve-value-query-executor';
import { resolveToValues } from '../../../../src/dataflow/environments/resolve-by-name';
import { slicingCriterionToId } from '../../../../src/slicing/criterion/parse';
import { recoverName } from '../../../../src/r-bridge/lang-4.x/ast/model/processing/node-id';

describe.sequential('Resolve Value Query', withShell(shell => {
function testQuery(name: string, code: string, queries: readonly ResolveValueQuery[]) {
assertQuery(label(name), shell, code, queries, ({dataflow}) => {
assertQuery(label(name), shell, code, queries, ({ dataflow }) => {
const results: ResolveValueQueryResult['results'] = {};

const idMap = dataflow.graph.idMap;
assert(idMap !== undefined);

for (const query of queries) {
for(const query of queries) {
const key = fingerPrintOfQuery(query);
const identifiers = query.criteria
.map(criteria => slicingCriterionToId(criteria, idMap))
Expand All @@ -28,15 +27,15 @@ describe.sequential('Resolve Value Query', withShell(shell => {

results[key] = {
values: [... new Set(values)]
}
};
}

return {
'resolve-value': { results }
}
};
});
}

testQuery('Single dataflow', 'x <- 1', [{ type: 'resolve-value', criteria: ["1@x"] }]);
testQuery('Multiple Queries', 'x <- 1', [{ type: 'resolve-value', criteria: ["1@x"] }, { type: 'resolve-value', criteria: ["1@x"] }, { type: 'resolve-value', criteria: ["1@x"] }]);
testQuery('Single dataflow', 'x <- 1', [{ type: 'resolve-value', criteria: ['1@x'] }]);
testQuery('Multiple Queries', 'x <- 1', [{ type: 'resolve-value', criteria: ['1@x'] }, { type: 'resolve-value', criteria: ['1@x'] }, { type: 'resolve-value', criteria: ['1@x'] }]);
}));

0 comments on commit b154465

Please sign in to comment.