Skip to content

Commit

Permalink
fix: API uses in tests, paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jubnzv committed Oct 24, 2024
1 parent 070b6d5 commit 587667e
Show file tree
Hide file tree
Showing 12 changed files with 589 additions and 587 deletions.
2 changes: 1 addition & 1 deletion examples/implicit-init/test/implicitInit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("ImplicitInit Detector Tests", () => {
"tactConfig.json",
);
const config = path.resolve(__dirname, "project", "mistiConfig.json");
const driver = await Driver.create(tactConfigPath, { config });
const driver = await Driver.create([tactConfigPath], { config });

expect(driver.detectors.length).toBe(1);
expect(driver.detectors[0].id).toBe("ImplicitInit");
Expand Down
2 changes: 1 addition & 1 deletion src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function createMistiCommand(): Command {
.name("misti")
.description("TON Static Analyzer")
.version(`Misti ${MISTI_VERSION}\nSupported Tact version: ${TACT_VERSION}`)
.arguments("<PATH>");
.arguments("[paths...]");
cliOptions.forEach((option) => command.addOption(option));
command.action(async (_tactPath, options) => {
if (options.listTools) {
Expand Down
9 changes: 5 additions & 4 deletions src/cli/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ export class Driver {
const cu = createIR(this.ctx, projectName, ast, importGraph);
acc.set(projectName, cu);
} else {
importGraph = ImportGraphBuilder.make(this.ctx, [tactPath]).build();
configManager = TactConfigManager.fromConfig(tactPath);
importGraph = ImportGraphBuilder.make(
this.ctx,
configManager.getEntryPoints(),
).build();
configManager.getProjects().forEach((configProject) => {
const ast = parseTactProject(
this.ctx,
Expand Down Expand Up @@ -285,9 +288,7 @@ export class Driver {
*/
public async execute(): Promise<MistiResult> {
if (this.cus.size === 0) {
throw ExecutionException.make(
"Please specify a path to a Tact project or Tact contract",
);
return { kind: "ok" };
}
if (this.detectors.length === 0 && this.tools.length === 0) {
this.ctx.logger.warn(
Expand Down
4 changes: 2 additions & 2 deletions src/internals/tact/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ export class TactConfigManager {
}

/**
* Returns the entry points specified in the Tact configuration file (existent or not).
* Returns absolute paths to entry points specified in the Tact configuration file.
*/
public getEntryPoints(): string[] {
return this.config.projects.map((p) => p.path);
return this.config.projects.map((p) => this.resolveProjectPath(p.path));
}
}
3 changes: 2 additions & 1 deletion src/tools/dumpImports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ToolOutput } from "../cli/result";
import { CompilationUnit, ImportGraph } from "../internals/ir";
import { unreachable } from "../internals/util";
import JSONbig from "json-bigint";
import path from "path";

interface DumpImportGraphOptions extends Record<string, unknown> {
format: "dot" | "json" | "mmd";
Expand Down Expand Up @@ -191,7 +192,7 @@ class JSONDumper {
idx: node.idx,
name: node.name,
origin: node.origin,
importPath: node.importPath,
importPath: path.relative(process.cwd(), node.importPath),
language: node.language,
hasContract: node.hasContract,
inEdges: Array.from(node.inEdges),
Expand Down
230 changes: 115 additions & 115 deletions test/all/sample-jetton.cfg.dot

Large diffs are not rendered by default.

Loading

0 comments on commit 587667e

Please sign in to comment.