Code Dryer banner

Code Dryer

7 devlogs
5h 32m 32s

Search your codebase for logical repetitions with semantic search. Stay DRY!

This project uses AI

ChatGPT used for research and ideation
Copilot used for code completion and debugging

Demo Repository

Loading README...

Efe
  • Added README
  • Added icon and updated package.json with repo and author information
Attachment
0
Efe
  • Added support for comparisons across multiple files
  • Fixed a few bugs with normalization:
  1. When a literal and a variable was close to each other edits overlapped and one got corrupted
  2. Keyword arguments were taken as variables, fixed that.
  3. In Python type annotations were also being mistaken for variables, fix that too.
  • Added a slider to the similarities view to allow the user to change the cut off similarity.
Attachment
Attachment
Attachment
0
Efe
  • Added support for top level code chunk (i.e. not in any function or class). Currently, it is counted as a chunk if, it is between 2 functions/classes or there are one or more new lines between sections.
  • Also now we are filtering out low similarities, this should have been added at the beggining.

I think after improving the normalization and adding multi-file support this project will be ready to ship yay But there is only 17 hours left fear

Attachment
0
Efe
  • Added code comment removal for further normalization of the code
  • In the webview the normalized code was shown for no reason, now it shows the raw source code.
  • Created the simplest proxy server for embeddings and deployed it to Railway.
Attachment
Attachment
0
Efe

Displaying the similarities

I added a webview that displays the similar functions when you run DRY Code command


Also improved the embeddings similarities logic: no duplicates any more

Attachment
0
Efe

Embeddings and comparisons

I implemented the the embedding creation, storage, caching and comparison.
Embeddings are calculated thanks to HCAI, they are then stored locally. When something changes or a new function is added they are recalculated (of course only the ones needed).
The problem I have is that I was using a hard-coded key for development. I probably gonna need to make a simple proxy backend too sob-wx

Attachment
0
Efe

Parser implementation

In order to compare functions and classes I first need to identify them.
Getting this part to work was much harder than I expected. I first tried doing this with VS Code’s language server but that didn’t go as I expected. So, I switched to tree-sitter. To be honest, I relied a bit more on AI than usual in this part.

Attachment
0