Col-E / Col-E/Recaf

Metadata tagging

Open
#306 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
7.4k
Forks
538
PR merge metrics
No merged PRs in 30d

Description

## Metadata tagging

Recaf should allow metadata to be attached to both classes _(Maybe even specific fields/methods)_ and files. My current thinking is:

1. **Tags** - Things like `networking` / `io` / `gui` / `entry-point` etc to indicate behavior
2. **Key-value pairs** - Useful if the user wants to tag things in groups, they can then look for items with the key and see the different values for all matched items

### Automatic tagging

Some degree of tagging should be automated. For this, Recaf should be able to declare rules that when matched, assign metadata to the matched item. For example:

Rules can include:
- `Any reference to X`
- `Any reference to a type with tag T`
- `Parent in hierarchy contains X`
- `Parent in hierarchy contains a type with tag T`
- `N count of T tagged references`
- `P percent of tagged items match T tag`
- `ContainsString S with matchmode M`
- `>= file size S`
- `<= file size S`
- `== file size S`
- `likely obfuscated`

Design concerns:
- Tagging the current resources must not interfere with rules, so if `java.net.Downloader` is tagged `T` and we tag an incoming class `Example` as `T` this should not affect `N count of T` sorts of rules.

Default rules:
- Recaf can supply a default set of rules for classes in the JDK

Custom rules:
- In addition to explicitly declaring types, allow users to tag entire maven-artifacts. For example, tag `okhttp` as `networking` so any reference to a class from `okhttp` will can contribute to rules that rely on references to tagged items

How rules get applied:
- When Recaf opens a workspace, run the rules on all items of the primary resource
- When a class is added to the primary resource _(or renamed)_ run it on the class

### UI Integration

The workspace navigator should allow something like:
- `meta>networking` to list all classes tagged with networking
- `meta

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.