Skip to content

Commit

Permalink
BLOCK001 & BLOCK002
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmueller committed Nov 27, 2024
1 parent d5dc9ca commit a286be1
Show file tree
Hide file tree
Showing 26 changed files with 1,253 additions and 9 deletions.
Binary file added .coverage
Binary file not shown.
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# .flake8 - Flake8 configuration
[flake8]
max-line-length = 88
extend-ignore = E203, W503
exclude =
.git,
__pycache__,
build,
dist,
*.egg-info
per-file-ignores =
# F401: imported but unused
__init__.py: F401
1 change: 1 addition & 0 deletions .flake8.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Flake8 configuration
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# ci.yml - GitHub Actions workflow for CI/CD
name: CI/CD

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test]
- name: Run tests
run: |
python run_tests.py
- name: Upload coverage reports
uses: codecov/codecov-action@v3
if: matrix.python-version == '3.11'

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black isort
- name: Check code style
run: |
black --check .
isort --check-only .
flake8 .
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[docs]
- name: Build documentation
run: |
cd docs
make html
- name: Deploy documentation
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
1 change: 1 addition & 0 deletions .github/workflows/ci.yml.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GitHub Actions workflow for CI/CD
212 changes: 212 additions & 0 deletions asciidoc_linter.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
Metadata-Version: 2.1
Name: asciidoc-linter
Version: 0.1.0
Summary: A linter for AsciiDoc files
Home-page: https://github.com/yourusername/asciidoc-linter
Author: Your Name
Author-email: [email protected]
Keywords: asciidoc,linter,documentation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Documentation
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: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/x-asciidoc
Requires-Dist: click>=8.0.0
Requires-Dist: pyyaml>=5.1
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: black; extra == "test"
Requires-Dist: isort; extra == "test"
Requires-Dist: flake8; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx; extra == "docs"
Requires-Dist: sphinx-rtd-theme; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"

// README.adoc - Project documentation
= AsciiDoc Linter
:toc: left
:icons: font
:source-highlighter: rouge
:experimental:

image:https://img.shields.io/badge/license-MIT-blue.svg[License: MIT, link=https://opensource.org/licenses/MIT]
image:https://img.shields.io/badge/python-3.8+-blue.svg[Python Version]

A Python-based linter for AsciiDoc files that helps maintain consistent documentation quality and style.

== About

AsciiDoc Linter is a command-line tool that checks your AsciiDoc files for common issues and style violations. It helps maintain consistent documentation by enforcing rules for heading structure, formatting, and more.

[NOTE]
====
This project was developed with the assistance of an AI language model (GPT-4) as part of an experiment in AI-assisted development. The AI helped design the architecture, implement the code, and create the documentation.
====

== Features

=== Implemented Rules

[cols="1,2,1"]
|===
|Rule ID |Description |Severity

|HEAD001
|Check for proper heading incrementation (no skipping levels)
|ERROR

|HEAD002
|Verify heading format (spacing and capitalization)
|ERROR/WARNING

|HEAD003
|Detect multiple top-level headers
|ERROR
|===

=== Planned Rules

* BLOCK001: Unterminated block warnings
* WS001: Blank lines around headers and blocks
* TABLE001: Table formatting consistency
* IMG001: Image alt text presence
* LINK001: Broken internal references
* FMT001: Markdown-compatible styles detection

== Installation

[source,bash]
----
# Clone the repository
git clone https://github.com/yourusername/asciidoc-linter.git

# Navigate to the project directory
cd asciidoc-linter

# Install the package
pip install .
----

== Usage

=== Basic Usage

[source,bash]
----
# Check a single file
asciidoc-lint document.adoc

# Check multiple files
asciidoc-lint doc1.adoc doc2.adoc

# Check with specific output format
asciidoc-lint --format json document.adoc
----

=== Output Formats

The linter supports three output formats:

* `console` (default): Human-readable output
* `json`: Machine-readable JSON format
* `html`: HTML report format

=== Example Output

[source]
----
Checking file: document.adoc

ERROR: Heading level skipped: found h3 after h1 (line 15)
=== Advanced Topics

WARNING: Heading should start with uppercase letter (line 23)
== introduction to concepts

ERROR: Multiple top-level headings found (line 30)
First heading at line 1: 'Document Title'
----

== Development

=== Running Tests

[source,bash]
----
# Run all tests
python run_tests.py

# Run specific test file
python -m unittest tests/rules/test_heading_rules.py
----

=== Project Structure

[source]
----
asciidoc-linter/
├── asciidoc_linter/
│ ├── __init__.py
│ ├── cli.py
│ ├── rules.py
│ ├── heading_rules.py
│ ├── parser.py
│ └── reporter.py
├── tests/
│ └── rules/
│ └── test_heading_rules.py
├── docs/
│ └── requirements.adoc
├── README.adoc
└── run_tests.py
----

== Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

=== Development Guidelines

1. Write tests for new rules
2. Update documentation
3. Follow Python code style guidelines
4. Add appropriate error messages and context

== License

This project is licensed under the MIT License - see the LICENSE file for details.

== Acknowledgments

* This project was developed with the assistance of GPT-4, demonstrating the potential of AI-assisted development
* Inspired by various linting tools and the need for better AsciiDoc quality control
* Thanks to the AsciiDoc community for their excellent documentation and tools

== Roadmap

1. Phase 1 (Current)
* ✅ Basic heading rules
* ⏳ Block structure rules
* ⏳ Configuration system

2. Phase 2
* 🔲 Table validation
* 🔲 Link checking
* 🔲 Image validation

3. Phase 3
* 🔲 IDE integration
* 🔲 Git pre-commit hooks
* 🔲 Custom rule development

== Contact

* Project Homepage: https://github.com/yourusername/asciidoc-linter
* Issue Tracker: https://github.com/yourusername/asciidoc-linter/issues
Loading

0 comments on commit a286be1

Please sign in to comment.