mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 15:05:28 +02:00
fix(fstab): Make options, freq and spec optional
This commit is contained in:
parent
3ca0ea8c35
commit
9f927b8685
@ -83,46 +83,8 @@ func analyzeFieldAreFilled(
|
||||
Character: entry.Fields.FilesystemType.End.Character,
|
||||
},
|
||||
},
|
||||
Message: "The options field is missing",
|
||||
Severity: &common.SeverityError,
|
||||
})
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if entry.Fields.Freq == nil || entry.Fields.Freq.Value.Value == "" {
|
||||
ctx.diagnostics = append(ctx.diagnostics, protocol.Diagnostic{
|
||||
Range: protocol.Range{
|
||||
Start: protocol.Position{
|
||||
Line: entry.Fields.Start.Line,
|
||||
Character: entry.Fields.Options.End.Character,
|
||||
},
|
||||
End: protocol.Position{
|
||||
Line: entry.Fields.Start.Line,
|
||||
Character: entry.Fields.Options.End.Character,
|
||||
},
|
||||
},
|
||||
Message: "The freq field is missing",
|
||||
Severity: &common.SeverityError,
|
||||
})
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if entry.Fields.Pass == nil || entry.Fields.Pass.Value.Value == "" {
|
||||
ctx.diagnostics = append(ctx.diagnostics, protocol.Diagnostic{
|
||||
Range: protocol.Range{
|
||||
Start: protocol.Position{
|
||||
Line: entry.Fields.Start.Line,
|
||||
Character: entry.Fields.Freq.End.Character,
|
||||
},
|
||||
End: protocol.Position{
|
||||
Line: entry.Fields.Start.Line,
|
||||
Character: entry.Fields.Freq.End.Character,
|
||||
},
|
||||
},
|
||||
Message: "The pass field is missing",
|
||||
Severity: &common.SeverityError,
|
||||
Message: `The options field is empty. The usual convention is to use at least "defaults" keyword there.`,
|
||||
Severity: &common.SeverityWarning,
|
||||
})
|
||||
|
||||
continue
|
||||
|
@ -16,18 +16,26 @@ func analyzeValuesAreValid(
|
||||
|
||||
for it.Next() {
|
||||
entry := it.Value().(*ast.FstabEntry)
|
||||
mountOptions := entry.FetchMountOptionsField(true)
|
||||
|
||||
checkField(ctx, entry.Fields.Spec, fields.SpecField)
|
||||
checkField(ctx, entry.Fields.MountPoint, fields.MountPointField)
|
||||
checkField(ctx, entry.Fields.FilesystemType, fields.FileSystemTypeField)
|
||||
|
||||
if mountOptions != nil {
|
||||
checkField(ctx, entry.Fields.Options, mountOptions)
|
||||
if entry.Fields.Options != nil {
|
||||
mountOptions := entry.FetchMountOptionsField(true)
|
||||
|
||||
if mountOptions != nil {
|
||||
checkField(ctx, entry.Fields.Options, mountOptions)
|
||||
}
|
||||
}
|
||||
|
||||
checkField(ctx, entry.Fields.Freq, fields.FreqField)
|
||||
checkField(ctx, entry.Fields.Pass, fields.PassField)
|
||||
if entry.Fields.Freq != nil {
|
||||
checkField(ctx, entry.Fields.Freq, fields.FreqField)
|
||||
}
|
||||
|
||||
if entry.Fields.Pass != nil {
|
||||
checkField(ctx, entry.Fields.Pass, fields.PassField)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user