Skip to content

Add a mypy-esque cache to Ratter #13

@BPHarris

Description

@BPHarris

What

Ratter should cache it's IR for each Python source file to a JSON file, this cache should be invalidated if-and-when the source file's hash or the Ratter version changes, and when the file "passes" analysis.

This is distinct from the existing results cache created via --cache.

Cache Location

For a source file /path/to/dir/source.py, the cache should be stored in /path/to/dir/.ratter/cache/source.json.

Todo

This will require:

  • Versioning info in Ratter
  • Update the existing results cache (i.e. --cache, now --save-results) to also invalidate on version
  • A decided, consistent structure to the cache (i.e. where the cache should be in relation to the source file)
  • Prioritise reading the cache before processing again (prioritisation should be memory, cache, newly process)
  • Tests
  • Security notice on pickle/jsonpickle (+ info in --no-cache CLI arg)

Finally, the following changes must then be made:

  • Update CLI #15
    • --cache should become --save-results
    • --no-cache to not use IR cache
    • --force-refresh-cache to forcibly refresh the cache
  • Update CLI documentation

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions