Metadata-Version: 2.4
Name: docmood
Version: 0.0.6
Summary: A Python tool that checks the grammatical mood consistency of function and method docstrings.
Author-email: Oleh <oleh.stefanovych@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Oleh Stefanovych
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/Oleh-Stefanovych/docmood
Project-URL: Repository, https://github.com/Oleh-Stefanovych/docmood
Project-URL: Issues, https://github.com/Oleh-Stefanovych/docmood/issues
Keywords: cli,docstring,grammatical mood,linter,python,tool,imperative,declarative,third-person
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
Dynamic: license-file

# docmood

A Python tool that checks the grammatical mood consistency of your function and method docstrings.

## What it does

`docmood` scans your Python project and verifies that all function/method docstrings follow a consistent grammatical style:

- **Imperative mood**: "Return the value", "Get the user", "Calculate the sum"
- **Third-person mood**: "Returns the value", "Gets the user", "Calculates the sum"

## Installation

From PyPI:

```bash
pip install docmood
```

## Usage

Run in your project directory:

```bash
docmood .
```

Or as a module:

```bash
python -m docmood /path/to/project
```

### Example Output

```
Failed docstrings:
  src/example.py:7 (detected: unknown, expected: imperative)
  src/foo_bar.py:7 (detected: unknown, expected: imperative)
========================================
[docmood] Found 20 docs: 18/20 passed (90%)
```

## Configuration

`docmood` can be configured via `pyproject.toml` or `docmood.ini` in your project root.

### Option 1: pyproject.toml (recommended)

Add a `[tool.docmood]` section:

```toml
[tool.docmood]
# Expected mood for all docstrings
# Options: "imperative" or "third_person"
# Default: "imperative"
mood = "imperative"

# Whether to allow docstrings with unknown/undetectable mood
# If true, unknown mood is counted as passed (with a warning)
# If false, unknown mood is counted as failed
# Default: true
allow_unknown = true

# Additional directory names to skip during scanning (added to defaults)
# Default dirs always skipped: .git, .hg, .svn, .mypy_cache, .pytest_cache, 
#   .ruff_cache, .tox, .nox, __pycache__, build, dist, site-packages, venv, .venv
# Example: skip_dirs = ["node_modules", "coverage"] will skip the defaults PLUS node_modules and coverage
skip_dirs = ["node_modules", "coverage"]
```

### Option 2: docmood.ini

Create a `docmood.ini` file in your project root:

```ini
[docmood]
# Expected mood for all docstrings
# Options: imperative, third_person
# Default: imperative
mood = imperative

# Whether to allow docstrings with unknown/undetectable mood
# If true, unknown mood is counted as passed (with a warning)
# If false, unknown mood is counted as failed
# Default: true
allow_unknown = true

# Comma-separated list of ADDITIONAL directory names to skip during scanning
# These are added to the default skip directories
# Default skip directories: .git,.hg,.svn,.mypy_cache,.pytest_cache,.ruff_cache,.tox,.nox,__pycache__,build,dist,site-packages,venv,.venv
# Example: If you set skip_dirs = src,node_modules, then the following will be skipped:
#   .git,.hg,.svn,.mypy_cache,.pytest_cache,.ruff_cache,.tox,.nox,__pycache__,build,dist,site-packages,venv,.venv,src,node_modules
# skip_dirs = node_modules,coverage
```

See `docmood.ini.example` for a complete example with comments.

### Configuration Options

| Option | Values | Default | Description |
|--------|--------|---------|-------------|
| `mood` | `imperative`, `third_person` | `imperative` | Expected grammatical mood for docstrings |
| `allow_unknown` | `true`, `false` | `true` | Whether to treat undetectable mood as passed |
| `skip_dirs` | List of directory names | `[]` (empty) | **Additional** directories to skip (added to defaults) |

**Directories always skipped by default**: `.git`, `.hg`, `.svn`, `.mypy_cache`, `.pytest_cache`, `.ruff_cache`, `.tox`, `.nox`, `__pycache__`, `build`, `dist`, `site-packages`, `venv`, `.venv`

**Note**: The `skip_dirs` option is **additive**. If you specify `skip_dirs = ["node_modules"]`, the tool will skip all default directories PLUS `node_modules`.

## Exit Codes

- `0`: All docstrings passed
- `1`: One or more docstrings failed validation

## Development

Development instructions live in `CONTRIBUTING.md`.

## License

MIT
