Skip to content

Commit

Permalink
Update tools
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Apr 29, 2024
1 parent 8038274 commit dc7e391
Show file tree
Hide file tree
Showing 9 changed files with 220 additions and 300 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,14 @@ jobs:
- name: Code style
if: ${{ matrix.check-formatting }}
run: |
poetry run black --check awscliv2
poetry run isort -c awscliv2
poetry run ruff format --check
- name: Lint
if: ${{ matrix.check-formatting }}
run: |
poetry run flake8 awscliv2
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install Node.js dependencies
run: |
npm install -g pyright
poetry run ruff check
- name: Typing
run: |
poetry run npx pyright awscliv2
poetry run pyright awscliv2
- name: Test
run: |
poetry run pytest
2 changes: 1 addition & 1 deletion awscliv2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""
This is the main module of the awscliv2 package.
Main module of the awscliv2 package.
"""
3 changes: 3 additions & 0 deletions awscliv2/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ def __init__(self, msg: str = "", returncode: int = 1) -> None:
self.returncode = returncode

def __str__(self) -> str:
"""
Represent as a string.
"""
return self.msg


Expand Down
4 changes: 2 additions & 2 deletions awscliv2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

def main(args: Sequence[str]) -> int:
"""
Main program entrypoint.
Entrypoint for API.
"""
namespace = parse_args(args)
runner = AWSAPI(encoding=namespace.encoding, output=sys.stdout)
Expand Down Expand Up @@ -58,7 +58,7 @@ def main(args: Sequence[str]) -> int:

def main_cli() -> None:
"""
Main entrypoint for CLI.
Entrypoint for CLI.
"""
try:
sys.exit(main(sys.argv[1:]))
Expand Down
428 changes: 153 additions & 275 deletions poetry.lock

Large diffs are not rendered by default.

56 changes: 48 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,8 @@ pip = "*"
importlib-metadata = { version = "*", python = "<3.8" }

[tool.poetry.dev-dependencies]
isort = { version = "*", python = ">=3.10" }
black = { version = "*", python = ">=3.10" }
flake8 = { version = "*", python = ">=3.10" }
flake8-bugbear = { version = "*", python = ">=3.10" }
flake8-comprehensions = { version = "*", python = ">=3.10" }
flake8-docstrings = { version = "*", python = ">=3.10" }
flake8-simplify = { version = "*", python = ">=3.10" }
flake8-string-format = { version = "*", python = ">=3.10" }
ruff = { version = "*", python = ">=3.10" }
pyright = { version = "*", python = ">=3.10" }
rope = { version = "*", python = ">=3.10" }
handsdown = { version = "*", python = ">=3.10" }
pytest = { version = "*", python = ">=3.10" }
Expand Down Expand Up @@ -98,3 +92,49 @@ reportIncompatibleMethodOverride = "error"
reportIncompatibleVariableOverride = "error"
reportUnknownParameterType = "error"
pythonVersion = "3.7"

[tool.ruff]
exclude = [
".eggs",
".git",
".git-rewrite",
".mypy_cache",
".pytest_cache",
".ruff_cache",
".venv",
".vscode",
"build",
"dist",
]

line-length = 100
indent-width = 4
target-version = "py37"

[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "B", "I", "N", "D", "C4", "C90", "RUF"]
ignore = [
"E501",
"N803",
"N818",
"D107",
"D200",
"D203",
"D212",
"D406",
"D407",
"D413",
"D417",
]
fixable = ["ALL"]
unfixable = ["B"]
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
exclude = ["test_*.py", "*.pyi"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = false
docstring-code-line-length = "dynamic"
5 changes: 2 additions & 3 deletions scripts/before_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ set -e
ROOT_PATH=$(dirname $(dirname $(realpath $0)))
cd $ROOT_PATH

poetry run black .
poetry run isort .
poetry run flake8 awscliv2
poetry run ruff check
poetry run ruff format --check
poetry run pytest --cov-report term --cov=awscliv2
poetry run npx pyright
4 changes: 4 additions & 0 deletions scripts/example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""
Example script.
"""

import json
import shlex

Expand Down
3 changes: 3 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
Tests.
"""

0 comments on commit dc7e391

Please sign in to comment.