-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HDX-9928 add documentation and ruff dev dependency
- Loading branch information
Showing
4 changed files
with
95 additions
and
0 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
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,60 @@ | ||
Code Quality | ||
============ | ||
|
||
Linter Configuration | ||
++++++++++++++++++++ | ||
This section outlines how to configure the linter, Ruff, for your local development environment in PyCharm. | ||
|
||
Installing Ruff Linter | ||
---------------------- | ||
|
||
Since we utilize CKAN within a Docker container, you'll need Ruff installed locally on your development machine. | ||
|
||
Ruff is available as ``ruff`` on PyPI: | ||
|
||
:: | ||
|
||
pip install ruff | ||
|
||
Starting with version ``0.5.0``, Ruff can be installed using their standalone installers: | ||
|
||
:: | ||
|
||
# On macOS and Linux. | ||
curl -LsSf https://astral.sh/ruff/install.sh | sh | ||
|
||
# On Windows. | ||
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex" | ||
|
||
# For a specific version. | ||
curl -LsSf https://astral.sh/ruff/0.5.0/install.sh | sh | ||
powershell -c "irm https://astral.sh/ruff/0.5.0/install.ps1 | iex" | ||
|
||
For **macOS Homebrew** and **Linuxbrew** users, Ruff is also available as ``ruff`` on Homebrew: | ||
|
||
:: | ||
|
||
brew install ruff | ||
|
||
Enabling Ruff Extension in PyCharm | ||
---------------------------------- | ||
|
||
1. Open `File` > `Settings` (or `Preferences` on macOS) > `Plugins`. | ||
2. Ensure the ``Marketplace`` tab is active. | ||
3. Search for and install the ``Ruff`` extension. | ||
|
||
Configuring Ruff Extension in PyCharm | ||
------------------------------------- | ||
|
||
1. Go to `File` > `Settings` (or `Preferences` on macOS) > `Tools` > `Ruff`. | ||
2. Verify that only the following options are checked: | ||
|
||
* ``Run ruff when Reformat Code`` | ||
* ``Show Rule Code on inspection message`` | ||
|
||
3. Set the Ruff executable path in the ``Global`` section if it is not already set. | ||
|
||
Ruff Configuration File | ||
----------------------- | ||
|
||
The configuration for Ruff can be found in the project root directory in the ``pyproject.toml`` file. |
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,28 @@ | ||
Code Quality | ||
============ | ||
|
||
Type Checker Configuration | ||
++++++++++++++++++++++++++ | ||
This section details enabling and configuring type checking within PyCharm. | ||
|
||
Enabling Type Checking in PyCharm | ||
--------------------------------- | ||
|
||
1. Go to `File` > `Settings` (or `Preferences` on macOS) > `Editor` > `Inspections`. | ||
2. Enable the following inspections: | ||
|
||
* Python > ``Incorrect type`` | ||
* Python > ``Missing type hinting for function definition`` | ||
|
||
3. For the ``Missing type hinting for function definition`` inspection, click on it and uncheck the ``Only when types are known`` option. | ||
|
||
Optional Configuration | ||
---------------------- | ||
|
||
1. You can adjust the severity level to ``Warning`` or ``Error`` for both inspections by clicking on them and selecting the desired level under the ``Severity`` option. | ||
|
||
Manually Running Type Checking Inspections | ||
------------------------------------------ | ||
|
||
1. Go to `Code` > `Inspect Code`. | ||
2. Choose the scope (e.g., `Current File` or `Whole Project`). |
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 |
---|---|---|
|
@@ -26,3 +26,4 @@ pytest-rerunfailures==10.2 | |
towncrier==22.8.0 | ||
|
||
moto==2.3.2 | ||
ruff==0.5.5 |