Refsearch
Experimental system including RefactoringMiner, RefDiff, and UI for searching refactoring instances
Install / Use
/learn @salab/RefsearchREADME
RefSearch
Demonstration Video
Installation
Requirements
- Any linux distribution
- Confirmed working at Ubuntu 22.04.3 LTS
- docker
- Confirmed working at 24.0.5
- docker compose plugin v2
- Confirmed working at v2.20.2
- make (optional)
Setup
- Launch the app
make up- or equivalently,
docker compose --compatibility up -d --build
- Go to http://localhost:8080/ to view the app.
- See "Usage" below for how to use the app.
- Stop the app
make down- or equivalently,
docker compose down
Development
Usage
Detect and Load Refactorings from Repository
From the "jobs" page, submit URL of the repository from which you want to detect refactorings.
e.g. https://github.com/gradle/gradle
Once submitted, RefSearch runners will automatically pick the jobs up (wait 1 minute at max), and start detecting refactorings using RefactoringMiner and RefDiff.
While RefSearch in itself is language-agnostic, since these detector tools only (mainly) support Java, only Java refactorings are detected.
View Detected Refactorings
View all detected refactoring instances from the "refactorings" page.
<img src='./docs/images/refactorings.png' width='500'>You can search refactorings by:
- Refactoring Type recognized by RefactoringMiner and RefDiff.
- Some of the "overlapping" refactoring types with RefactoringMiner and RefDiff have the same type.
- SHA1 commit hash in which the refactoring was detected.
- The search box supports prefix matching.
- URL of the repository in which the refactoring was detected.
- The search box uses exact match.
- Other metadata included in refactoring data.
- Nested fields are chained with dot (
.).- e.g.
extractMethod.sourceMethodsCount
- e.g.
- Conditions are chained with
&or|.- e.g.
type = "Extract Method" & before.location.lines >= 100
- e.g.
- Nested fields are chained with dot (
This example is based on refactoring detected by RefDiff. Some fields may differ from refactorings detected by RefactoringMiner.
{
"_id": "6449778cdfdd69f120621e7e",
"type": "Extract Method",
"description": "Extracted method getBuildInitTestFramework(UserInputHandler, BuildInitializer, ModularizationOption) from setupProjectLayout()",
"sha1": "44eac67d00c122f1c6c9b6d8eb3b4aceeca38e21",
"repository": "https://github.com/gradle/gradle",
"url": "https://github.com/gradle/gradle/commit/44eac67d00c122f1c6c9b6d8eb3b4aceeca38e21",
"meta": {
"tool": "RefDiff"
},
"commit": {
"date": "2023-01-03T15:17:08.000Z",
"message": "refactoring",
"refs": "",
"body": "- part of: #22682\n\nSigned-off-by: <redacted>\n",
"authorName": "<redacted>",
"authorEmail": "<redacted>",
"url": "https://github.com/gradle/gradle/commit/44eac67d00c122f1c6c9b6d8eb3b4aceeca38e21",
"size": {
"files": {
"changed": 11
},
"lines": {
"inserted": 354,
"deleted": 327
}
},
"refactorings": {
"total": 68,
"perType": {
"Extract Method": 21,
"Rename Method": 2,
"Change Return Type": 4,
"Remove Parameter": 6,
"Remove Method Annotation": 13,
"Change Method Access Modifier": 1,
"Add Method Modifier": 1,
"Merge Conditional": 1,
"Replace Loop With Pipeline": 1,
"Pull Up Method": 12,
"Extract And Move Method": 2,
"Change Signature": 4
},
"perTool": {
"RefactoringMiner": 53,
"RefDiff": 15
}
},
"tools": {
"RefactoringMiner": "ok",
"RefDiff": "ok"
}
},
"before": {
"type": "Method",
"name": "setupProjectLayout()",
"location": {
"file": "subprojects/build-init/src/main/java/org/gradle/buildinit/tasks/InitBuild.java",
"begin": "181:5",
"end": "302:6",
"bodyBegin": "182:39",
"bodyEnd": "302:5",
"lines": 121
}
},
"after": {
"type": "Method",
"name": "getBuildInitTestFramework(UserInputHandler, BuildInitializer, ModularizationOption)",
"location": {
"file": "subprojects/build-init/src/main/java/org/gradle/buildinit/tasks/InitBuild.java",
"begin": "260:5",
"end": "278:6",
"bodyBegin": "260:170",
"bodyEnd": "278:5",
"lines": 19
}
},
"extractMethod": {
"sourceMethodsCount": 1,
"sourceMethodLines": 121,
"extractedLines": 19
}
}
</details>
View Refactorings per Commit
View refactorings detected in one commit, by clicking "view commit" button in refactoring details page.
<img src='./docs/images/details-to-commit.png' width='300'>Alternatively, you can directly search commits instead of refactorings, from the "commits" page. The same query syntax can be used against commits metadata.
<details> <summary>Example of Commit Metadata</summary>{
"_id": "44eac67d00c122f1c6c9b6d8eb3b4aceeca38e21",
"date": "2023-01-03T15:17:08.000Z",
"message": "refactoring",
"refs": "",
"body": "- part of: #22682\n\nSigned-off-by: <redacted>\n",
"authorName": "<redacted>",
"authorEmail": "<redacted>",
"url": "https://github.com/gradle/gradle/commit/44eac67d00c122f1c6c9b6d8eb3b4aceeca38e21",
"repository": "https://github.com/gradle/gradle",
"size": {
"files": {
"changed": 11
},
"lines": {
"inserted": 354,
"deleted": 327
}
},
"refactorings": {
"total": 68,
"perType": {
"Extract Method": 21,
"Rename Method": 2,
"Change Return Type": 4,
"Remove Parameter": 6,
"Remove Method Annotation": 13,
"Change Method Access Modifier": 1,
"Add Method Modifier": 1,
"Merge Conditional": 1,
"Replace Loop With Pipeline": 1,
"Pull Up Method": 12,
"Extract And Move Method": 2,
"Change Signature": 4
},
"perTool": {
"RefactoringMiner": 53,
"RefDiff": 15
}
},
"tools": {
"RefactoringMiner": "ok",
"RefDiff": "ok"
}
}
</details>
View Repository Metadata
View registered repository and its refactorings count from "repository" page.
<details> <summary>Example of Repository Metadata</summary>{
"_id": "https://github.com/gradle/gradle",
"commits": 93385,
"refactorings": {
"total": 301186,
"perType": {
"Rename Method": 18204,
"Change Return Type": 15429,
"Change Method Access Modifier": 4918,
"Change Signature": 37156,
"Extract Variable": 3662,
"Split Parameter": 322,
"Split Attribute": 236,
"Rename Variable": 5081,
"Rename Attribute": 4964,
"Rename Parameter": 11147,
"Extract Interface": 683,
"Pull Up Method": 6663,
"Extract Superclass": 2236,
"Replace Attribute With Variable": 459,
"Move Method": 14145,
"Move and Rename Method": 643,
"Change Parameter Type": 23701,
"Remove Class Modifier": 711,
"Change Variable Type": 12499,
"Rename Class": 6830,
"Change Attribute Type": 10496,
"Pull Up Signature": 1726,
"Add Parameter": 17424,
"Change Class Access Modifier": 1758,
"Add Class Annotation": 1967,
"Add Method Annotation": 14475,
"Inline Method": 2568,
"Remove Parameter": 9485,
"Localize Parameter": 623,
"Merge Variable": 110,
"Encapsulate Attribute": 1031,
"Modify Method Annotation": 170,
"Extract Method": 10016,
"Move And Inline Method": 697,
"Inline Variable": 1393,
"Extract Class": 901,
"Move Attribute": 3051,
"Move Class": 12006,
"Move And Rename Method": 1170,
"Extract And Move Method": 1165,
"Extract and Move Method": 1944,
"Add Thrown Exception Type": 629,
"Parameterize Variable": 990,
"Add Attribute Modifier": 1858,
"Remove Class Annotation": 1375,
"Remove Attribute Modifier": 866,
"Change Attribute Access Modifier": 1883,
"Push Down Attribute": 704,
"Push Down Method": 3178,
"Add Method Modifier": 1045,
"Replace Variable With Attribute": 712,
"Merge Attribute": 269,
"Merge Parameter": 500,
"Move Interface": 1820,
"Modify Class Annotation": 238,
"Change Thrown Exception Type": 216,
"Remove Method Modifier": 584,
"Pull Up Attribute": 988,
"Extract Attribute": 407,
"Change Type Declaration Kind": 313,
"Remove Method Annotation": 4284,
"Extract Subclass": 213,
"Push Down Impl": 680,
"Rename Interface": 878,
"Parameterize Attribute": 169,
"Rename Package": 122,
"Move Package": 143,
"Move And Rename Class": 890,
"Add Variable Modifier": 709,
"Move and Rename Class": 556,
"Move Enum": 132,
"Split Class": 37,
"Remove Thrown Exception Type": 715,
"Add Parameter Modifier": 1245,
"Remove Variable Modifier": 678,
"Remove Parameter Modifier": 880,
"Move and Rename Interface": 98,
"Split Package": 32,
"Add Class Modifier": 890,
"Move Source Folder": 921,
"Merge Class": 56,
"Invert Condition": 147,
"Merge Method": 17,
"Replace Attribute": 13,
"Split Method": 31,
"Add Attribute Annotation": 242,
"Split Conditional": 116,
"Reorder Parameter": 310,
"Rename Enum": 62,
"Move And Rename Attribute": 76,
"Merge Package": 20,
"Inline Attribute": 34,
"Split Variable": 35,
"Merge Conditional": 61,
"Remove Attribute Annotation": 198,
"Add Variable Annotation": 88,
"Collapse Hierarchy": 53,
"Add Parameter Annotation": 1390,
"Remove Parameter Annotation": 394,
"Remove Variable Annotation": 40,
"Modify P
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

