Skip to content

Commit 752dd5d

Browse files
committed
fix: ci workflows
1 parent 6fb72d6 commit 752dd5d

File tree

5 files changed

+66
-13
lines changed

5 files changed

+66
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ let g:sqlformat_keyword_case = 'lower'
6666

6767
## License
6868

69-
This project is licensed under the MIT License - see the LICENSE file for details.
69+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/andevgo/nvim-sqlformat/blob/main/LICENSE) file for details.
7070

7171
## Contributing
7272

pyproject.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[tool.mypy]
2+
python_version = "3.8"
3+
warn_return_any = true
4+
warn_unused_configs = true
5+
disallow_untyped_defs = true
6+
disallow_incomplete_defs = true
7+
check_untyped_defs = true
8+
disallow_untyped_decorators = true
9+
no_implicit_optional = true
10+
warn_redundant_casts = true
11+
warn_unused_ignores = true
12+
warn_no_return = true
13+
warn_unreachable = true
14+
15+
[[tool.mypy.overrides]]
16+
module = "vim.*"
17+
ignore_missing_imports = true
18+
19+
[[tool.mypy.overrides]]
20+
module = "sqlparse.*"
21+
ignore_missing_imports = true
22+
23+
[tool.black]
24+
line-length = 88
25+
target-version = ['py38']
26+
include = '\.pyi?$'

python/sqlformat.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,35 @@
1111
# copies or substantial portions of the Software.
1212
# File: python/sqlformat.py
1313

14+
from typing import Optional, Union
15+
1416
import sqlparse
1517
import vim
1618

1719

18-
def format_sql(sql, indent, keyword_case, line_width=80):
19-
"""
20-
Format SQL code using sqlparse.
21-
20+
def format_sql(
21+
sql: str,
22+
indent: int,
23+
keyword_case: Optional[str],
24+
line_width: int = 80,
25+
) -> str:
26+
"""Format SQL code using sqlparse.
27+
2228
Args:
23-
sql (str): SQL code to format
24-
indent (int): Number of spaces for indentation
25-
keyword_case (str): 'upper', 'lower', or None for keyword case
26-
line_width (int): Maximum line width for wrapping
29+
sql: SQL code to format
30+
indent: Number of spaces for indentation
31+
keyword_case: 'upper', 'lower', or None for keyword case
32+
line_width: Maximum line width for wrapping
33+
2734
Returns:
28-
str: Formatted SQL
35+
Formatted SQL string
36+
37+
Raises:
38+
ValueError: If input parameters are invalid
2939
"""
3040
try:
3141
vim.command('echo "Formatting SQL..."')
32-
42+
3343
# Validate inputs
3444
if not isinstance(indent, int) or indent < 0:
3545
raise ValueError("Indent must be a positive integer")
@@ -46,10 +56,10 @@ def format_sql(sql, indent, keyword_case, line_width=80):
4656
keyword_case=keyword_case,
4757
wrap_after=line_width,
4858
)
49-
59+
5060
vim.command('echo "SQL formatting complete"')
5161
return formatted
52-
62+
5363
except Exception as e:
5464
error_msg = f"SQL formatting failed: {str(e)}"
5565
vim.command(f'echoerr "{error_msg}"')

requirements.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sqlparse>=0.4.4
2+
pynvim>=0.4.3
3+
black>=23.0.0
4+
mypy>=1.0.0
5+
types-setuptools>=57.4.0

setup.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from setuptools import setup, find_packages
2+
3+
setup(
4+
name="nvim-sqlformat",
5+
version="0.1.0",
6+
packages=find_packages(),
7+
install_requires=[
8+
"sqlparse>=0.4.4",
9+
"pynvim>=0.4.3",
10+
],
11+
python_requires=">=3.8",
12+
)

0 commit comments

Comments
 (0)