Skip to content

Commit

Permalink
lint-fix: handle linter erros
Browse files Browse the repository at this point in the history
  • Loading branch information
EagleoutIce committed Feb 25, 2024
1 parent 6122dfa commit 06a376c
Show file tree
Hide file tree
Showing 28 changed files with 59 additions and 57 deletions.
5 changes: 3 additions & 2 deletions src/benchmark/benchmark-slicer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ import fs from 'fs'
import { log, LogLevel } from '../util/log'
import type { MergeableRecord } from '../util/objects'
import { withoutWhitespace } from '../util/strings'
import {SteppingSlicer} from "../core/stepping-slicer";
import {LAST_STEP, StepResult, STEPS} from "../core/steps/steps";
import { SteppingSlicer } from '../core/stepping-slicer'
import type { StepResult, STEPS } from '../core/steps/steps'
import { LAST_STEP } from '../core/steps/steps'

export const benchmarkLogger = log.getSubLogger({ name: 'benchmark' })

Expand Down
2 changes: 1 addition & 1 deletion src/cli/repl/commands/cfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { RShell } from '../../../r-bridge'
import { requestFromInput } from '../../../r-bridge'
import { extractCFG } from '../../../util/cfg/cfg'
import { cfgToMermaid, cfgToMermaidUrl } from '../../../util/mermaid'
import {SteppingSlicer} from "../../../core/stepping-slicer";
import { SteppingSlicer } from '../../../core/stepping-slicer'

async function controlflow(shell: RShell, remainingLine: string) {
return await new SteppingSlicer({
Expand Down
2 changes: 1 addition & 1 deletion src/cli/repl/commands/dataflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
graphToMermaid,
graphToMermaidUrl
} from '../../../util/mermaid'
import {SteppingSlicer} from "../../../core/stepping-slicer";
import { SteppingSlicer } from '../../../core/stepping-slicer'

async function dataflow(shell: RShell, remainingLine: string) {
return await new SteppingSlicer({
Expand Down
2 changes: 1 addition & 1 deletion src/cli/repl/commands/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { prepareParsedData } from '../../../r-bridge/lang-4.x/ast/parser/json/fo
import { convertPreparedParsedData } from '../../../r-bridge/lang-4.x/ast/parser/json/parser'
import { attributesKey, childrenKey, contentKey } from '../../../r-bridge/lang-4.x/ast/parser/xml'
import { extractLocation, getTokenType, objectWithArrUnwrap } from '../../../r-bridge/lang-4.x/ast/parser/xml/common/meta'
import {SteppingSlicer} from "../../../core/stepping-slicer";
import { SteppingSlicer } from '../../../core/stepping-slicer'

type DepthList = { depth: number, node: XmlBasedJson, leaf: boolean }[]

Expand Down
6 changes: 3 additions & 3 deletions src/cli/repl/server/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import { defaultQuadIdGenerator } from '../../../util/quads'
import { PARSE_WITH_R_SHELL_STEP } from '../../../core/steps/all/core/00-parse'
import { NORMALIZE } from '../../../core/steps/all/core/10-normalize'
import { LEGACY_STATIC_DATAFLOW } from '../../../core/steps/all/core/20-dataflow'
import {SteppingSlicer} from "../../../core/stepping-slicer";
import {StepResults} from "../../../core/steps/output";
import {LAST_STEP, STEPS_PER_SLICE} from "../../../core/steps/steps";
import { SteppingSlicer } from '../../../core/stepping-slicer'
import type { StepResults } from '../../../core/steps/output'
import { LAST_STEP, STEPS_PER_SLICE } from '../../../core/steps/steps'

/**
* Each connection handles a single client, answering to its requests.
Expand Down
4 changes: 2 additions & 2 deletions src/cli/repl/server/messages/analysis.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IdMessageBase, MessageDefinition } from './messages'
import Joi from 'joi'
import type { ControlFlowInformation } from '../../../../util/cfg/cfg'
import {StepResults} from "../../../../core/steps/output";
import {LAST_PER_FILE_STEP} from "../../../../core/steps/steps";
import type { StepResults } from '../../../../core/steps/output'
import type { LAST_PER_FILE_STEP } from '../../../../core/steps/steps'

/**
* Send by the client to request an analysis of a given file.
Expand Down
4 changes: 2 additions & 2 deletions src/cli/repl/server/messages/slice.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { SlicingCriteria } from '../../../../slicing'
import type { IdMessageBase, MessageDefinition } from './messages'
import * as Joi from 'joi'
import {StepResults} from "../../../../core/steps/output";
import {LAST_PER_FILE_STEP, LAST_STEP} from "../../../../core/steps/steps";
import type { StepResults } from '../../../../core/steps/output'
import type { LAST_PER_FILE_STEP, LAST_STEP } from '../../../../core/steps/steps'

/**
* Can only be sent after you have sent the {@link FileAnalysisRequestMessage}.
Expand Down
7 changes: 4 additions & 3 deletions src/core/stepping-slicer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { LEGACY_STATIC_DATAFLOW } from './steps/all/core/20-dataflow'
import { STATIC_SLICE } from './steps/all/static-slicing/00-slice'
import { NAIVE_RECONSTRUCT } from './steps/all/static-slicing/10-reconstruct'
import { PipelineExecutor } from './pipeline-executor'
import {LAST_PER_FILE_STEP, LAST_STEP, StepName} from "./steps/steps";
import {SteppingSlicerInput} from "./steps/input";
import {PipelineStepName, PipelineStepStage} from "./steps/step";
import type { LAST_PER_FILE_STEP, StepName } from './steps/steps'
import { LAST_STEP } from './steps/steps'
import type { SteppingSlicerInput } from './steps/input'
import type { PipelineStepName, PipelineStepStage } from './steps/step'

const legacyPipelines = {
// brrh, but who cares, it is legacy!
Expand Down
2 changes: 1 addition & 1 deletion src/core/steps/all/core/00-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { internalPrinter, StepOutputFormat } from '../../../print/print'
import { parseToQuads } from '../../../print/parse-printer'
import type { IPipelineStep } from '../../step'
import { PipelineStepStage } from '../../step'
import { RParseRequest, RShell} from '../../../../r-bridge'
import type { RParseRequest, RShell } from '../../../../r-bridge'
import type { DeepReadonly } from 'ts-essentials'
import type { RShellExecutor } from '../../../../r-bridge/shell-executor'
import { retrieveParseDataFromRCode } from '../../../../r-bridge'
Expand Down
2 changes: 1 addition & 1 deletion src/core/steps/all/core/10-normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { PipelineStepStage } from '../../step'
import type { DeepPartial, DeepReadonly } from 'ts-essentials'
import type { ParseRequiredInput } from './00-parse'
import { normalize as normalizeV2 } from '../../../../r-bridge/lang-4.x/ast/parser/xml/v2/normalize'
import {normalize as oldNormalize } from "../../../../r-bridge/lang-4.x/ast/parser/json/parser";
import { normalize as oldNormalize } from '../../../../r-bridge/lang-4.x/ast/parser/json/parser'

export interface NormalizeRequiredInput extends ParseRequiredInput {
/** These hooks only make sense if you at least want to normalize the parsed R AST. They can augment the normalization process */
Expand Down
5 changes: 3 additions & 2 deletions src/r-bridge/lang-4.x/ast/parser/json/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import { deepMergeObject } from '../../../../../util/objects'
import type { Entry } from './format'
import { RootId, prepareParsedData } from './format'
import { log } from '../../../../../util/log'
import {DEFAULT_PARSER_HOOKS, ParserData, XmlParserHooks} from "../xml/v1";
import {normalizeRootObjToAst} from "../xml/v1/internal";
import type { ParserData, XmlParserHooks } from '../xml/v1'
import { DEFAULT_PARSER_HOOKS } from '../xml/v1'
import { normalizeRootObjToAst } from '../xml/v1/internal'

export const parseLog = log.getSubLogger({ name: 'ast-parser' })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { normalizeSingleToken } from '../single-element'
export function tryNormalizeIfThenElse(
config: NormalizeConfiguration,
tokens: [
ifToken: XmlBasedJson,
leftParen: XmlBasedJson,
condition: XmlBasedJson,
rightParen: XmlBasedJson,
then: XmlBasedJson,
elseToken: XmlBasedJson,
elseBlock: XmlBasedJson
ifToken: XmlBasedJson,
leftParen: XmlBasedJson,
condition: XmlBasedJson,
rightParen: XmlBasedJson,
then: XmlBasedJson,
elseToken: XmlBasedJson,
elseBlock: XmlBasedJson
]): RFunctionCall | undefined {
// we start by parsing a regular if-then structure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import type { NormalizeConfiguration } from '../../data'
export function tryNormalizeIfThen(
config: NormalizeConfiguration,
tokens: readonly [
ifToken: XmlBasedJson,
leftParen: XmlBasedJson,
condition: XmlBasedJson,
rightParen: XmlBasedJson,
then: XmlBasedJson
ifToken: XmlBasedJson,
leftParen: XmlBasedJson,
condition: XmlBasedJson,
rightParen: XmlBasedJson,
then: XmlBasedJson
]): RFunctionCall | undefined {
const names = tokens.map(x => getTokenType(x))
if(names[0] !== RawRType.If) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { normalizeComment } from '../other'
import { normalizeSingleToken } from '../single-element'
import { splitComments } from '../../../v1/internal'
import { tryNormalizeSymbolNoNamespace } from '../values/symbol'
import {childrenKey} from "../../../input-format";
import { childrenKey } from '../../../input-format'

export function tryNormalizeFor(
config: NormalizeConfiguration,
Expand Down
2 changes: 1 addition & 1 deletion src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { RExpressionList, RNode } from '../../../../model'
import { RawRType, RType } from '../../../../model'
import { normalizeExpression } from './expression'
import { normalizeLog } from '../normalize'
import {childrenKey} from "../../input-format";
import { childrenKey } from '../../input-format'

export function normalizeRoot(
config: NormalizeConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { guard } from '../../../../../../../util/assert'
import { normalizeComment } from './other'
import { normalizeLineDirective } from './other/line-directive'
import { getTokenType } from '../../common/meta'
import {childrenKey, contentKey} from "../../input-format";
import { childrenKey, contentKey } from '../../input-format'

const todo = (...x: unknown[]) => {
throw new Error('not implemented: ' + JSON.stringify(x))

Check warning on line 17 in src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/single-element.ts

View check run for this annotation

Codecov / codecov/patch

src/r-bridge/lang-4.x/ast/parser/xml/v2/internal/single-element.ts#L17

Added line #L17 was not covered by tests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { XmlBasedJson } from '../../../common/input-format'
import {getTokenType, retrieveMetaStructure} from '../../../common/meta'
import { getTokenType, retrieveMetaStructure } from '../../../common/meta'
import type { RSymbol } from '../../../../../model'
import { isSymbol, RType } from '../../../../../model'
import { startAndEndsWith } from '../../../../../../../../util/strings'
import type { NormalizeConfiguration } from '../../data'
import {contentKey} from "../../../input-format";
import { contentKey } from '../../../input-format'

// remove backticks from symbol

Expand Down
4 changes: 2 additions & 2 deletions src/statistics/statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { log } from '../util/log'
import type { MetaStatistics } from './meta-statistics'
import { initialMetaStatistics } from './meta-statistics'
import { jsonReplacer, jsonRetriever } from '../util/json'
import {StepResults} from "../core/steps/output";
import {SteppingSlicer} from "../core/stepping-slicer";
import type { StepResults } from '../core/steps/output'
import { SteppingSlicer } from '../core/stepping-slicer'

/**
* By default, {@link extractUsageStatistics} requires a generator, but sometimes you already know all the files
Expand Down
14 changes: 7 additions & 7 deletions test/functionality/_helper/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import type { MergeableRecord } from '../../../src/util/objects'
// map flowr ids to the capabilities
const TheGlobalLabelMap: DefaultMap<string, string[]> = new DefaultMap(() => [])

const uniqueTestId = (() => {
/*const uniqueTestId = (() => {
let id = 0
return () => `${id++}`
})()
})()*/


export type TestLabelContext = 'parse' | 'desugar' | 'dataflow'
Expand All @@ -38,11 +38,11 @@ export interface TestLabel extends MergeableRecord {
*/
export function label(testname: string, ...ids: FlowrCapabilityId[]): string {
const capabilities: Set<FlowrCapabilityId> = new Set(ids)
const label: TestLabel = {
id: uniqueTestId(),
name: testname,
capabilities
}
/* const label: TestLabel = {
id: uniqueTestId(),
name: testname,
capabilities
}*/

for(const i of capabilities) {
TheGlobalLabelMap.get(i).push(testname)
Expand Down
4 changes: 2 additions & 2 deletions test/functionality/_helper/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import { PARSE_WITH_R_SHELL_STEP } from '../../../src/core/steps/all/core/00-par
import type { DESUGAR_NORMALIZE, NORMALIZE } from '../../../src/core/steps/all/core/10-normalize'
import type { DataflowGraph } from '../../../src/dataflow/v1'
import { diffGraphsToMermaidUrl, graphToMermaidUrl } from '../../../src/dataflow/v1'
import {SteppingSlicer} from "../../../src/core/stepping-slicer";
import {LAST_STEP} from "../../../src/core/steps/steps";
import { SteppingSlicer } from '../../../src/core/stepping-slicer'
import { LAST_STEP } from '../../../src/core/steps/steps'

export const testWithShell = (msg: string, fn: (shell: RShell, test: Mocha.Context) => void | Promise<void>): Mocha.Test => {
return it(msg, async function(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion test/functionality/dataflow/graph/equal-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { DataflowGraph } from '../../../../src/dataflow/v1'
import { diffGraphsToMermaidUrl, EdgeType } from '../../../../src/dataflow/v1'
import { diffGraphsToMermaidUrl } from '../../../../src/dataflow/v1'
import { assert } from 'chai'
import { emptyGraph } from '../../_helper/dataflowgraph-builder'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { MIN_VERSION_PIPE } from '../../../../../src/r-bridge/lang-4.x/ast/model
import { label } from '../../../_helper/label'
import { emptyGraph } from '../../../_helper/dataflowgraph-builder'
import { unnamedArgument } from '../../../_helper/environment-builder'
import { SupportedFlowrCapabilityId } from '../../../../../src/r-bridge/data';
import type { SupportedFlowrCapabilityId } from '../../../../../src/r-bridge/data'

describe('Atomic (dataflow information)', withShell(shell => {
describe('Uninteresting Leafs', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { assertDataflow, withShell } from '../../../_helper/shell'
import { DataflowGraph, EdgeType, initializeCleanEnvironments } from '../../../../../src/dataflow/v1'
import { EdgeType, initializeCleanEnvironments } from '../../../../../src/dataflow/v1'
import { define, popLocalEnvironment, pushLocalEnvironment } from '../../../../../src/dataflow/common/environments'
import { UnnamedArgumentPrefix } from '../../../../../src/dataflow/v1/internal/process/functions/argument'
import { UnnamedFunctionCallPrefix } from '../../../../../src/dataflow/v1/internal/process/functions/function-call'
import { LocalScope } from '../../../../../src/dataflow/common/environments/scopes'
import { MIN_VERSION_LAMBDA } from '../../../../../src/r-bridge/lang-4.x/ast/model/versions'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertDataflow, withShell } from '../../../_helper/shell'
import { DataflowGraph, EdgeType, initializeCleanEnvironments } from '../../../../../src/dataflow/v1'
import { initializeCleanEnvironments } from '../../../../../src/dataflow/v1'
import { appendEnvironments, define } from '../../../../../src/dataflow/common/environments'
import { LocalScope } from '../../../../../src/dataflow/common/environments/scopes'
import { emptyGraph } from '../../../_helper/dataflowgraph-builder'
Expand Down
4 changes: 2 additions & 2 deletions test/functionality/flowr/server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import type {
ExecuteRequestMessage
} from '../../../src/cli/repl/server/messages/repl'
import { extractCFG } from '../../../src/util/cfg/cfg'
import {SteppingSlicer} from "../../../src/core/stepping-slicer";
import {LAST_PER_FILE_STEP} from "../../../src/core/steps/steps";
import { SteppingSlicer } from '../../../src/core/stepping-slicer'
import { LAST_PER_FILE_STEP } from '../../../src/core/steps/steps'

describe('flowr', () => {
describe('Server', withShell(shell => {
Expand Down
2 changes: 1 addition & 1 deletion test/functionality/r-bridge/lang/ast/parse-hooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { retrieveNormalizedAst, withShell } from '../../../_helper/shell'
import { assert } from 'chai'
import { requestFromInput } from '../../../../../src/r-bridge'
import {SteppingSlicer} from "../../../../../src/core/stepping-slicer";
import { SteppingSlicer } from '../../../../../src/core/stepping-slicer'

describe('Check hooks are called appropriately', withShell(shell => {
it('Call the number hook!', async() => {
Expand Down
2 changes: 1 addition & 1 deletion test/functionality/util/control-flow-graph-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { requestFromInput, RFalse, RTrue, RType } from '../../../src/r-bridge'
import { defaultQuadIdGenerator } from '../../../src/util/quads'
import { cfgToMermaidUrl } from '../../../src/util/mermaid'
import {SteppingSlicer} from "../../../src/core/stepping-slicer";
import { SteppingSlicer } from '../../../src/core/stepping-slicer'

describe('Control Flow Graph', withShell(shell => {
function assertCfg(code: string, partialExpected: Partial<ControlFlowInformation>) {
Expand Down
2 changes: 1 addition & 1 deletion test/functionality/util/quads-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { decorateAst, requestFromInput, RType } from '../../../src/r-bridge'
import { defaultQuadIdGenerator, serialize2quads } from '../../../src/util/quads'
import { assert } from 'chai'
import { dataflowGraphToQuads } from '../../../src/core/print/dataflow-printer'
import {SteppingSlicer} from "../../../src/core/stepping-slicer";
import { SteppingSlicer } from '../../../src/core/stepping-slicer'

describe('Quads', withShell(shell => {
const context = 'test'
Expand Down

0 comments on commit 06a376c

Please sign in to comment.