Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
239 commits
Select commit Hold shift + click to select a range
b1b83f4
temporary data type fix for multi files
Sevhena Jan 25, 2025
2241185
updated readme with instructions for now
Ayushi1972 Jan 29, 2025
bf49447
fixed issue off highlighting entire line
Sevhena Jan 28, 2025
9b10f82
Updated smell detection functionality
Sevhena Jan 29, 2025
d59509c
Merge branch 'plugin-multi-file' of https://github.com/tbrar06/capsto…
Sevhena Jan 29, 2025
e71d6bf
Made updates to README.md
Sevhena Jan 29, 2025
019d57e
Update README.md
nivethakuruparan Jan 30, 2025
658bf96
bug fixes
Sevhena Jan 30, 2025
0572040
fixed bugs in type definitions
Sevhena Jan 30, 2025
7d6f5e7
Stage 1 adding difference UI
Jan 30, 2025
f3b6251
Merge branch 'plugin-multi-file' of https://github.com/ssm-lab/capsto…
Jan 30, 2025
3afbb70
Fixed smell data mismatch that caused refactorings to fail
Sevhena Jan 30, 2025
f95cd75
started working custom hover message
Ayushi1972 Jan 30, 2025
c3e1cde
changed refactorSmell.ts to refactor selected smell from hover Window
Ayushi1972 Jan 30, 2025
509480e
Fixed smells showing up multiple times in the same hover window
Ayushi1972 Jan 30, 2025
c9a942d
fixed extension.ts for refactorSmell() call
Ayushi1972 Jan 30, 2025
27e9146
refactor all smells of type button works
Ayushi1972 Jan 30, 2025
a02ede4
Merge branch 'plugin-multi-file' of https://github.com/ssm-lab/capsto…
Jan 30, 2025
0c4788b
Moved hashing to utils and added wipe cache cmd
Sevhena Jan 30, 2025
634b4bb
removed silly parameter
Ayushi1972 Jan 30, 2025
cc25823
Merge branch 'plugin-multi-file' of https://github.com/ssm-lab/capsto…
Jan 30, 2025
a6a5702
removed unnecessary parameter
Sevhena Jan 30, 2025
4c2859e
added back fixes that were lost
Sevhena Jan 30, 2025
1159bb7
fixed bug added multiple arrow decorations to multi smell line
Sevhena Jan 31, 2025
7292898
Merge branch 'plugin-multi-file' of https://github.com/ssm-lab/capsto…
Jan 31, 2025
dc0a6c9
Added Refactoring comparison functionality closes #353 in ecooptimize…
Jan 31, 2025
61a39e7
Updated refactoring diff view (ssm-lab/capstone--sco-vs-code-plugin#353)
Sevhena Feb 3, 2025
5cdba76
fixed issue where sidebar reloads on file navigation (ssm-lab/capston…
Sevhena Feb 3, 2025
8304af5
Updated refactor functionality to work with refactoring all smells
Sevhena Feb 3, 2025
123e04f
fixed bug where refactorings were deleted before they could be applied
Sevhena Feb 3, 2025
18226f0
Added functionality to highlight smells in different colours based on…
Sevhena Feb 4, 2025
45430bd
Fixed up refactorSmell not refactoring the selected smell line #345
Ayushi1972 Feb 6, 2025
bc8a385
fixed bug causing sidebar to throw and error after wiping cache
Sevhena Feb 6, 2025
1b80ed1
changed payload to send the actual workspace folder
Sevhena Feb 6, 2025
8650061
fixed refactorings not being applied to original files
Sevhena Feb 6, 2025
dbe1cb9
ssm-lab/capstone--source-code-optimizer#346 added contributes for so…
Feb 8, 2025
9df0642
ssm-lab/capstone--source-code-optimizer#346 added dialog on activate…
Feb 8, 2025
ddffa99
Added functionality for filtering and showing logs
nivethakuruparan Feb 9, 2025
6a0c860
ssm-lab/capstone--source-code-optimizer#346 added warning dialog for…
Feb 9, 2025
e4e618d
ssm-lab/capstone--source-code-optimizer#346 added reminder for missi…
Feb 9, 2025
8e012ce
Edited some setting configs ssm-lab/capstone--source-code-optimizer#346
Sevhena Feb 9, 2025
2d48954
Merge pull request #1 from ssm-lab/nivetha/logging_and_filtering
nivethakuruparan Feb 9, 2025
65e2e34
Merge branch 'plugin-config' into plugin-multi-file
Feb 9, 2025
569e72b
Fixed refactor error msgs and made logging automatic
Sevhena Feb 10, 2025
94f1d7d
ssm-lab/capstone--source-code-optimizer#346 removed unit test path, …
Feb 10, 2025
479f92b
Updated logging to use websockets and store in vscode built-in log dir
Sevhena Feb 17, 2025
59d718c
minor fixes and adjustments
Sevhena Feb 18, 2025
93f2788
fixed server url env variable + added settings popup feature
Sevhena Feb 18, 2025
c37e682
fix: explicitly close websockets on extension disconnect
Sevhena Feb 18, 2025
23fcbea
fixed async file handling
Sevhena Feb 18, 2025
aa0697b
Implement automatic reconnection to backend server
Sevhena Feb 19, 2025
9eb07cd
add eslint config
Sevhena Feb 22, 2025
89546f2
added lint + format pre-commit
Sevhena Feb 22, 2025
8f59f58
updated linting configuration
Sevhena Feb 22, 2025
bd4a09a
fixed issues raised by linter
Sevhena Feb 22, 2025
0c3d60f
linter ignores type def files + stop checking line ending type
Sevhena Feb 22, 2025
0617d35
minor bug fixes
Sevhena Feb 24, 2025
bf4839a
ssm-lab/capstone--source-code-optimizer#385 Added test libraries, set…
Feb 24, 2025
0fb9fc5
setup: configured project for jest testing
Sevhena Mar 1, 2025
00db119
adjusted global type paths
Sevhena Mar 1, 2025
461f6fd
added tests for smellDetection module
Sevhena Mar 1, 2025
42ed14d
ssm-lab/capstone--source-code-optimizer#385 Add unit tests for wipeWo…
Mar 1, 2025
1238f98
Centralized env config mocking
Mar 1, 2025
c53bc6c
Have 2/3 test cases working for hoverManager (#396)
Ayushi1972 Mar 1, 2025
3c48042
Finished hoverManager test cases (#396)
Ayushi1972 Mar 2, 2025
5040c26
Merge branch 'plugin-multi-file' into ayushi/vnvp-hover
Ayushi1972 Mar 2, 2025
f180c01
Merge pull request #2 from ssm-lab/ayushi/vnvp-hover
Ayushi1972 Mar 2, 2025
d234135
Added 4/6 passing test cases for line selection manager (#413)
Ayushi1972 Mar 2, 2025
3400ebb
Finished adding test cases for line selection manager (#413)
Ayushi1972 Mar 2, 2025
4703119
Merge branch 'ayushi/vnvp-lineselection' into plugin-multi-file
Ayushi1972 Mar 2, 2025
cf78358
Added unit tests for fileHighlighter module
Sevhena Mar 3, 2025
eba4711
Added coverage reporting to jest config
Sevhena Mar 3, 2025
a5e18be
Merge branch 'plugin-multi-file' of https://github.com/tbrar06/capsto…
Sevhena Mar 3, 2025
366fe71
Added unit tests for hashing module
Sevhena Mar 3, 2025
808cc93
Changed mention of "Energy Saved" to "Carbon Saved"
Sevhena Mar 5, 2025
b9c34f6
fixed bug that caused race condition when trying to apply a refactori…
Sevhena Mar 7, 2025
2cd44b1
ssm-lab/capstone--source-code-optimizer#445 Added unit tests for api …
Mar 10, 2025
0565e40
Added test for smells filter in settings (https://github.com/ssm-lab/…
nivethakuruparan Mar 10, 2025
8df531d
ssm-lab/capstone--source-code-optimizer#399 Added unit tests for refa…
Mar 10, 2025
5b8b5e0
update webpack config
Sevhena Mar 15, 2025
11297fa
Added jest testing workflow
Sevhena Mar 15, 2025
af9b361
Added test cases for backend
Sevhena Mar 15, 2025
c684c16
Added test cases for refactorSmell command module
Sevhena Mar 15, 2025
b42eb10
updated file coverage config
Sevhena Mar 16, 2025
b39ac41
temporarily omitting sidebar files from coverage
Sevhena Mar 17, 2025
fd8582c
Merge pull request #6 from ssm-lab/plugin-multi-file
Sevhena Mar 17, 2025
d399883
Moved changes to new-toggle-button branch
Mar 17, 2025
87c1f72
Closes ssm-lab/capstone--source-code-optimizer#405
Mar 17, 2025
26655e4
Merge branch 'dev' into new-toggle-button
Mar 17, 2025
cdb98b2
Add file path to avoid tests
Mar 17, 2025
f113976
fixed failing tests + added test for new detection toggle module
Sevhena Mar 18, 2025
277b10c
Merge pull request #7 from ssm-lab/new-toggle-button
mmyaaaaa Mar 18, 2025
55fb8ff
[DEV] Add Smell Customization (#8)
Sevhena Mar 18, 2025
82cda06
Updated log message processing (#9)
Sevhena Mar 18, 2025
0b03f75
initial integration with new changes
Sevhena Mar 21, 2025
d9fc39e
Fixed package-lock.json
nivethakuruparan Mar 21, 2025
f0f3d92
temporarily moved out old logic + files (will slowly add back in)
nivethakuruparan Mar 21, 2025
ccf01d7
renamed to FilterViewProvider.ts
nivethakuruparan Mar 21, 2025
89e9320
renamed to SmellsViewProvider class
nivethakuruparan Mar 21, 2025
2495e33
renamed to FilterViewProvider class
nivethakuruparan Mar 21, 2025
160d55d
cleaning
nivethakuruparan Mar 21, 2025
7085de0
some cleaning in SmellsCacheManager.ts
nivethakuruparan Mar 21, 2025
c52f13f
Removed cache for smells when smells filters was modified
nivethakuruparan Mar 21, 2025
300b583
added warning pop-up if users changed filter
nivethakuruparan Mar 21, 2025
6521b10
comment
nivethakuruparan Mar 21, 2025
878d5ca
fixed when refactor smell by type icon is shown
nivethakuruparan Mar 21, 2025
e574404
added fix for outdated files showing refactor button
nivethakuruparan Mar 21, 2025
c69d477
minor change how we process smells in smells view
nivethakuruparan Mar 21, 2025
31b00f6
made smells have a unique identifier to help make refactoring
nivethakuruparan Mar 22, 2025
26c6a9f
Added error catching for smell detection commands + fixed hashing logic
Sevhena Mar 22, 2025
4fcd83e
fix bug when jumping to smell
nivethakuruparan Mar 22, 2025
437b9eb
added inital refactoring stage
nivethakuruparan Mar 22, 2025
8fd6866
Merge branch 'nivetha/sidebar-revamp' of https://github.com/tbrar06/c…
Sevhena Mar 22, 2025
40d2e8c
added refactoring view
nivethakuruparan Mar 22, 2025
269ff46
added diff editor + accept and reject (not working)
nivethakuruparan Mar 22, 2025
b18eccd
Merge branch 'nivetha/sidebar-revamp' of https://github.com/tbrar06/c…
Sevhena Mar 22, 2025
e6c4d02
refactoring: removed file path param
nivethakuruparan Mar 22, 2025
1927f8a
added accept reject icons
nivethakuruparan Mar 22, 2025
727a299
more refactoring
nivethakuruparan Mar 22, 2025
3d9fd28
more refactoring - open diff editor command
nivethakuruparan Mar 22, 2025
c26df54
refactor - fixed sidebar dropdown with affected files
nivethakuruparan Mar 22, 2025
136b35c
refactor - fixed diff editor to not open in preview
nivethakuruparan Mar 22, 2025
ded38e7
added energy savings to tree items
nivethakuruparan Mar 22, 2025
44a8488
add to focus on view
nivethakuruparan Mar 22, 2025
7d12294
added accept and reject buttons
nivethakuruparan Mar 22, 2025
d184602
make files outdated after refactoring
nivethakuruparan Mar 22, 2025
c4e2298
Add energy metrics dashboard
Sevhena Mar 22, 2025
aed95b0
Merge branch 'nivetha/sidebar-revamp' of https://github.com/tbrar06/c…
Sevhena Mar 22, 2025
f93b106
Update energy metrics dashboard
Sevhena Mar 23, 2025
0a01bc2
started making icon ui for refactoring
nivethakuruparan Mar 23, 2025
7ec1be7
Merge branch 'nivetha/sidebar-revamp' of https://github.com/ssm-lab/…
nivethakuruparan Mar 23, 2025
930b2d5
small fix
nivethakuruparan Mar 23, 2025
24a3d1e
configuring workspace fix
nivethakuruparan Mar 23, 2025
9b52b44
renamed smells view
nivethakuruparan Mar 23, 2025
a334f8e
Added LineSelection and Highlighting back in
Sevhena Mar 23, 2025
1dc42c0
Merge branch 'nivetha/sidebar-revamp' of https://github.com/tbrar06/c…
Sevhena Mar 23, 2025
ce4e82e
Finalized editor decoration modules
Sevhena Mar 23, 2025
b44e04e
Hide commands from command palette
Sevhena Mar 23, 2025
49f344d
Merge branch 'nivetha/sidebar-revamp' of https://github.com/ssm-lab/c…
nivethakuruparan Mar 23, 2025
f98fbae
renamed to smellsView
nivethakuruparan Mar 23, 2025
b0f5887
fixed configuring workspace
nivethakuruparan Mar 23, 2025
b183430
readded the statuses for the smells view
nivethakuruparan Mar 23, 2025
021d5f6
clean
nivethakuruparan Mar 23, 2025
ba088f3
clean
nivethakuruparan Mar 23, 2025
42d907b
clean
nivethakuruparan Mar 23, 2025
a90c07c
clean
nivethakuruparan Mar 23, 2025
c6d30e7
clean configureWorkspace.ts
nivethakuruparan Mar 23, 2025
aa4b177
clean resetConfiguration.ts
nivethakuruparan Mar 23, 2025
d58df87
clean
nivethakuruparan Mar 23, 2025
bbdc2f0
clean
nivethakuruparan Mar 24, 2025
693bac3
readded the smells view
nivethakuruparan Mar 24, 2025
a47ed22
readded the smells view
nivethakuruparan Mar 24, 2025
b307fc6
readded the smells view
nivethakuruparan Mar 24, 2025
e7ac015
readded the smells view
nivethakuruparan Mar 24, 2025
810e875
readded filter view
nivethakuruparan Mar 24, 2025
843c936
bugs
nivethakuruparan Mar 24, 2025
7d8e6f2
bugs
nivethakuruparan Mar 24, 2025
f1ac1c7
added line selection
nivethakuruparan Mar 24, 2025
6ac1a25
added detectsmellsfolder
nivethakuruparan Mar 24, 2025
6225ce6
clean
nivethakuruparan Mar 24, 2025
646ece4
clean
nivethakuruparan Mar 24, 2025
ffcf5fa
clean
nivethakuruparan Mar 24, 2025
0da7aaa
added refactoring
nivethakuruparan Mar 24, 2025
30af34f
added refactoring
nivethakuruparan Mar 24, 2025
92fc62a
added back metrics
nivethakuruparan Mar 24, 2025
005e951
added refactoring
nivethakuruparan Mar 24, 2025
21c3a98
clean
nivethakuruparan Mar 24, 2025
3ba20c2
clean
nivethakuruparan Mar 24, 2025
d5c66b0
clean
nivethakuruparan Mar 24, 2025
6f57800
clean
nivethakuruparan Mar 24, 2025
da5d4d9
clean
nivethakuruparan Mar 24, 2025
81c2191
clean
nivethakuruparan Mar 24, 2025
4d15e00
clean backend.ts
nivethakuruparan Mar 24, 2025
0e60510
clean backend.ts and acceptRefactoring.ts
nivethakuruparan Mar 24, 2025
df5e2b2
clean configureWorkspace.ts
nivethakuruparan Mar 24, 2025
b025684
clean detectSmells.ts
nivethakuruparan Mar 24, 2025
8534c34
clean refactorSmell.ts
nivethakuruparan Mar 24, 2025
b15cbf3
clean
nivethakuruparan Mar 24, 2025
e378125
clean serverStatus.ts
nivethakuruparan Mar 24, 2025
974c935
clean workspaceModifiedListener.ts
nivethakuruparan Mar 24, 2025
9fbaeca
clean
nivethakuruparan Mar 24, 2025
cdad9f1
refactorSmellsByType added
nivethakuruparan Mar 24, 2025
49ce6e0
toggle linting
nivethakuruparan Mar 24, 2025
5639c48
cache bug fix
nivethakuruparan Mar 24, 2025
4fb0072
commit
nivethakuruparan Mar 24, 2025
4434fb5
hover manager
nivethakuruparan Mar 24, 2025
ea65950
Added back in missing functionality
Sevhena Mar 25, 2025
d56c5ea
Added back in all functionality
Sevhena Mar 25, 2025
fa3659f
small fixes
Sevhena Mar 25, 2025
ec24542
made structuring fixes
Sevhena Mar 25, 2025
b86247c
fixed tests for detect, refactor and wipe work cache modules
Sevhena Mar 25, 2025
e56b260
added mocks for tests
Sevhena Mar 25, 2025
f0bfa03
removed providers and showLogs from test coverage
nivethakuruparan Mar 25, 2025
afbe81d
got initializeStatusesFromCache.test.ts to work
nivethakuruparan Mar 26, 2025
6b9fc0c
added trackedDiffEditors.test.ts file
nivethakuruparan Mar 26, 2025
ec18c8d
added refactorActionButtons.test.ts file
nivethakuruparan Mar 26, 2025
7204c56
Added fields to the package.json to prepare for publishing
Sevhena Mar 28, 2025
68a8161
Merge branch 'nivetha/sidebar-revamp-1' of https://github.com/tbrar06…
Sevhena Mar 28, 2025
af52244
added more tests
Sevhena Mar 28, 2025
05264f1
Merge branch 'nivetha/sidebar-revamp-1' of https://github.com/ssm-lab…
nivethakuruparan Mar 29, 2025
2fea22b
added more tests
Sevhena Mar 29, 2025
7fb401c
Merge branch 'nivetha/sidebar-revamp-1' of https://github.com/ssm-lab…
nivethakuruparan Mar 29, 2025
c50466f
Fixed ui tests and made compilation work
nivethakuruparan Mar 29, 2025
b8dc03b
update readme ssm-lab/capstone--source-code-optimizer#261 (#10)
tanveer-brar Mar 29, 2025
ea58250
push v0.1.1
Sevhena Mar 30, 2025
e26804f
0.2.0
Sevhena Mar 30, 2025
fd2b31c
Add real logo
Sevhena Mar 30, 2025
4ecc605
0.2.1
Sevhena Mar 30, 2025
f55d7de
fix icon path
Sevhena Mar 30, 2025
6b618f3
0.2.2
Sevhena Mar 30, 2025
e78a1c2
fixed package.json scripts
Sevhena Mar 31, 2025
0ff0b6f
Add better comments
Sevhena Mar 31, 2025
27f74c5
updated configs and dependencies
Sevhena Mar 31, 2025
90db46e
remove virtual folders property from tsconfig.json
Sevhena Mar 31, 2025
e2751ad
Changed workflow testing step to do clean install
Sevhena Mar 31, 2025
ed9a6f4
updated test workflow
Sevhena Mar 31, 2025
5dc3955
added temp purge cache step to test workflow
Sevhena Mar 31, 2025
c8d1d6a
updated test workflow
Sevhena Mar 31, 2025
3ef6e42
modified jest config
Sevhena Mar 31, 2025
55eeb78
fixed module import issue
Sevhena Mar 31, 2025
57a705f
Merge branch 'main' of https://github.com/ssm-lab/capstone--sco-vs-co…
Sevhena Mar 31, 2025
40f4149
updated publishing workflow
Sevhena Mar 31, 2025
f271594
update publish.yml
Sevhena Mar 31, 2025
1886088
update again
Sevhena Mar 31, 2025
68a928a
found silly bug
Sevhena Mar 31, 2025
6608873
updated vsce install + trigger event
Sevhena Mar 31, 2025
ca82e67
updated vsce verification step
Sevhena Mar 31, 2025
7edd7a9
trying something
Sevhena Mar 31, 2025
9217868
fix typo
Sevhena Mar 31, 2025
f8e3a85
trying one more thing
Sevhena Mar 31, 2025
8272d07
updated workflow logic
Sevhena Mar 31, 2025
296cf33
Updated release step in publishing workflow
Sevhena Mar 31, 2025
d5f0b0b
Created final publish workflow + updated version
Sevhena Mar 31, 2025
6addc6a
fix workflow logic
Sevhena Mar 31, 2025
7802389
fix typo
Sevhena Mar 31, 2025
f4a59ca
try a fix
Sevhena Mar 31, 2025
d9518e6
try another fix
Sevhena Mar 31, 2025
2752551
added logging
Sevhena Mar 31, 2025
9f61596
found it
Sevhena Mar 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SERVER_URL='127.0.0.1'
HASH_PATH_MAP_KEY='hashPathMap'
SMELL_CACHE_KEY='smellCache'
WORKSPACE_METRICS_DATA='metricsData'
WORKSPACE_CONFIGURED_PATH='workspaceConfiguredPath'
UNFINISHED_REFACTORING='unfinishedRefactoring'
33 changes: 33 additions & 0 deletions .github/workflows/jest-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Jest Tests and Coverage Check

on:
pull_request:
types: [opened, reopened, synchronize]
branches: [dev]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Clean install
run: |
npm ci

- name: Run Jest tests
run: npm test -- --coverage

- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
70 changes: 51 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
name: Publish Extension

on:
push:
branches:
- main
release:
types:
- created
branches: [main]

jobs:
build:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # Needed for tag/release creation
id-token: write # For OIDC auth

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npm install @vscode/vsce --save-dev
- name: Publish
if: startsWith(github.ref, 'refs/tags/')
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for tagging

- name: Get version
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "tag_name=v$VERSION" >> $GITHUB_OUTPUT

- name: Create and push tag
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git tag ${{ steps.version.outputs.tag_name }}
git push origin ${{ steps.version.outputs.tag_name }}

- name: Install dependencies
run: |
npm install
npm install -g @vscode/vsce

- name: Package Extension
run: |
mkdir -p dist
vsce package --out ./dist/extension-${{ steps.version.outputs.tag_name }}.vsix

- name: Create Draft Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.tag_name }}
name: ${{ steps.version.outputs.tag_name }}
body: 'Release notes'
files: |
dist/extension-${{ steps.version.outputs.tag_name }}.vsix
draft: true
prerelease: false

- name: Publish to Marketplace
run: |
vsce publish -p $VSCE_PAT
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
59 changes: 59 additions & 0 deletions .github/workflows/version-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: PR Version Check

on:
pull_request:
branches: [main]

jobs:
validate_version:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0 # Required for branch comparison

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- run: npm install compare-versions

- name: Get PR version
id: pr_version
run: |
PR_VERSION=$(node -p "require('./package.json').version")
echo "pr_version=$PR_VERSION" >> $GITHUB_OUTPUT

- name: Fetch main branch
run: git fetch origin main

- name: Get main's version
id: main_version
run: |
MAIN_VERSION=$(git show origin/main:package.json | node -p "JSON.parse(require('fs').readFileSync(0)).version")
echo "main_version=$MAIN_VERSION" >> $GITHUB_OUTPUT

- name: Validate version bump
run: |
# Write a temporary Node.js script for version comparison
cat > compare-versions.mjs << 'EOF'
import { compareVersions } from 'compare-versions';

const mainVersion = process.argv[2];
const prVersion = process.argv[3];

console.log("Main version:", mainVersion)
console.log("PR version:", prVersion)

if (compareVersions(prVersion, mainVersion) < 1) {
console.error(`::error::Version ${prVersion} must be greater than ${mainVersion}`);
process.exit(1);
}
EOF

node compare-versions.mjs "${{ steps.main_version.outputs.main_version }}" "${{ steps.pr_version.outputs.pr_version }}"

echo "✓ Version validated"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ dist
node_modules
.vscode-test/
*.vsix
coverage/
.venv/
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
dist
.vscode
.husky
media
.env
**/*.config.js
**/*.mjs'
**/*d.ts
coverage/
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"bracketSpacing": true,
"printWidth": 85,
"semi": true,
"singleQuote": true,
"endOfLine": "auto",
"tabWidth": 2,
"trailingComma": "all",
"plugins": ["prettier-plugin-tailwindcss"]
}
15 changes: 14 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,18 @@
"dist": true
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"typescript.tsc.autoDetect": "off",
"cSpell.words": [
"ecooptimizer",
"occurences"
],
"eslint.enable": true,
"eslint.lintTask.enable": true,
"eslint.validate": [
"javascript",
"typescript",
"javascriptreact",
"typescriptreact"
],
"files.eol": "\n",
}
26 changes: 15 additions & 11 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
.vscode/**
.vscode-test/**
out/**
node_modules/**
src/**
.gitignore
.yarnrc
.vscode
node_modules
package-lock.json
tsconfig.json
webpack.config.js
vsc-extension-quickstart.md
**/tsconfig.json
**/eslint.config.mjs
eslint.config.mjs
.prettier*
.gitignore
run/**
.venv/**
test/**
.github/**
.husky/**
coverage/**
**/*.map
**/*.ts
**/.vscode-test.*
.vscode-test.mjs
.env
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Change Log

All notable changes to the "ecooptimizer-vs-code-plugin" extension will be documented in this file.
All notable changes to the "ecooptimizer" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

Expand Down
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright (c) 2024-2025 Ayushi Amin, Mya Hussain, Nivetha Kuruparan, Sevhena Walker, Tanveer Brar

Permission is hereby granted, on a case-by-case basis, to specific individuals or organizations ("Licensee") to use and access the software and associated documentation files (the "Software") strictly for evaluation or development purposes. This permission is non-transferable, non-exclusive, and does not grant the Licensee any rights to modify, merge, publish, distribute, sublicense, sell, or otherwise exploit the Software in any manner without explicit prior written consent from the copyright holder.

Any unauthorized use, modification, distribution, or sale of the Software is strictly prohibited and may result in legal action.

The Software is provided "AS IS," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, or non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Software or the use or other dealings in the Software.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
VS Code Plugin for Source Code Optimizer
# EcoOptimizers - Sustainable Python Code Refactoring

EcoOptimizers is a VS Code extension that detects and refactors inefficient Python code, reducing unnecessary computations and lowering CO₂ emissions. By identifying common code smells and providing automated refactoring suggestions, EcoOptimizers helps you write cleaner, more efficient, and environmentally friendly code.

## Features

- **Detect Code Smells** – Automatically analyze your Python code to find inefficiencies.
- **Refactor Code Smells** – Get instant suggestions and apply refactorings with ease.
- **Reduce CO₂ Emissions** – Improve computational efficiency and contribute to a greener future.
- **Seamless VS Code Integration** – Analyze and optimize your code directly within the editor.

## Supported Code Smells

EcoOptimizers detects and refactors the following common code smells:

- **Cache Repeated Calls** – Identifies functions that repeatedly compute the same result and suggests caching techniques.
- **Long Lambda Functions** – Flags excessively long lambda expressions and converts them into named functions for readability and maintainability.
- **Use A Generator** – Suggests using generators instead of list comprehensions for memory efficiency.
- **Long Element Chain** – Detects deeply nested attribute accesses and recommends breaking them into intermediate variables for clarity.
- **Member Ignoring Method** – Identifies methods that do not use their class members and suggests converting them into static methods or external functions.
- **Long Message Chains** – Finds excessive method chaining and refactors them for better readability.
- **String Concatenation in Loop** – Detects inefficient string concatenation inside loops and suggests using lists or other optimized methods.
- **Long Parameter List** – Flags functions with too many parameters and suggests refactoring strategies such as grouping related parameters into objects.

## How It Works

1. **Detect Smells** – Run the EcoOptimizers analysis tool to scan your code for inefficiencies.
2. **Refactor Suggestions** – View recommended changes and apply them with a click.
3. **Optimize Your Code** – Enjoy cleaner, more efficient Python code with reduced computational overhead.

## Demo Videos

Watch EcoOptimizers in action:

- [Detecting Code Smells](https://drive.google.com/file/d/1Uyz0fpqjWVZVe_WXuJLB0bTtzOvjhefu/view?usp=sharing) 🔍
- [Refactoring Code Smells](https://drive.google.com/file/d/1LQFdnKhuZ7nQGFEXZl3HQtF3TFgMJr6F/view?usp=sharing) 🔧

## Installation

1. Open VS Code.
2. Go to the Extensions Marketplace.
3. Search for **EcoOptimizers**.
4. Click **Install**.
5. Intall the `ecooptimizer` python package.
- run: `pip install ecooptimizer`
- run: `eco-ext`
6. Start optimizing your Python code!

## Contribute

EcoOptimizers is open-source! Help improve the extension by contributing to our GitHub repository: [GitHub Repository](https://github.com/ssm-lab/capstone--source-code-optimizer)

---

🚀 Start writing cleaner, more efficient Python code today with EcoOptimizers!
Binary file added assets/black_leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/darkgreen_leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/eco-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/eco_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/green_leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/white_leaf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading