| | | 1 | | namespace AspxLint.Core.Rules; |
| | | 2 | | |
| | | 3 | | public sealed class Ws005Bom : IRule |
| | | 4 | | { |
| | 213 | 5 | | public string Id => "WS-005"; |
| | 38 | 6 | | public string Name => "BOM en debut de fichier"; |
| | 35 | 7 | | public Severity Severity => Severity.Warning; |
| | | 8 | | public string Description => |
| | 25 | 9 | | "Un BOM UTF-8 (\\uFEFF) en debut de fichier ASPX peut perturber le moteur ASP.NET (espaces parasites avant <!DOC |
| | 46 | 10 | | public bool HasFix => true; |
| | | 11 | | |
| | | 12 | | public IEnumerable<Issue> Detect(string content, string[] lines, RuleContext ctx) |
| | | 13 | | { |
| | | 14 | | if (content.Length > 0 && content[0] == '') |
| | | 15 | | yield return new Issue(Id, Name, Severity, |
| | | 16 | | 1, 1, "\\uFEFF (BOM)", |
| | | 17 | | "Enregistrer le fichier en UTF-8 sans BOM."); |
| | | 18 | | } |
| | | 19 | | |
| | | 20 | | public string? Fix(string content, RuleContext ctx) => |
| | 25 | 21 | | content.Length > 0 && content[0] == '' ? content[1..] : content; |
| | | 22 | | } |