https://github.com/exercism/typescript-analyzer
This is Exercism's automated analyzer for the TypeScript track.
https://github.com/exercism/typescript-analyzer
community-contributions-paused exercism-analyzer exercism-tooling maintained-autonomous
Last synced: 2 months ago
JSON representation
This is Exercism's automated analyzer for the TypeScript track.
- Host: GitHub
- URL: https://github.com/exercism/typescript-analyzer
- Owner: exercism
- License: mit
- Created: 2019-03-18T20:10:19.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T07:12:08.000Z (10 months ago)
- Last Synced: 2025-04-29T06:28:14.836Z (2 months ago)
- Topics: community-contributions-paused, exercism-analyzer, exercism-tooling, maintained-autonomous
- Language: TypeScript
- Homepage:
- Size: 1.08 MB
- Stars: 5
- Watchers: 9
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# @exercism/typescript-analyzer
[](https://github.com/exercism/typescript-analyzer/actions/workflows/ci.js.yml)
[](https://github.com/exercism/typescript-analyzer/actions/workflows/deploys.yml)Runs static analysis using [`@exercism/static-analysis`][git-static-analysis] on exercises from the [`@exercism/typescript` track][git-typescript].
## Installation
Clone this repository and then run:
```bash
yarn install
```You'll need at least Node LTS for this to work.
```
yarn build
```## Usage
You can run this either via `yarn`:
```
yarn analyze:bat --debug --console two-fer ~/path/to/solution/folder
```Or directly via the provided shell script:
```
./bin/analyze.sh --debug --console two-fer ~/path/to/solution
```Add the `--debug` and `--console` flags to get output in the terminal window.
### Using docker
To create the image, execute the following command from the repository root:
```bash
docker build -t exercism/typescript-analyzer .
```To `run` from docker pass in the solutions path as a volume and execute with the necessary parameters:
```bash
docker run -v $(PATH_TO_SOLUTION):/solution exercism/typescript-analyzer ${SLUG} /solution
```Example:
```bash
docker run -v ~/solution-238382y7sds7fsadfasj23j:/solution exercism/typescript-analyzer two-fer /solution
```## Tools
We use various tools to maintain this repository and this analyzer.
In order to contribute to the _code_ of this track, you'll need NodeJS (LTS or higher) installed, with some of the [`bin/*`][file-bin] files having extra dependencies, as listed in their file-level commentary.### `analyze` (.sh, .bat)
```shell
./bin/analyze.sh two-fer ~/folder/to/solution -dcp
```This runs the analyzer using `two-fer` as exercise and a path to a solution.
Most scripts, including this one, accept a wide range of flags to change or enhance the behaviour, as coded in [`execution_options.ts`][file-execution-options].Run with the `-h` / `--help` flag to get a list of flags and their description.
```shell
./bin/analyze.sh --help
```You'll most likely want `-dcp` (`--debug`,`--console` and `--pretty`) during development, which enables console output (instead of `stdout`/`stderr`) and shows `logger.log` as well as `logger.error` and `logger.fatal`.
It will also format the output JSON with 2 space indentation, both in the output file and the console.If you wish to _preview_ the actual messages, pass in `--noTemplates` to use the analyzer `Comment`Factories to generate actual messages.
If the comment factories are kept in-sync with `website-copy`, it will be the exact same output as on the site.### `batch` (.sh, .bat)
```shell
./bin/batch.sh two-fer -cp
```Runs all the fixtures in `~/test/fixtures/two-fer` through the analyzer, giving a summary at the end with all results.
This places an `analysis.json` in the source fixture folder.You'll most likely want `-cp` (`--console` and `--pretty`) during development, which enables console output (instead of `stdout`/`stderr`) and formats the
output JSON with 2 space indentation.If you wish to _preview_ the actual messages, pass in `--noTemplates` to use the analyzer `Comment`Factories to generate actual messages.
If the comment factories are kept in-sync with `website-copy`, it will be the exact same output as on the site.### `remote` (.sh, .bat)
```shell
./bin/remote.sh https://exercism.io/tracks/typescript/exercises/two-fer/solutions/41ff482d158e4a708677d1ccac0af013 -dcp --dry
```You need the [`exercism` cli][cli] in order for this to work. It takes an _exercism solution url_ and downloads it using the `exercism` cli.
It then runs the analyzer on it.You'll most likely want `-dcp --dry` (`--debug`, `--pretty`, `--console` and `dry run`) during development, which enables console output (instead of
`stdout`/`stderr`), shows `logger.log` as well as `logger.error` and `logger.fatal`, pretty prints the JSON output and disables writing the output
to `analysis.json`.You can pass the following type of URLs:
- Published solutions: `/tracks/typescript/exercises//`
- Mentor solutions: `/mentor/solutions/`
- Your solutions: `/my/solutions/`
- Private solutions: `/solutions/`If you wish to _preview_ the actual messages, pass in `--noTemplates` to use the analyzer `Comment`Factories to generate actual messages.
If the comment factories are kept in-sync with `website-copy`, it will be the exact same output as on the site.[cli]: https://github.com/exercism/cli
[git-static-analysis]: https://github.com/exercism/javascript-lib-static-analysis
[git-typescript]: https://github.com/exercism/typescript
[file-bin]: https://github.com/exercism/typescript-analyzer/bin
[file-execution-options]: https://github.com/exercism/typesccript-analyzer/src/utils/execution_options.ts