Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: main

on:
push:
branches:
- main
pull_request: {}

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- run: uv python install 3.10
- run: just install lint-ci

pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- run: uv python install ${{ matrix.python-version }}
- run: just install
- run: just test . --cov=. --cov-report xml
- uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: ./coverage.xml
flags: unittests
name: codecov-${{ matrix.python-version }}
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish Package

on:
release:
types:
- published

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: astral-sh/setup-uv@v3
- run: just publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
20 changes: 0 additions & 20 deletions .github/workflows/workflow.yml

This file was deleted.

10 changes: 5 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ just lint # Includes auto-formatting
### Using the Tool
```bash
# Fix files in a directory (modifies files)
python -m end_of_file_fixer.main /path/to/directory
python -m eof_fixer.main /path/to/directory

# Check files in a directory (dry run)
python -m end_of_file_fixer.main /path/to/directory --check
python -m eof_fixer.main /path/to/directory --check
```

Or using the installed script:
```bash
# Fix files
end-of-file-fixer /path/to/directory
eof-fixer /path/to/directory

# Check files
end-of-file-fixer /path/to/directory --check
eof-fixer /path/to/directory --check
```

## Development Conventions
Expand All @@ -79,7 +79,7 @@ end-of-file-fixer /path/to/directory --check

### Project Structure
```
end-of-file-fixer/
eof-fixer/
├── end_of_file_fixer/ # Main package
│ ├── __init__.py # Package initializer
│ └── main.py # Main CLI implementation
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Many POSIX systems expect text files to end with a newline character. Having con
### Using uv

```bash
uv add end-of-file-fixer
uv add eof-fixer
```

### Using pip

```bash
pip install end-of-file-fixer
pip install eof-fixer
```

## Usage
Expand All @@ -41,18 +41,18 @@ pip install end-of-file-fixer
To fix all files in the current directory and subdirectories:

```bash
end-of-file-fixer .
eof-fixer .
```

To check which files would be modified without making changes:

```bash
end-of-file-fixer . --check
eof-fixer . --check
```

## How It Works

The end-of-file-fixer processes files in the following way:
The eof-fixer processes files in the following way:

1. **Files with no trailing newline**: Adds exactly one newline at the end
2. **Files with exactly one trailing newline**: Leaves unchanged
Expand Down Expand Up @@ -89,8 +89,8 @@ The tool automatically respects patterns in your `.gitignore` file, so it won't

```bash
# Clone the repository
git clone https://github.com/community-of-python/end-of-file-fixer.git
cd end-of-file-fixer
git clone https://github.com/modern-python/eof-fixer.git
cd eof-fixer

# Install dependencies
just install
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "end-of-file-fixer"
name = "eof-fixer"
description = "A command-line tool that ensures all your text files end with exactly one newline character"
readme = "README.md"
requires-python = ">=3.10,<4"
dependencies = [
"pathspec",
]
version = "0"
authors = [{ name = "community-of-python" }]
authors = [{ name = "modern-python" }]
keywords = [
"python",
]
Expand All @@ -21,12 +21,12 @@ classifiers = [
]

[project.urls]
Repository = "https://github.com/community-of-python/end-of-file-fixer"
Issues = "https://github.com/community-of-python/end-of-file-fixer/issues"
Changelogs = "https://github.com/community-of-python/end-of-file-fixer/releases"
Repository = "https://github.com/modern-python/eof-fixer"
Issues = "https://github.com/modern-python/eof-fixer/issues"
Changelogs = "https://github.com/modern-python/eof-fixer/releases"

[project.scripts]
end-of-file-fixer = "end_of_file_fixer.main:main"
eof-fixer = "eof_fixer.main:main"

[dependency-groups]
dev = [
Expand All @@ -41,7 +41,7 @@ requires = ["uv_build"]
build-backend = "uv_build"

[tool.uv.build-backend]
module-name = "end_of_file_fixer"
module-name = "eof_fixer"
module-root = ""

[tool.mypy]
Expand Down
18 changes: 9 additions & 9 deletions tests/test_end_of_file_fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from io import StringIO
from pathlib import Path

from end_of_file_fixer.main import main
from eof_fixer.main import main


def test_end_of_file_fixer_command_with_check_false() -> None:
Expand All @@ -26,10 +26,10 @@ def test_end_of_file_fixer_command_with_check_false() -> None:

try:
os.chdir(temp_dir)
sys.argv = ["end-of-file-fixer", "."]
sys.argv = ["eof-fixer", "."]
sys.stdout = captured_output

# Run end-of-file-fixer . command
# Run eof-fixer . command
result = main()

# Should exit with code 1 (since some files needed fixing)
Expand Down Expand Up @@ -90,10 +90,10 @@ def test_end_of_file_fixer_command_with_check_true() -> None:

try:
os.chdir(temp_dir)
sys.argv = ["end-of-file-fixer", ".", "--check"]
sys.argv = ["eof-fixer", ".", "--check"]
sys.stdout = captured_output

# Run end-of-file-fixer . --check command
# Run eof-fixer . --check command
result = main()

# Should exit with code 1 (since some files need fixing)
Expand Down Expand Up @@ -150,10 +150,10 @@ def test_end_of_file_fixer_with_gitignore() -> None:

try:
os.chdir(temp_dir)
sys.argv = ["end-of-file-fixer", "."]
sys.argv = ["eof-fixer", "."]
sys.stdout = captured_output

# Run end-of-file-fixer . command
# Run eof-fixer . command
result = main()

# Should exit with code 1 (since some files needed fixing)
Expand Down Expand Up @@ -216,10 +216,10 @@ def test_end_of_file_fixer_skips_binary_files() -> None:

try:
os.chdir(temp_dir)
sys.argv = ["end-of-file-fixer", "."]
sys.argv = ["eof-fixer", "."]
sys.stdout = captured_output

# Run end-of-file-fixer . command
# Run eof-fixer . command
result = main()

# Should exit with code 1 (since the text file needed fixing)
Expand Down
Loading