Skip to content

Commit

Permalink
docs: usage-focused command help texts (#18)
Browse files Browse the repository at this point in the history
Add help text for command groups
-----------------------------------

* dependencies
* voldemort
* expensive-loop

Improve help text for `create` commands
-----------------------------------------

Create rule with <x> template
=>
Create rule to <achieve a goal>

how => what

Fix README
--------------

fix: order of paragraphs in the README

version 0.6.1
  • Loading branch information
reka authored Mar 5, 2023
1 parent 588a62d commit 7493fba
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 20 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.6.1] - 2023-03-05

### Added

* Help for command groups.

### Updated

* Help for `create` commands: more usage-focused

### Fixed

* README: order of paragraphs

## [0.6.0] - 2023-02-16

### Added
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,6 @@ Loops often cause performance problems. Especially, if they execute expensive op
sourcery-rules expensive-loop create
```

## Using the Generated Rules

The generated rules can be used by Sourcery to review your project.
If you copy the generated rules into your project's `.sourcery.yaml`, Sourcery will use them automatically.

All the generated rules have the tag `architecture`. Once you've copied them to your `.sourcery.yaml`, you can run them with:

```
sourcery review --enable architecture .
```

You'll be prompted to provide:

* the fully qualified name of the function that shouldn't be called in loops
Expand All @@ -163,3 +152,14 @@ You'll be prompted to provide:

* for `for` loops
* for `while` loops

## Using the Generated Rules

The generated rules can be used by Sourcery to review your project.
If you copy the generated rules into your project's `.sourcery.yaml`, Sourcery will use them automatically.

All the generated rules have the tag `architecture`. Once you've copied them to your `.sourcery.yaml`, you can run them with:

```
sourcery review --enable architecture .
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sourcery-rules-generator"
version = "0.6.0"
version = "0.6.1"
description = "Generate architecture rules for Python projects."
license = "MIT"
authors = ["reka <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion sourcery_rules_generator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.0"
__version__ = "0.6.1"
12 changes: 9 additions & 3 deletions sourcery_rules_generator/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
from sourcery_rules_generator import __version__

app = typer.Typer(rich_markup_mode="markdown")
app.add_typer(dependencies_cli.app, name="dependencies")
app.add_typer(voldemort_cli.app, name="voldemort")
app.add_typer(expensive_loop_cli.app, name="expensive-loop")
app.add_typer(
dependencies_cli.app, name="dependencies", help="Detect not allowed imports."
)
app.add_typer(voldemort_cli.app, name="voldemort", help="Detect deny-listed words.")
app.add_typer(
expensive_loop_cli.app,
name="expensive-loop",
help="Detect expensive calls in loops.",
)


@app.callback(invoke_without_command=True)
Expand Down
5 changes: 4 additions & 1 deletion sourcery_rules_generator/cli/dependencies_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def create(
help='Display less info about the "Dependencies" template.',
),
):
"""Create a new Sourcery dependency rule."""
"""Create rules to check the dependencies between packages of a project.
Create rules to verify that internal and external packages are imported only by the allowed parts of a project.
"""
interactive = sys.stdin.isatty() and interactive_flag
stderr_console = Console(stderr=True)
if interactive and not quiet:
Expand Down
2 changes: 1 addition & 1 deletion sourcery_rules_generator/cli/expensive_loop_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create(
help='Display less info about the "Expensive Loop" template.',
),
):
"""Create a new Sourcery Expensive Loop rule."""
"""Create a rule to detect an expensive call in a loop."""
interactive = sys.stdin.isatty() and interactive_flag
stderr_console = Console(stderr=True)
if interactive and not quiet:
Expand Down
2 changes: 1 addition & 1 deletion sourcery_rules_generator/cli/voldemort_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create(
help='Display less info about the "Voldemort" template.',
),
):
"""Create a new Sourcery Voldemort rule."""
"""Create a rule to flag a deny-listed word."""
interactive = sys.stdin.isatty() and interactive_flag
stderr_console = Console(stderr=True)
if interactive and not quiet:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == "0.6.0"
assert __version__ == "0.6.1"

0 comments on commit 7493fba

Please sign in to comment.