Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cli/commands/analyze.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from InquirerPy import inquirer

from cli.utils.get_translation import get_translation
from utils.get_translation import get_translation
from spice.analyze import analyze_file


Expand Down
2 changes: 1 addition & 1 deletion cli/commands/export/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from rich.console import Console
from rich.table import Table

from cli.utils.get_translation import get_translation
from utils.get_translation import get_translation

def export_results(results, format_type, output_file, messages):
"""
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/hello.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from rich import print # this add colors to the printed text

from cli.utils.get_translation import get_translation
from utils.get_translation import get_translation


def hello_command(LANG_FILE):
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from rich import print # this add colors to the printed text

from cli.utils.get_translation import get_translation
from utils.get_translation import get_translation


def version_command(LANG_FILE, CURRENT_DIR):
Expand Down
2 changes: 1 addition & 1 deletion spice/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def analyze_file(file_path: str, selected_stats=None):
# only put the code through the lexer and proceed with tokenization if needed
if any(stat in selected_stats for stat in ["function_count"]):
# get the lexer for the code's language
from spice.utils.get_lexer import get_lexer_for_file
from utils.get_lexer import get_lexer_for_file
LexerClass = get_lexer_for_file(file_path)

# tokenize the code via lexer
Expand Down
Empty file removed spice/utils/__init__.py
Empty file.
File renamed without changes.
22 changes: 22 additions & 0 deletions utils/get_lang.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os


# this will read the file extension and return the correct langague
def get_lexer_for_file(file_path):
_, ext = os.path.splitext(file_path)

if ext == ".rb":
return "ruby"

elif ext == ".py":
from lexers.python.pythonlexer import PythonLexer
return "python"

elif ext == ".js":
return "javascript"

elif ext == ".go":
return "go"

else:
raise ValueError(f"Unsupported file extension: {ext}")
File renamed without changes.
File renamed without changes.
Loading