Skip to content

Commit 9ff332b

Browse files
Design and apply a proper interface and structure (#18)
As discussed in #16 this makes a few changes to separate all logic and make it easier to test the units, reason about the flow and implement new behaviour: * Input: any source of input, implementations are FileInput, DirectoryInput and InlineInput. They can provide 0 to many source files to be parsed * Output: an analysis output in the raw format, has toProcessable in order to turn it into something the official interface expects (a json formatted file) OutputProcessor: like a chain, calls the previous processor and can make changes, implementations are: LogOutput, FileOutput and a noop PassThroughOutput. I'd like this to be more like a middleware in the future. * Analyzer: only has run(input: Input): Promise<Output> * Runner: only has call(analyzer: Analyzer, input: Input, options: Readonly<ExecutionOptions>): Promise<Output> The runner is just a simple way to take the ExecutionOptions and apply certain OutputProcessors or not, it's not longer vital to use at all. Each Analyzer can act on an AST by parsing the Input they get via a parser. Each analyzer can define their own parser and options, but we provide sane defaults. The default parser uses @typescript-eslint/typescript-estree. The base implementation of the Analyzer no longer knows about parsing at all. Additionally the bin/batch(-runner) and bin/stat(istic)s scripts have been rewritten utilising the new structure.
1 parent 86324e4 commit 9ff332b

Some content is hidden

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

48 files changed

+897
-678
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib"
3+
}

bin/analyze.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@REM Usage:
2-
@REM ./bin/analyze.bat two_fer ~/test/
2+
@REM ./bin/analyze.bat two-fer ~/test/
33

44
node -r esm ./dist/analyze.js %*

bin/analyze.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22

33
# Usage:
4-
# ./bin/analyze.sh two_fer ~/test/
4+
# ./bin/analyze.sh two-fer ~/folder/to/solution
55

66
node -r esm ./dist/analyze.js "$@"

bin/batch-runner

Lines changed: 0 additions & 166 deletions
This file was deleted.

bin/batch.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@REM Usage:
2+
@REM ./bin/batch.bat two-fer
3+
4+
node -r esm ./dist/batch.js %*

bin/batch.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
3+
# Usage:
4+
# ./bin/batch.sh two-fer
5+
6+
node -r esm ./dist/batch.js "$@"

bin/statistics

Lines changed: 0 additions & 85 deletions
This file was deleted.

bin/stats.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@REM Usage:
2+
@REM ./bin/stats.bat two-fer
3+
4+
node -r esm ./dist/stats.js %*

bin/stats.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
3+
# Usage:
4+
# ./bin/stats.sh two-fer
5+
6+
node -r esm ./dist/stats.js "$@"

docs/.keep

Whitespace-only changes.

0 commit comments

Comments
 (0)