Skip to content

Commit 6fb72d6

Browse files
committed
fix: the black formating and viml linting errors
1 parent 7e3b668 commit 6fb72d6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

autoload/sqlformat.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ function! sqlformat#Format(startline, endline) abort
1414
" Get the selected lines
1515
let l:lines = getline(a:startline, a:endline)
1616
let l:input = join(l:lines, '\n')
17+
let l:formatted = ''
18+
let l:error = ''
1719

1820
" Call Python script to format SQL
1921
python3 << EOF
@@ -38,7 +40,7 @@ except Exception as e:
3840
EOF
3941

4042
" Check for Python errors
41-
if exists('l:error')
43+
if !empty(l:error)
4244
echohl ErrorMsg
4345
echomsg 'SQLFormat error: ' . l:error
4446
echohl None

python/sqlformat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def format_sql(sql, indent, keyword_case, line_width=80):
3333
# Validate inputs
3434
if not isinstance(indent, int) or indent < 0:
3535
raise ValueError("Indent must be a positive integer")
36-
if keyword_case not in ['upper', 'lower', None]:
36+
if keyword_case not in ["upper", "lower", None]:
3737
raise ValueError("Keyword case must be 'upper', 'lower', or None")
3838
if not isinstance(line_width, int) or line_width < 0:
3939
raise ValueError("Line width must be a positive integer")
@@ -44,7 +44,7 @@ def format_sql(sql, indent, keyword_case, line_width=80):
4444
reindent=True,
4545
indent_width=indent,
4646
keyword_case=keyword_case,
47-
wrap_after=line_width
47+
wrap_after=line_width,
4848
)
4949

5050
vim.command('echo "SQL formatting complete"')

0 commit comments

Comments
 (0)