Skip to content

Commit d15f679

Browse files
authored
Merge pull request #8 from soderlind/remove/requires
feat: make Requires at least / Requires PHP optional (0.1.9), fix #4
2 parents dccdfe2 + 3e7c18b commit d15f679

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
### Security
1313
- Addresses code scanning warning related to incomplete string escaping for inline code conversion and emphasis token detection.
1414

15+
## [0.1.9] - 2025-10-27
16+
### Changed
17+
- "Requires at least" and "Requires PHP" header fields are now optional. Format validation still applies if provided.
18+
### Documentation
19+
- README updated to reflect new optional status of these fields.
20+
1521

1622
All notable changes to this project will be documented in this file.
1723

@@ -86,6 +92,7 @@ The format is based on Keep a Changelog (https://keepachangelog.com/en/1.0.0/) a
8692
[0.1.6]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.5...v0.1.6
8793
[0.1.7]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.6...v0.1.7
8894
[0.1.8]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.7...v0.1.8
95+
[0.1.9]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.8...v0.1.9
8996
[0.1.4]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.3...v0.1.4
9097
[0.1.5]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.4...v0.1.5
9198
[0.1.3]: https://github.com/soderlind/wordpress-readme-preview/compare/v0.1.1...v0.1.3

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,15 @@ A Visual Studio Code extension that provides syntax highlighting, IntelliSense,
6262
- ✅ Plugin Name (`=== Plugin Name ===`)
6363
- ✅ Contributors (WordPress.org usernames)
6464
- ✅ Tags (1-5 recommended tags)
65-
- ✅ Requires at least (WordPress version)
6665
- ✅ Tested up to (WordPress version)
6766
- ✅ Stable tag (plugin version)
6867
- ✅ License (GPL-compatible)
6968
- ✅ Short description (≤150 characters)
7069

70+
Optional (still parsed & format-validated if present):
71+
- ℹ️ Requires at least (WordPress version)
72+
- ℹ️ Requires PHP (minimum PHP version)
73+
7174
**Advanced Content Validation:**
7275
- 🎯 **Precise Error Positioning** - Exact line/column highlighting
7376
- 🚫 **False Positive Prevention** - Smart detection avoids hallucinated errors

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "wordpress-readme-preview",
33
"displayName": "WordPress Readme",
44
"description": "Preview, validate, and edit WordPress readme.txt files with syntax highlighting, IntelliSense, and accurate rendering",
5-
"version": "0.1.8",
5+
"version": "0.1.9",
66
"publisher": "persoderlind",
77
"engines": {
88
"vscode": "^1.74.0"

src/parser/readmeParser.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ export interface ReadmeHeader {
33
contributors: string[];
44
donateLink?: string;
55
tags: string[];
6-
requiresAtLeast: string;
6+
requiresAtLeast: string; // now optional (empty string allowed)
77
testedUpTo: string;
88
stableTag: string;
9-
requiresPHP?: string;
9+
requiresPHP?: string; // optional
1010
license: string;
1111
licenseURI?: string;
1212
shortDescription: string;
@@ -245,9 +245,7 @@ export class ReadmeParser {
245245
result.warnings.push('Maximum 5 tags recommended');
246246
}
247247

248-
if (!header.requiresAtLeast) {
249-
result.errors.push('Requires at least field is required');
250-
}
248+
// 'Requires at least' no longer mandatory; only validate format if present
251249

252250
if (!header.testedUpTo) {
253251
result.errors.push('Tested up to field is required');

src/parser/validator.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export class ReadmeValidator {
2626
'pluginName',
2727
'contributors',
2828
'tags',
29-
'requiresAtLeast',
3029
'testedUpTo',
3130
'stableTag',
3231
'license',

src/test/validator.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const headerLines = [
1111
'=== Plugin Name ===',
1212
'Contributors: john, jane',
1313
'Tags: tag1, tag2',
14-
'Requires at least: 1.0',
14+
// 'Requires at least' intentionally omitted to confirm optional handling
1515
'Tested up to: 6.5',
1616
'Stable tag: 1.0.0',
1717
'License: GPL',
@@ -67,6 +67,12 @@ describe('ReadmeValidator', () => {
6767
expect(r.errors.some(e => /Contributors is required/.test(e.message))).toBe(true);
6868
});
6969

70+
it('does not error when Requires at least is absent', () => {
71+
const txt = build(['== Description ==', 'Body']);
72+
const r = validate(txt);
73+
expect(r.errors.some(e => /Requires at least field is required/.test(e.message))).toBe(false);
74+
});
75+
7076
it('produces high score and no errors on clean input', () => {
7177
const txt = build([
7278
'== Description ==',

0 commit comments

Comments
 (0)