https://github.com/exercism/elixir-representer
https://github.com/exercism/elixir-representer
community-contributions-accepted exercism-representer exercism-tooling maintained
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/exercism/elixir-representer
- Owner: exercism
- License: agpl-3.0
- Created: 2020-01-19T11:17:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-01T01:08:29.000Z (3 months ago)
- Last Synced: 2025-04-29T06:28:30.644Z (about 1 month ago)
- Topics: community-contributions-accepted, exercism-representer, exercism-tooling, maintained
- Language: Elixir
- Size: 171 KB
- Stars: 11
- Watchers: 9
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Representer
To understand the purpose of this project in the context of the exercism submission platform, there are a few documents to review:
- [Introduction to Representers](https://github.com/exercism/docs/tree/main/building/tooling/representers)
- [Creating a Representer](https://github.com/exercism/docs/blob/main/building/tooling/representers/creating-from-scratch.md)
- [The Representer Interface](https://github.com/exercism/docs/blob/main/building/tooling/representers/interface.md)
- [How to normalize representations for the highest efficiency](https://github.com/exercism/docs/blob/main/building/tooling/representers/normalization.md)
- [Docker image build and deployment](https://github.com/exercism/docs/blob/main/building/tooling/representers/docker.md)## Why
Code analysis is tough, and the programming required to create them is complex. Initially the goal of the exercism platform was to provide automated analysis on a wide scale. But while this proved to be successful at a small scale (for now), it also served to prove how complex they are.
So rather than attempting to provide automated analysis, we attempt to normalize submissions to distill the solutions to the general approaches taken, provide feedback on the normalized subset, then memoize the feedback so that when a recongnized solution pattern is submitted, feedback can be replayed from the previous submissions.
## Normalization
The role of this service is to take a code submission, and normalize it in the following ways:
- format using `mix format`, enforcing _do...end_ blocks
- removing comments
- normalizing `@doc` and `@moduledoc` documentation
- normalize module, variable, function names and maintain a mapping from the original to the placeholder names
- this is done by analyzing the source using the ast representation to find the names to replace
- then doing a textual find/replace on the source using the mapping## Escript
> `lib/representer/cli.ex`
This is the entrypoint for an escript to process the relevant files from the command line.
## Git submodule
Some of the tests depend on the `/elixir` git submodule. Run `git submodule update --init --recursive` once after cloning this repo to also get the submodule.
To check at which commit the submodule is, run `git submodule`. To update the submodule to the newest commit, run `git submodule update --remote --merge`.
The submodule is used only by the tests.