feat(aa-log): minor improvment in rule generation & formatting.
This commit is contained in:
parent
fbdf9cea64
commit
83bc7d3ade
7 changed files with 97 additions and 34 deletions
|
|
@ -118,6 +118,21 @@ func (r *File) String() string {
|
|||
}
|
||||
|
||||
func (r *File) Validate() error {
|
||||
if !isAARE(r.Path) {
|
||||
return fmt.Errorf("'%s' is not a valid AARE", r.Path)
|
||||
}
|
||||
for _, v := range r.Access {
|
||||
if v == "" {
|
||||
continue
|
||||
}
|
||||
if !slices.Contains(requirements[r.Kind()]["access"], v) ||
|
||||
!slices.Contains(requirements[r.Kind()]["transition"], v) {
|
||||
return fmt.Errorf("invalid mode '%s'", v)
|
||||
}
|
||||
}
|
||||
if r.Target != "" && !isAARE(r.Target) {
|
||||
return fmt.Errorf("'%s' is not a valid AARE", r.Target)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -260,6 +275,12 @@ func (r *Link) String() string {
|
|||
}
|
||||
|
||||
func (r *Link) Validate() error {
|
||||
if !isAARE(r.Path) {
|
||||
return fmt.Errorf("'%s' is not a valid AARE", r.Path)
|
||||
}
|
||||
if !isAARE(r.Target) {
|
||||
return fmt.Errorf("'%s' is not a valid AARE", r.Target)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue