Skip to content

Commit 1c8eb73

Browse files
SevhenaAyushi1972mmyaaaaanivethakuruparantanveer-brar
authored
[DEV] Merge new-poc with dev
Co-authored-by: Ayushi Amin <66652121+Ayushi1972@users.noreply.github.com> Co-authored-by: Mya <55725523+mmyaaaaa@users.noreply.github.com> Co-authored-by: Nivetha Kuruparan <167944429+nivethakuruparan@users.noreply.github.com> Co-authored-by: Tanveer Brar <92374772+tbrar06@users.noreply.github.com>
2 parents a5b0156 + ba4e983 commit 1c8eb73

131 files changed

Lines changed: 16236 additions & 613 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python-lint.yaml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,6 @@ jobs:
2626
with:
2727
token: ${{ steps.app-token.outputs.token }}
2828

29-
# Get changed .py files
30-
- name: Get changed .py files
31-
id: changed-py-files
32-
uses: tj-actions/changed-files@v45
33-
with:
34-
files: |
35-
**/*.py
36-
files_ignore: |
37-
tests/input/**/*.py
38-
tests/_input_copies/**/*.py
39-
diff_relative: true # Get the list of files relative to the repo root
40-
4129
- name: Install Python
4230
uses: actions/setup-python@v5
4331
with:
@@ -49,8 +37,6 @@ jobs:
4937
pip install ruff
5038
5139
- name: Run Ruff
52-
env:
53-
ALL_CHANGED_FILES: ${{ steps.changed-py-files.outputs.all_changed_files }}
5440
run: |
55-
ruff check $ALL_CHANGED_FILES --output-format=github .
41+
ruff check --output-format=github
5642

.github/workflows/python-test.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,3 @@ jobs:
5353
run: |
5454
git fetch origin ${{ github.base_ref }}
5555
diff-cover coverage.xml --compare-branch=origin/${{ github.base_ref }} --fail-under=80
56-
57-
- name: Check Per-File Coverage
58-
run: |
59-
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
60-
echo "Checking overall coverage for $file"
61-
coverage report --include=$file --fail-under=80 || exit 1
62-
done

.gitignore

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,25 @@ TSWLatexianTemp*
286286

287287
# DRAW.IO files
288288
*.drawio
289-
*.drawio.bkp
289+
*.drawio.bkp
290+
291+
# Byte-compiled / optimized / DLL files
292+
__pycache__/
293+
*.py[cod]
294+
295+
.venv/
296+
297+
# Rope
298+
.ropeproject
299+
300+
*.egg-info/
301+
302+
# Package files
303+
outputs/
304+
build/
305+
tests/temp_dir/
306+
tests/benchmarking/output/
307+
308+
# Coverage
309+
.coverage
310+
coverage.*

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "plugin/capstone--sco-vs-code-plugin"]
2+
path = plugin/capstone--sco-vs-code-plugin
3+
url = https://github.com/ssm-lab/capstone--sco-vs-code-plugin.git

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.7.4
5+
hooks:
6+
# Run the linter.
7+
- id: ruff
8+
args: [ --fix ]
9+
# Run the formatter.
10+
- id: ruff-format
11+
3 Bytes
Binary file not shown.
File renamed without changes.

pyproject.toml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
[build-system]
2+
requires = ["setuptools >= 61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "ecooptimizer"
7+
version = "0.0.1"
8+
dependencies = [
9+
"pylint",
10+
"rope",
11+
"astor",
12+
"codecarbon",
13+
"asttokens",
14+
"uvicorn",
15+
"fastapi",
16+
"pydantic",
17+
"libcst",
18+
"websockets",
19+
]
20+
requires-python = ">=3.9"
21+
authors = [
22+
{ name = "Sevhena Walker" },
23+
{ name = "Mya Hussain" },
24+
{ name = "Nivetha Kuruparan" },
25+
{ name = "Ayushi Amin" },
26+
{ name = "Tanveer Brar" },
27+
]
28+
29+
description = "A source code eco optimizer"
30+
readme = "README.md"
31+
license = { file = "LICENSE" }
32+
33+
[project.optional-dependencies]
34+
dev = [
35+
"pytest",
36+
"pytest-cov",
37+
"pytest-mock",
38+
"ruff",
39+
"coverage",
40+
"pyright",
41+
"pre-commit",
42+
]
43+
44+
[project.scripts]
45+
eco-local = "ecooptimizer.__main__:main"
46+
eco-ext = "ecooptimizer.api.__main__:main"
47+
eco-ext-dev = "ecooptimizer.api.__main__:dev"
48+
49+
[project.urls]
50+
Documentation = "https://readthedocs.org"
51+
Repository = "https://github.com/ssm-lab/capstone--source-code-optimizer"
52+
"Bug Tracker" = "https://github.com/ssm-lab/capstone--source-code-optimizer/issues"
53+
54+
[tool.pytest.ini_options]
55+
norecursedirs = ["tests/temp*", "tests/input", "tests/_input_copies"]
56+
addopts = ["--basetemp=tests/temp_dir"]
57+
testpaths = ["tests"]
58+
pythonpath = "src"
59+
60+
[tool.coverage.run]
61+
omit = [
62+
"*/__main__.py",
63+
'*/__init__.py',
64+
'*/utils/*',
65+
"*/test_*.py",
66+
"*/analyzers/*_analyzer.py",
67+
"*/api/app.py",
68+
"*/api/routes/show_logs.py",
69+
]
70+
71+
[tool.ruff]
72+
extend-exclude = [
73+
"*tests/input/**/*.py",
74+
"tests/_input_copies",
75+
"tests/temp_dir",
76+
"tests/benchmarking/test_code/**/*.py",
77+
]
78+
line-length = 100
79+
80+
[tool.ruff.lint]
81+
select = [
82+
"E", # Enforce Python Error rules (e.g., syntax errors, exceptions).
83+
"UP", # Check for unnecessary passes and other unnecessary constructs.
84+
"ANN001", # Ensure type annotations are present where needed.
85+
"ANN002",
86+
"ANN003",
87+
"ANN401",
88+
"INP", # Flag invalid Python patterns or usage.
89+
"PTH", # Check path-like or import-related issues.
90+
"F", # Enforce function-level checks (e.g., complexity, arguments).
91+
"B", # Enforce best practices for Python coding (general style rules).
92+
"PT", # Enforce code formatting and Pythonic idioms.
93+
"W", # Enforce warnings (e.g., suspicious constructs or behaviours).
94+
"A", # Flag common anti-patterns or bad practices.
95+
"RUF", # Ruff-specific rules.
96+
"ARG", # Check for function argument issues.,
97+
]
98+
99+
# Avoid enforcing line-length violations (`E501`)
100+
ignore = ["E501", "RUF003"]
101+
102+
# Avoid trying to fix flake8-bugbear (`B`) violations.
103+
unfixable = ["B"]
104+
105+
# Ignore `E402` (import violations) in all `__init__.py` files, and in selected subdirectories.
106+
[tool.ruff.lint.per-file-ignores]
107+
"__init__.py" = ["E402"]
108+
"**/{tests,docs,tools}/*" = ["E402", "ANN", "INP001"]
109+
110+
[tool.ruff.lint.flake8-annotations]
111+
suppress-none-returning = true
112+
mypy-init-return = true
113+
114+
[tool.pyright]
115+
include = ["src", "tests"]
116+
exclude = ["tests/input", "tests/_input*", "tests/temp_dir"]
117+
118+
disableBytesTypePromotions = true
119+
reportAttributeAccessIssue = false
120+
reportPropertyTypeMismatch = true
121+
reportFunctionMemberAccess = true
122+
reportMissingImports = true
123+
reportUnusedVariable = "warning"
124+
reportDuplicateImport = "warning"
125+
reportUntypedFunctionDecorator = true
126+
reportUntypedClassDecorator = true
127+
reportUntypedBaseClass = true
128+
reportUntypedNamedTuple = true
129+
reportPrivateUsage = true
130+
reportConstantRedefinition = "warning"
131+
reportDeprecated = "warning"
132+
reportIncompatibleMethodOverride = true
133+
reportIncompatibleVariableOverride = true
134+
reportInconsistentConstructor = true
135+
reportOverlappingOverload = true
136+
reportMissingTypeArgument = true
137+
reportCallInDefaultInitializer = "warning"
138+
reportUnnecessaryIsInstance = "warning"
139+
reportUnnecessaryCast = "warning"
140+
reportUnnecessaryComparison = true
141+
reportMatchNotExhaustive = "warning"

src/analyzers/base_analyzer.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)