Skip to content

Commit 6c71d18

Browse files
committed
initial url checker tool
1 parent 8a802b5 commit 6c71d18

File tree

7 files changed

+2525
-0
lines changed

7 files changed

+2525
-0
lines changed

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,15 @@ FodyWeavers.xsd
398398

399399
# JetBrains Rider
400400
*.sln.iml
401+
402+
# URL Checker specific files
403+
tools/url-checker/logs/
404+
tools/url-checker/test_files/
405+
406+
# Backup folders
407+
backup/
408+
backups/
409+
*_backup/
410+
*_backups/
411+
*-backup/
412+
*.bak/

tools/url-checker/README.md

Whitespace-only changes.
+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# URL Checker Test File Generator
2+
3+
This document provides detailed information about the `create_test_files.py` script, which generates test environments for validating the URL checker.
4+
5+
## Overview
6+
7+
The test file generator creates a realistic directory structure containing a variety of file types with different kinds of URLs (absolute, relative, valid, invalid). This allows you to thoroughly test the URL checker's ability to handle complex scenarios.
8+
9+
## Requirements
10+
11+
- Python 3.8 or higher
12+
- Required dependencies:
13+
- `colorama` - For colored terminal output
14+
15+
```bash
16+
pip install colorama
17+
```
18+
19+
## Quick Start
20+
21+
```bash
22+
# Create test files with default settings
23+
python create_test_files.py
24+
25+
# Run URL checker on test files
26+
python url_checker.py --dir=test_files
27+
28+
# Clean up when done
29+
python create_test_files.py --clean
30+
```
31+
32+
## Command Line Options
33+
34+
| Option | Default | Description |
35+
|--------|---------|-------------|
36+
| `--dir` | "test_files" | Directory where test files will be created |
37+
| `--clean` | False | Remove existing test files before creating new ones |
38+
| `--file-count` | 5 | Base number of files per type (actual counts vary by file type) |
39+
| `--complexity` | 3 | Directory structure complexity level (1=simple, 5=very complex) |
40+
41+
## Complexity Levels
42+
43+
The `--complexity` parameter controls how complex and nested the directory structure will be:
44+
45+
- **Level 1**: Simple, flat structure with minimal nesting and few special directories
46+
- **Level 2**: Basic structure with standard project directories and moderate nesting
47+
- **Level 3**: Moderate complexity with deeper nesting and some special directories (default)
48+
- **Level 4**: Complex structure with deep nesting and many special directories
49+
- **Level 5**: Very complex with deep nesting, special characters, unusual directory names, and complex relative paths
50+
51+
Higher complexity levels generate more:
52+
- Deeply nested directories (up to 5+ levels deep)
53+
- Special directories with spaces and special characters
54+
- Random subdirectories with varied naming conventions
55+
- Complex relative URLs with parent directory traversal
56+
57+
## Generated Files & URLs
58+
59+
Each file type uses a template that includes:
60+
61+
1. **Absolute URLs**:
62+
- Valid URLs to common websites (GitHub, Microsoft, etc.)
63+
- Invalid URLs to non-existent domains/pages
64+
65+
2. **Relative URLs**:
66+
- Direct paths (`docs/guide.md`)
67+
- Paths with current directory notation (`./images/logo.png`)
68+
- Parent directory traversal (`../config/settings.json`)
69+
- Directory paths ending with `/`
70+
- Deliberately broken paths for negative testing
71+
72+
## Directory Structure
73+
74+
The generator creates a project-like structure at the base level:
75+
76+
## Output Features
77+
78+
The test file generator provides enhanced terminal output with:
79+
80+
- Color-coded summary information (using colorama)
81+
- Categorized file and URL statistics
82+
- Emoji indicators for better visibility
83+
- Progress updates during file creation
84+
85+
Example terminal output:
86+
87+
```
88+
================================================================================
89+
TEST ENVIRONMENT SUMMARY
90+
================================================================================
91+
92+
📁 DIRECTORY STRUCTURE:
93+
• Total directories: 42
94+
• Maximum directory depth: 5 levels
95+
• Special directories: 7 (with spaces, special characters, etc.)
96+
Examples: Directory With Spaces, mixed-CASE-directory, special_chars-&!
97+
98+
📄 FILE STATISTICS:
99+
• Total files created: 156
100+
• Files by type:
101+
- .md: 28 files
102+
- .html: 18 files
103+
- .js: 15 files
104+
- .py: 12 files
105+
- .sh: 10 files
106+
// ...more file types...
107+
108+
🔗 URL VARIATIONS:
109+
• Direct paths: ~62 URLs
110+
• Dot-prefixed paths (./): ~31 URLs
111+
• Parent traversal (../): ~31 URLs
112+
• Directory paths (ending with /): ~15 URLs
113+
• Invalid paths (for testing): ~15 URLs
114+
115+
🧪 TEST CONFIGURATION:
116+
• Complexity level: 3/5
117+
• Base file count: 5 per type
118+
119+
🚀 NEXT STEPS:
120+
• Run URL checker on test files only:
121+
python url_checker.py --dir=test_files
122+
• Clean up when done:
123+
python create_test_files.py --dir=test_files --clean
124+
```
125+
126+
## Compatibility
127+
128+
The test file generator is compatible with:
129+
- Windows, macOS, and Linux operating systems
130+
- Both colored and non-colored terminals (using colorama for cross-platform support)
131+
- CI/CD environments like GitHub Actions
132+

0 commit comments

Comments
 (0)