mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +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,
|
Character: entry.Fields.FilesystemType.End.Character,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Message: "The options field is missing",
|
Message: `The options field is empty. The usual convention is to use at least "defaults" keyword there.`,
|
||||||
Severity: &common.SeverityError,
|
Severity: &common.SeverityWarning,
|
||||||
})
|
|
||||||
|
|
||||||
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,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
@ -16,18 +16,26 @@ func analyzeValuesAreValid(
|
|||||||
|
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
entry := it.Value().(*ast.FstabEntry)
|
entry := it.Value().(*ast.FstabEntry)
|
||||||
mountOptions := entry.FetchMountOptionsField(true)
|
|
||||||
|
|
||||||
checkField(ctx, entry.Fields.Spec, fields.SpecField)
|
checkField(ctx, entry.Fields.Spec, fields.SpecField)
|
||||||
checkField(ctx, entry.Fields.MountPoint, fields.MountPointField)
|
checkField(ctx, entry.Fields.MountPoint, fields.MountPointField)
|
||||||
checkField(ctx, entry.Fields.FilesystemType, fields.FileSystemTypeField)
|
checkField(ctx, entry.Fields.FilesystemType, fields.FileSystemTypeField)
|
||||||
|
|
||||||
if mountOptions != nil {
|
if entry.Fields.Options != nil {
|
||||||
checkField(ctx, entry.Fields.Options, mountOptions)
|
mountOptions := entry.FetchMountOptionsField(true)
|
||||||
|
|
||||||
|
if mountOptions != nil {
|
||||||
|
checkField(ctx, entry.Fields.Options, mountOptions)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkField(ctx, entry.Fields.Freq, fields.FreqField)
|
if entry.Fields.Freq != nil {
|
||||||
checkField(ctx, entry.Fields.Pass, fields.PassField)
|
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