Feature "Go Code Repository SIGINT"

From dataspects::Wiki
C1514943836
Jump to navigation Jump to search
[edit]
EntityType "Feature"
Keywords/Contexts


Annotations
  • HasPendingIssue::VariablesReferToStructMap must also "2) in this function's content whether it assigns <STRING> to a struct."
[edit]
[edit]

See below…





ResourceSilo (i.e. repository) SIGINT.yml

Indexing-time SIGINT specific to resources representing Go code files

tasks:
    - name: Entitize Golang code
      actions:
            entitizeDelimitedContent:
                # Functions
                - startDelimiterRegex: "func ?\\(?(([\\w])+ \\*?([\\w]+))?\\)? ?[* _\\w(),\\[\\]\\{\\}]+ {"
                  endDelimiter: "}"
                  startDelimiterRegexMatchIsHasEntityTitle: true
                  hasEntityType: Go Function
                  annotateEntityFromStartDelimiterCaptures:
                    - predicate: AttachedToStruct
                      object:
                        fromRegexCapture: 3
                    - predicate: VariablesReferToStructMap
                      object:
                        fromRegexCapture: 1
                      objectValueMode: arrayed
                  # "Now run these actions for each entity:"
                  actions:
                        setEntityTargetIndex:
                            - targetESIndex: dsspecial_dataspectscode
                        contentMatchingRegex:
                            - mode: fromEntity
                              regex: "([\\w]+\\.)?[_\\w]+\\([\\d\\* _\\w,-.:\\[\\]\\r\\n\\t{}]*\\)"
                              predicate: CallsFunction
                            - mode: fromResource
                              regex: "package ([\\w]+)"
                              predicate: DeclaredInPackage
                              object:
                                  fromRegexCapture: 1
                # Structs
                - startDelimiterRegex: "type [\\w]+ struct {"
                  endDelimiter: "}"
                  startDelimiterRegexMatchIsHasEntityTitle: true
                  hasEntityType: Go Struct
                  actions:
                        contentMatchingRegex:
                            - mode: fromEntity
                              regex: "[\\w]+ +[\\w]+ *[\\w:`\"]*"
                              predicate: ContainsStructField
                            - mode: fromResource
                              regex: "package ([\\w]+)"
                              predicate: DeclaredInPackage
                              object:
                                  fromRegexCapture: 1
                        setEntityTargetIndex:
                            - targetESIndex: dsspecial_dataspectscode

Post-indexing-time SIGINT specific to resources representing Go code files

ES_HOST=https://es.dataspects.com \
ES_PORT=9200 \
ES_USERNAME= \
ES_PASSWORD= \
NEO4J_BOLT_HOST=bolt://neo.dataspects.com \
NEO4J_BOLT_ENCRYPTED=true \
NEO4J_BOLT_PORT=7687 \
NEO4J_BOLT_USERNAME= \
NEO4J_BOLT_PASSWORD= \
TEMPLATES_PATH=/home/lex/dataspectsd-templates \
go test -v -count=1 -run TestGoCodePostSIGINT