Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HARMONY
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Amel Abdic
HARMONY
Commits
0510c590
Commit
0510c590
authored
1 year ago
by
jensilo
Browse files
Options
Downloads
Patches
Plain Diff
remove unnecessary interface
parent
fe08f54f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/eiffel/parser.go
+2
-2
2 additions, 2 deletions
src/app/eiffel/parser.go
src/app/template/parser/parser.go
+0
-8
0 additions, 8 deletions
src/app/template/parser/parser.go
src/app/template/service.go
+3
-6
3 additions, 6 deletions
src/app/template/service.go
with
5 additions
and
16 deletions
src/app/eiffel/parser.go
+
2
−
2
View file @
0510c590
...
@@ -23,7 +23,7 @@ var (
...
@@ -23,7 +23,7 @@ var (
ErrNotAString
=
errors
.
New
(
"eiffel.parser.error.not-a-string"
)
ErrNotAString
=
errors
.
New
(
"eiffel.parser.error.not-a-string"
)
)
)
// BasicTemplate is the basic EIFFEL template.
It is parsable by implementing the template.ParsableTemplate interface.
// BasicTemplate is the basic EIFFEL template.
//
//
// A basic template is a template that defines a set of rules and a set of variants.
// A basic template is a template that defines a set of rules and a set of variants.
// Each variant contains rules that are to be applied to a requirement in the parsing step to validate the requirement.
// Each variant contains rules that are to be applied to a requirement in the parsing step to validate the requirement.
...
@@ -182,7 +182,7 @@ func RuleParsers() *RuleParserProvider {
...
@@ -182,7 +182,7 @@ func RuleParsers() *RuleParserProvider {
}
}
}
}
// Parse
implements the template.ParsableTemplate interface for the BasicTemplate. It
is used to parse requirements in the form of segments.
// Parse is used to parse requirements in the form of segments.
// Each segment is a part of the requirement that is to be parsed. For the EIFFEL basic template (EBT), each segment is an input from auto-generated
// Each segment is a part of the requirement that is to be parsed. For the EIFFEL basic template (EBT), each segment is an input from auto-generated
// input field based on the rules defined in the template. Therefore, each segment will be validated by the corresponding rule.
// input field based on the rules defined in the template. Therefore, each segment will be validated by the corresponding rule.
// It is recommended to validate the template before parsing requirements.
// It is recommended to validate the template before parsing requirements.
...
...
This diff is collapsed.
Click to expand it.
src/app/template/parser/parser.go
+
0
−
8
View file @
0510c590
package
parser
package
parser
import
(
import
(
"context"
"github.com/org-harmony/harmony/src/core/trans"
"github.com/org-harmony/harmony/src/core/trans"
"github.com/org-harmony/harmony/src/core/validation"
)
)
const
(
const
(
...
@@ -54,12 +52,6 @@ type ParsingLog struct {
...
@@ -54,12 +52,6 @@ type ParsingLog struct {
Downgrade
bool
Downgrade
bool
}
}
// ParsableTemplate is a template that can be validated and parsed.
type
ParsableTemplate
interface
{
Validate
(
v
validation
.
V
)
[]
error
Parse
(
ctx
context
.
Context
,
variation
string
,
segments
...
ParsingSegment
)
(
ParsingResult
,
error
)
}
// String on ParsingLog returns the message of the log.
// String on ParsingLog returns the message of the log.
func
(
l
ParsingLog
)
String
()
string
{
func
(
l
ParsingLog
)
String
()
string
{
return
l
.
Message
return
l
.
Message
...
...
This diff is collapsed.
Click to expand it.
src/app/template/service.go
+
3
−
6
View file @
0510c590
...
@@ -18,8 +18,7 @@ var (
...
@@ -18,8 +18,7 @@ var (
)
)
// ValidateTemplateConfigEvent is published to validate a template config. It allows for other modules to validate
// ValidateTemplateConfigEvent is published to validate a template config. It allows for other modules to validate
// specific parts or entire templates based on their own rules. This is helpful if a module defines a template.ParsableTemplate
// specific parts or entire templates based on their own rules. This is helpful if a template should be validated against the rules of the parser.
// and the template should be validated against the rules of the parser.
type
ValidateTemplateConfigEvent
struct
{
type
ValidateTemplateConfigEvent
struct
{
Config
string
Config
string
TemplateType
string
TemplateType
string
...
@@ -29,8 +28,7 @@ type ValidateTemplateConfigEvent struct {
...
@@ -29,8 +28,7 @@ type ValidateTemplateConfigEvent struct {
// ValidateTemplateToCreate validates the template to create against the template set's rules and publishes an event
// ValidateTemplateToCreate validates the template to create against the template set's rules and publishes an event
// to validate the template config. The event allows for other modules to validate specific parts or entire templates
// to validate the template config. The event allows for other modules to validate specific parts or entire templates
// based on their own rules. This is helpful if a module defines a template.ParsableTemplate and the template should be
// based on their own rules. This is helpful if a template should be validated against the rules of the parser.
// validated against the rules of the parser.
func
ValidateTemplateToCreate
(
toCreate
*
ToCreate
,
validator
validation
.
V
,
em
event
.
Manager
,
logger
trace
.
Logger
)
([]
error
,
error
)
{
func
ValidateTemplateToCreate
(
toCreate
*
ToCreate
,
validator
validation
.
V
,
em
event
.
Manager
,
logger
trace
.
Logger
)
([]
error
,
error
)
{
err
,
validationErrs
:=
validator
.
ValidateStruct
(
toCreate
)
err
,
validationErrs
:=
validator
.
ValidateStruct
(
toCreate
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -52,8 +50,7 @@ func ValidateTemplateToCreate(toCreate *ToCreate, validator validation.V, em eve
...
@@ -52,8 +50,7 @@ func ValidateTemplateToCreate(toCreate *ToCreate, validator validation.V, em eve
// ValidateTemplateToUpdate validates the template to update against the template set's rules and publishes an event
// ValidateTemplateToUpdate validates the template to update against the template set's rules and publishes an event
// to validate the template config. The event allows for other modules to validate specific parts or entire templates
// to validate the template config. The event allows for other modules to validate specific parts or entire templates
// based on their own rules. This is helpful if a module defines a template.ParsableTemplate and the template should be
// based on their own rules. This is helpful if a template should be validated against the rules of the parser.
// validated against the rules of the parser.
func
ValidateTemplateToUpdate
(
toUpdate
*
ToUpdate
,
validator
validation
.
V
,
em
event
.
Manager
,
logger
trace
.
Logger
)
([]
error
,
error
)
{
func
ValidateTemplateToUpdate
(
toUpdate
*
ToUpdate
,
validator
validation
.
V
,
em
event
.
Manager
,
logger
trace
.
Logger
)
([]
error
,
error
)
{
err
,
validationErrs
:=
validator
.
ValidateStruct
(
toUpdate
)
err
,
validationErrs
:=
validator
.
ValidateStruct
(
toUpdate
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment