-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
701 additions
and
0 deletions.
There are no files selected for viewing
Empty 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 @@ | ||
Manual folder for detailed documentation |
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,109 @@ | ||
// development.adoc - Development guide | ||
= Development Guide | ||
|
||
== Setting Up Development Environment | ||
|
||
=== Clone the Repository | ||
|
||
[source,bash] | ||
---- | ||
git clone https://github.com/yourusername/asciidoc-linter.git | ||
cd asciidoc-linter | ||
---- | ||
|
||
=== Create Virtual Environment | ||
|
||
[source,bash] | ||
---- | ||
python -m venv venv | ||
source venv/bin/activate # On Windows: venv\Scripts\activate | ||
pip install -e . | ||
---- | ||
|
||
== Project Structure | ||
|
||
[source] | ||
---- | ||
asciidoc-linter/ | ||
├── asciidoc_linter/ # Main package | ||
│ ├── __init__.py | ||
│ ├── cli.py # Command line interface | ||
│ ├── rules.py # Base rule classes | ||
│ ├── heading_rules.py # Heading-specific rules | ||
│ ├── parser.py # AsciiDoc parser | ||
│ └── reporter.py # Output formatters | ||
├── tests/ # Test files | ||
│ └── rules/ | ||
│ └── test_heading_rules.py | ||
├── docs/ # Documentation | ||
└── README.adoc | ||
---- | ||
|
||
== Adding New Rules | ||
|
||
=== Rule Implementation Steps | ||
|
||
1. Create a new rule class: | ||
+ | ||
[source,python] | ||
---- | ||
from .rules import Rule, Finding, Severity, Position | ||
class MyNewRule(Rule): | ||
def __init__(self): | ||
super().__init__() | ||
self.id = "NEW001" | ||
@property | ||
def description(self) -> str: | ||
return "Description of what this rule checks" | ||
def check(self, content: str) -> List[Finding]: | ||
findings = [] | ||
# Implementation here | ||
return findings | ||
---- | ||
|
||
2. Add tests for the rule | ||
3. Register the rule in the linter | ||
4. Update documentation | ||
|
||
=== Rule Guidelines | ||
|
||
* Clear rule IDs and descriptions | ||
* Meaningful error messages | ||
* Proper severity levels | ||
* Contextual information in findings | ||
|
||
== Code Style | ||
|
||
=== Python Guidelines | ||
|
||
* Follow PEP 8 | ||
* Use type hints | ||
* Write docstrings | ||
* Keep functions focused | ||
|
||
=== Documentation Guidelines | ||
|
||
* Use AsciiDoc format | ||
* Include examples | ||
* Explain error messages | ||
* Document configuration options | ||
|
||
== Pull Request Process | ||
|
||
1. Create feature branch | ||
2. Implement changes | ||
3. Add/update tests | ||
4. Update documentation | ||
5. Submit PR | ||
|
||
== Release Process | ||
|
||
1. Update version number | ||
2. Update changelog | ||
3. Run full test suite | ||
4. Create release notes | ||
5. Tag release | ||
6. Build and publish |
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 @@ | ||
Development guide |
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,16 @@ | ||
// index.adoc - Main documentation | ||
= AsciiDoc Linter Manual | ||
:toc: left | ||
:icons: font | ||
:source-highlighter: rouge | ||
:experimental: | ||
|
||
include::introduction.adoc[leveloffset=+1] | ||
|
||
include::development.adoc[leveloffset=+1] | ||
|
||
include::testing.adoc[leveloffset=+1] | ||
|
||
include::usage.adoc[leveloffset=+1] | ||
|
||
include::rules.adoc[leveloffset=+1] |
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 @@ | ||
Main documentation file that includes all other parts |
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,64 @@ | ||
// introduction.adoc - Project introduction | ||
= Introduction | ||
|
||
== About the Project | ||
|
||
AsciiDoc Linter is a Python-based tool designed to help maintain high-quality AsciiDoc documentation. It checks your AsciiDoc files for common issues and style violations, helping teams maintain consistent documentation standards. | ||
|
||
== Key Features | ||
|
||
* Heading structure validation | ||
* Format checking | ||
* Style consistency enforcement | ||
* Multiple output formats | ||
* Configurable rules | ||
|
||
== Project Goals | ||
|
||
* Improve documentation quality | ||
* Enforce consistent styling | ||
* Reduce review effort | ||
* Catch common mistakes early | ||
* Support documentation as code | ||
|
||
== Technical Overview | ||
|
||
.Technology Stack | ||
[cols="1,4"] | ||
|=== | ||
|Component |Description | ||
|
||
|Language | ||
|Python 3.8+ | ||
|
||
|Testing | ||
|unittest framework | ||
|
||
|Documentation | ||
|AsciiDoc | ||
|
||
|Configuration | ||
|YAML/JSON (planned) | ||
|=== | ||
|
||
== Getting Started | ||
|
||
=== Prerequisites | ||
|
||
* Python 3.8 or higher | ||
* pip (Python package manager) | ||
* Git (for development) | ||
|
||
=== Quick Start | ||
|
||
[source,bash] | ||
---- | ||
# Install the package | ||
pip install asciidoc-linter | ||
# Run a basic check | ||
asciidoc-lint your-document.adoc | ||
# Get help | ||
asciidoc-lint --help | ||
---- |
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 @@ | ||
Introduction to the 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 |
---|---|---|
@@ -0,0 +1,188 @@ | ||
// rules.adoc - Rule documentation | ||
= Rule Reference | ||
|
||
== Heading Rules | ||
|
||
=== HEAD001: Heading Incrementation | ||
|
||
Ensures that heading levels are properly incremented and no levels are skipped. | ||
|
||
.Valid Example | ||
[source,asciidoc] | ||
---- | ||
= Level 1 | ||
== Level 2 | ||
=== Level 3 | ||
---- | ||
|
||
.Invalid Example | ||
[source,asciidoc] | ||
---- | ||
= Level 1 | ||
=== Level 3 # Error: Skipped level 2 | ||
---- | ||
|
||
.Configuration Options | ||
[cols="1,1,2"] | ||
|=== | ||
|Option |Default |Description | ||
|
||
|enabled | ||
|true | ||
|Enable/disable rule | ||
|
||
|severity | ||
|error | ||
|Rule severity level | ||
|=== | ||
|
||
=== HEAD002: Heading Format | ||
|
||
Checks heading format for proper spacing and capitalization. | ||
|
||
.Valid Example | ||
[source,asciidoc] | ||
---- | ||
= Title | ||
== Section | ||
=== Subsection | ||
---- | ||
|
||
.Invalid Examples | ||
[source,asciidoc] | ||
---- | ||
=Title # Error: Missing space | ||
= title # Warning: Lowercase | ||
==Section # Error: Missing space | ||
---- | ||
|
||
.Configuration Options | ||
[cols="1,1,2"] | ||
|=== | ||
|Option |Default |Description | ||
|
||
|enabled | ||
|true | ||
|Enable/disable rule | ||
|
||
|severity | ||
|error | ||
|Rule severity level | ||
|
||
|check_case | ||
|true | ||
|Check for proper capitalization | ||
|=== | ||
|
||
=== HEAD003: Multiple Top-Level Headings | ||
|
||
Ensures there is only one top-level heading per document. | ||
|
||
.Valid Example | ||
[source,asciidoc] | ||
---- | ||
= Document Title | ||
== Section 1 | ||
== Section 2 | ||
---- | ||
|
||
.Invalid Example | ||
[source,asciidoc] | ||
---- | ||
= First Title | ||
== Section 1 | ||
= Second Title # Error: Multiple top-level headings | ||
---- | ||
|
||
.Configuration Options | ||
[cols="1,1,2"] | ||
|=== | ||
|Option |Default |Description | ||
|
||
|enabled | ||
|true | ||
|Enable/disable rule | ||
|
||
|severity | ||
|error | ||
|Rule severity level | ||
|=== | ||
|
||
== Planned Rules | ||
|
||
=== BLOCK001: Block Termination | ||
|
||
[.planned] | ||
Checks for properly terminated blocks. | ||
|
||
.Valid Example | ||
[source,asciidoc] | ||
---- | ||
[source,python] | ||
---- | ||
def hello(): | ||
print("Hello") | ||
---- | ||
---- | ||
|
||
.Invalid Example | ||
[source,asciidoc] | ||
---- | ||
[source,python] | ||
---- | ||
def hello(): | ||
print("Hello") | ||
# Missing block termination | ||
---- | ||
=== WS001: Whitespace | ||
[.planned] | ||
Ensures proper spacing around elements. | ||
.Valid Example | ||
[source,asciidoc] | ||
---- | ||
= Title | ||
|
||
== Section | ||
|
||
Some content. | ||
|
||
[source] | ||
---- | ||
code | ||
---- | ||
---- | ||
== Rule Development | ||
=== Creating New Rules | ||
1. Extend the base Rule class | ||
2. Implement check method | ||
3. Add tests | ||
4. Document the rule | ||
=== Rule Guidelines | ||
* Clear error messages | ||
* Meaningful context | ||
* Configurable options | ||
* Performance conscious | ||
== Rule Categories | ||
=== Current Categories | ||
* Heading Rules (HEAD*) | ||
* Block Rules (BLOCK*) | ||
* Whitespace Rules (WS*) | ||
* Format Rules (FMT*) | ||
=== Planned Categories | ||
* Table Rules (TABLE*) | ||
* Image Rules (IMG*) | ||
* Link Rules (LINK*) | ||
* Reference Rules (REF*) |
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 @@ | ||
Documentation of all rules |
Oops, something went wrong.