Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
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
0ad077d
Updated publishing workflow + updated version
Sevhena Mar 31, 2025
d462b36
Added configureWorkspace.test.ts
nivethakuruparan Apr 3, 2025
7324061
Added resetConfiguration.test.ts
nivethakuruparan Apr 3, 2025
d710407
Added refactorActionButtons.test.ts
nivethakuruparan Apr 3, 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
12 changes: 6 additions & 6 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SERVER_URL='127.0.0.1:8000'
SMELL_MAP_KEY='workspaceSmells'
FILE_CHANGES_KEY='lastSavedHashes'
LAST_USED_SMELLS_KEY='lastUsedSmells'
CURRENT_REFACTOR_DATA_KEY='refactorData'
ACTIVE_DIFF_KEY='activeDiff'
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'
5 changes: 3 additions & 2 deletions .github/workflows/jest-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
with:
node-version: 20

- name: Install dependencies
run: npm install
- name: Clean install
run: |
npm ci

- name: Run Jest tests
run: npm test -- --coverage
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish Extension

on:
push:
branches: [main]

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

steps:
- 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"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.vscode-test/
*.vsix
coverage/
.venv/
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"printWidth": 85,
"semi": true,
"singleQuote": true,
"endOfLine": "auto",
"tabWidth": 2,
"trailingComma": "all",
"plugins": ["prettier-plugin-tailwindcss"]
Expand Down
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
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.
67 changes: 55 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,55 @@
VS Code Plugin for Source Code Optimizer

1. clone this repo
2. open terminal and write:
`npm install` (only the first time)
`npm run compile` | `npm run watch` <- second command will auto compile on save
3. open another vs code window with the ecooptimzer repo
4. start venv in the ecooptimizer repo
5. run "python -m ecooptimizer.api.main" in terminal to start the developement server manually
6. come back to this repo, go to run and debug (or just click `F5` key)
7. run extension (should open a new vs code window so open the repo u want in this)
8. in the vscode search bar (`ctrl+shift+p`) type ">eco: detect smells" and run it
# 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.
101 changes: 101 additions & 0 deletions data/default_smells_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"use-a-generator": {
"message_id": "R1729",
"name": "Use A Generator (UGEN)",
"acronym": "UGEN",
"enabled": true,
"smell_description": "Using generators instead of lists reduces memory consumption and avoids unnecessary allocations, leading to more efficient CPU and energy use.",
"analyzer_options": {}
},
"too-many-arguments": {
"message_id": "R0913",
"name": "Too Many Arguments (LPL)",
"acronym": "LPL",
"enabled": true,
"smell_description": "Functions with many arguments are harder to optimize and often require more memory and call overhead, increasing CPU load and energy usage.",
"analyzer_options": {
"max_args": {
"label": "Number of Arguments",
"description": "Detecting functions with this many arguments.",
"value": 6
}
}
},
"no-self-use": {
"message_id": "R6301",
"name": "No Self Use (NSU)",
"acronym": "NSU",
"enabled": true,
"smell_description": "Methods that don't use 'self' can be static, reducing object overhead and avoiding unnecessary memory binding at runtime.",
"analyzer_options": {}
},
"long-lambda-expression": {
"message_id": "LLE001",
"name": "Long Lambda Expression (LLE)",
"acronym": "LLE",
"enabled": true,
"smell_description": "Complex lambdas are harder for the interpreter to optimize and may lead to repeated evaluations, which can increase CPU usage and energy draw.",
"analyzer_options": {
"threshold_length": {
"label": "Lambda Length",
"description": "Detects lambda expressions exceeding this length.",
"value": 9
},
"threshold_count": {
"label": "Repetition Count",
"description": "Flags patterns that repeat at least this many times.",
"value": 5
}
}
},
"long-message-chain": {
"message_id": "LMC001",
"name": "Long Message Chain (LMC)",
"acronym": "LMC",
"enabled": true,
"smell_description": "Deeply nested calls create performance bottlenecks due to increased dereferencing and lookup time, which adds to CPU cycles and energy usage.",
"analyzer_options": {
"threshold": {
"label": "Threshold",
"description": "Defines a threshold for triggering this smell.",
"value": 9
}
}
},
"long-element-chain": {
"message_id": "LEC001",
"name": "Long Element Chain (LEC)",
"acronym": "LEC",
"enabled": true,
"smell_description": "Chained element access can be inefficient in large structures, increasing access time and CPU effort, thereby consuming more energy.",
"analyzer_options": {
"threshold": {
"label": "Threshold",
"description": "Defines a threshold for triggering this smell.",
"value": 3
}
}
},
"cached-repeated-calls": {
"message_id": "CRC001",
"name": "Cached Repeated Calls (CRC)",
"acronym": "CRC",
"enabled": true,
"smell_description": "Failing to cache repeated expensive calls leads to redundant computation, which wastes CPU cycles and drains energy needlessly.",
"analyzer_options": {
"threshold": {
"label": "Cache Threshold",
"description": "Number of times a function must repeat before caching.",
"value": 2
}
}
},
"string-concat-loop": {
"message_id": "SCL001",
"name": "String Concatenation in Loops (SCL)",
"acronym": "SCL",
"enabled": true,
"smell_description": "String concatenation in loops creates new objects each time, increasing memory churn and CPU workload, which leads to higher energy consumption.",
"analyzer_options": {}
}
}
Loading