-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from derek10cloud/add-lint
Add ruff linter to improve code quality and maintainability
- Loading branch information
Showing
13 changed files
with
649 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Lint Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
check_lint: | ||
defaults: | ||
run: | ||
working-directory: "stackql_deploy" | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: pip install ruff | ||
|
||
- name: Lint check with ruff | ||
run: ruff check . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
<!-- web assets --> | ||
|
||
[logo]: https://stackql.io/img/stackql-logo-bold.png "stackql logo" | ||
[deploylogo]: https://stackql.io/img/stackql-deploy-logo.png "stackql-deploy logo" | ||
[stackqlrepo]: https://github.com/stackql/stackql | ||
[homepage]: https://stackql.io/ | ||
[docs]: https://stackql.io/docs | ||
[blog]: https://stackql.io/blog | ||
[registry]: https://github.com/stackql/stackql-provider-registry | ||
|
||
<!-- [readthedocs]: --> | ||
|
||
[pypi]: https://pypi.org/project/stackql-deploy/ | ||
|
||
<!-- badges --> | ||
|
||
[badge1]: https://img.shields.io/badge/platform-windows%20macos%20linux-brightgreen "Platforms" | ||
[badge2]: https://img.shields.io/pypi/v/stackql-deploy "PyPi Version" | ||
[badge3]: https://img.shields.io/pypi/dm/stackql-deploy "PyPi Downloads" | ||
[badge4]: https://img.shields.io/github/license/stackql/stackql "License" | ||
|
||
<!-- github links --> | ||
|
||
[discussions]: https://github.com/orgs/stackql/discussions | ||
[issues]: https://github.com/stackql/stackql-deploy/issues/new/choose | ||
|
||
<!-- misc links --> | ||
|
||
[twitter]: https://twitter.com/stackql | ||
|
||
<!-- language: lang-none --> | ||
|
@@ -36,23 +45,25 @@ | |
<p align="center"> | ||
|
||
<!-- [__Read the docs »__][readthedocs] --> | ||
[__PyPi__][pypi] | ||
[__Raise an Issue__][issues] | ||
|
||
[**PyPi**][pypi] | ||
[**Raise an Issue**][issues] | ||
|
||
</p> | ||
</div> | ||
|
||
## About The Project | ||
|
||
[__`stackql-deploy`__][pypi] is an open-source command line utility which implements a declarative, model driven framework to deploy and manage multi cloud stacks using [__`stackql`__][stackqlrepo]. [__`stackql-deploy`__][pypi] is distributed as a Python script to be used as a CLI tool, do the following to get started: | ||
[**`stackql-deploy`**][pypi] is an open-source command line utility which implements a declarative, model driven framework to deploy and manage multi cloud stacks using [**`stackql`**][stackqlrepo]. [**`stackql-deploy`**][pypi] is distributed as a Python script to be used as a CLI tool, do the following to get started: | ||
<br /> | ||
|
||
```bash | ||
pip install stackql-deploy | ||
``` | ||
|
||
> __Note for macOS users__ | ||
> to install `stackql-deploy` in a virtual environment (which may be necessary on __macOS__), use the following: | ||
> **Note for macOS users** | ||
> to install `stackql-deploy` in a virtual environment (which may be necessary on **macOS**), use the following: | ||
> | ||
> ```bash | ||
> python3 -m venv myenv | ||
> source myenv/bin/activate | ||
|
@@ -61,15 +72,15 @@ pip install stackql-deploy | |
## About StackQL | ||
StackQL is a utility which allows you to query and interact with cloud and SaaS resources in real time using SQL grammar. StackQL supports a full set of SQL query/DML grammar, including `JOIN`, `UNION` adn subquery functionality and supports mutation operations on cloud and SaaS resources such as `create`, `update` and `delete`, implemented as `INSERT`, `UPDATE` and `DELETE` respectively. StackQL also supports grammar for performing lifecycle operations such as starting or stopping a VM using the `EXEC` statement. | ||
StackQL is a utility which allows you to query and interact with cloud and SaaS resources in real time using SQL grammar. StackQL supports a full set of SQL query/DML grammar, including `JOIN`, `UNION` adn subquery functionality and supports mutation operations on cloud and SaaS resources such as `create`, `update` and `delete`, implemented as `INSERT`, `UPDATE` and `DELETE` respectively. StackQL also supports grammar for performing lifecycle operations such as starting or stopping a VM using the `EXEC` statement. | ||
StackQL provider definitions are defined in plaintext OpenAPI extensions to the providers specification. These definitions are then used to generate the SQL schema and the API client. The source for the provider definitions are stored in the [__StackQL Registry__][registry]. | ||
StackQL provider definitions are defined in plaintext OpenAPI extensions to the providers specification. These definitions are then used to generate the SQL schema and the API client. The source for the provider definitions are stored in the [**StackQL Registry**][registry]. | ||
## How it works | ||
<!-- > see [__readthedocs__]() for more detailed documentation --> | ||
A __`stackql-deploy`__ project is a directory containing StackQL scripts with a manifest file at the root of the directory, for example: | ||
A **`stackql-deploy`** project is a directory containing StackQL scripts with a manifest file at the root of the directory, for example: | ||
``` | ||
├── example_stack | ||
|
@@ -115,9 +126,9 @@ resources: | |
Deployment orchestration using `stackql-deploy` includes: | ||
- __*pre-flight*__ checks, which are StackQL queries that check for the existence or current configuration state of a resource | ||
- __*deployment*__ scripts, which are StackQL queries to create or update resoruces (or delete in the case of de-provisioning) | ||
- __*post-deployment*__ tests, which are StackQL queries to confirm that resources were deployed and have the desired state | ||
- **_pre-flight_** checks, which are StackQL queries that check for the existence or current configuration state of a resource | ||
- **_deployment_** scripts, which are StackQL queries to create or update resoruces (or delete in the case of de-provisioning) | ||
- **_post-deployment_** tests, which are StackQL queries to confirm that resources were deployed and have the desired state | ||
This process is described here: | ||
|
@@ -278,16 +289,26 @@ Navigate to your `docs` directory and build the Sphinx documentation: | |
``` | ||
cd docs | ||
make html | ||
``` | ||
``` | ||
## Code Linting | ||
To maintain code quality and consistency, we use `ruff` as the linter for this project. `ruff` offers fast performance and a comprehensive set of linting rules suitable for `stackql-deploy`. You can run the lint check as follows: | ||
```bash | ||
ruff check . | ||
``` | ||
Note: If you need to install ruff, you can do so with `pip install ruff`. | ||
## Contributing | ||
Contributions are welcome and encouraged. | ||
Contributions are welcome and encouraged. | ||
## License | ||
Distributed under the MIT License. See [`LICENSE`](https://github.com/stackql/stackql-deploy/blob/main/LICENSE) for more information. | ||
## Contact | ||
Get in touch with us via Twitter at [__@stackql__][twitter], email us at [__info@stackql.io__]([email protected]) or start a conversation using [__discussions__][discussions]. | ||
Get in touch with us via Twitter at [**@stackql**][twitter], email us at [**info@stackql.io**]([email protected]) or start a conversation using [**discussions**][discussions]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[tool.poetry.group.dev.dependencies] | ||
ruff = "^0.6.9" | ||
|
||
# Tool-specific configurations | ||
|
||
# Ruff configuration (linter) | ||
[tool.ruff] | ||
line-length = 120 # Maximum allowed line length | ||
exclude = [ | ||
"docs", | ||
"examples", | ||
"images", | ||
"website", | ||
] | ||
|
||
[tool.ruff.format] | ||
quote-style = "preserve" # Preserve existing quote style (single or double) | ||
|
||
[tool.ruff.lint] | ||
select = ["E", "F", "W"] # Select specific linting rules (E: Errors, F: Pyflakes, W: Warnings) | ||
ignore = [ | ||
"F405", # Ignore 'import *' warnings | ||
] | ||
|
||
[tool.ruff.lint.isort] | ||
force-single-line = true # Force single-line imports for better readability | ||
|
||
# Black configuration (code formatter) | ||
[tool.black] | ||
line-length = 120 # Same line length limit as Ruff for consistency | ||
target-version = ['py38'] # Target Python version for formatting | ||
|
||
# Flake8 configuration (for additional linting, if needed) | ||
[tool.flake8] | ||
max-line-length = 120 # Align with Ruff's line length setting | ||
ignore = [ | ||
"E501", # Ignore long line warnings | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.