-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
233 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Go Test | ||
on: | ||
push: | ||
branches: ["main", "dev"] | ||
pull_request: | ||
branches: ["main"] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
*.code-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
linters-settings: | ||
govet: | ||
check-shadowing: true | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf | ||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf | ||
gocyclo: | ||
min-complexity: 50 | ||
maligned: | ||
suggest-new: true | ||
dupl: | ||
threshold: 100 | ||
goconst: | ||
min-len: 2 | ||
min-occurrences: 2 | ||
misspell: | ||
locale: US | ||
revive: | ||
confidence: 0.8 | ||
lll: | ||
line-length: 160 | ||
# tab width in spaces. Default to 1. | ||
tab-width: 1 | ||
funlen: | ||
lines: 150 | ||
statements: 80 | ||
|
||
linters: | ||
# please, do not use `enable-all`: it's deprecated and will be removed soon. | ||
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint | ||
disable-all: true | ||
enable: | ||
- errcheck | ||
- funlen | ||
- goconst | ||
- gocyclo | ||
- gosec | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- revive | ||
- staticcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
|
||
# don't enable: | ||
# - gochecknoglobals | ||
# - gocognit | ||
# - godox | ||
# - maligned | ||
# - prealloc | ||
|
||
run: | ||
skip-dirs: [] | ||
# - test/testdata_etc | ||
skip-files: | ||
- ".*_test\\.go$" | ||
|
||
issues: | ||
exclude-rules: [] | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
# gobpmnCounter | ||
# gobpmnCounter | ||
|
||
gobpmnCounter is a tool for counting the elements, shapes and egdes present in a process | ||
|
||
## Wiki | ||
|
||
The [documentation](https://github.com/deemount/gobpmnCounter/wiki) is now written in the wiki of the respective module | ||
|
||
**Start here** [gobpmn](https://github.com/deemount/gobpmn) | ||
|
||
## Testing | ||
|
||
You can also test the idea behind it directly. Simply follow the link to the lab | ||
|
||
+ [gobpmnLab](https://github.com/deemount/gobpmnLab) | ||
|
||
## Further Links | ||
|
||
+ [gobpmnTypes](https://github.com/deemount/gobpmnTypes) | ||
+ [gobpmnModels](https://github.com/deemount/gobpmnModels) | ||
+ [gobpmnCamunda](https://github.com/deemount/gobpmnCamunda) | ||
+ [gobpmnDiagram](https://github.com/deemount/gobpmnDiagram) | ||
+ [gobpmnBuilder](https://github.com/deemount/gobpmnBuilder) | ||
+ [gobpmnReflection](https://github.com/deemount/gobpmnReflection) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package gobpmn_counter | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/deemount/gobpmnCounter/internals/utils" | ||
) | ||
|
||
// Count ... | ||
type Count struct { | ||
Process int | ||
Participant int | ||
Message int | ||
StartEvent int | ||
EndEvent int | ||
BusinessRuleTask int | ||
ManualTask int | ||
ReceiveTask int | ||
ScriptTask int | ||
SendTask int | ||
ServiceTask int | ||
Task int | ||
UserTask int | ||
Flow int | ||
Shape int | ||
Edge int | ||
} | ||
|
||
/* | ||
* @Base | ||
*/ | ||
|
||
// countPool ... | ||
func (c *Count) countPool(field, reflectionField string) { | ||
if strings.ToLower(field) == "pool" { | ||
if strings.Contains(reflectionField, "Process") { | ||
c.Process++ | ||
} | ||
if strings.Contains(reflectionField, "ID") { | ||
c.Participant++ | ||
c.Shape++ | ||
} | ||
} | ||
} | ||
|
||
// countMessage ... | ||
func (c *Count) countMessage(field, reflectionField string) { | ||
if strings.ToLower(field) == "message" { | ||
if strings.Contains(reflectionField, "Message") { | ||
c.Message++ | ||
c.Edge++ | ||
} | ||
} | ||
} | ||
|
||
/* | ||
* @Processes | ||
*/ | ||
|
||
// countProcess ... | ||
func (c *Count) countProcess(field string) { | ||
if strings.Contains(field, "Process") { | ||
c.Process++ | ||
} | ||
} | ||
|
||
/* | ||
* @Elements | ||
*/ | ||
|
||
func (c *Count) countElements(field string) { | ||
|
||
if utils.After(field, "From") == "" { | ||
|
||
switch true { | ||
case strings.Contains(field, "StartEvent"): | ||
c.StartEvent++ | ||
case strings.Contains(field, "EndEvent"): | ||
c.EndEvent++ | ||
case strings.Contains(field, "BusinessRuleTask"): | ||
c.BusinessRuleTask++ | ||
case strings.Contains(field, "ManualTask"): | ||
c.ManualTask++ | ||
case strings.Contains(field, "ReceiveTask"): | ||
c.ReceiveTask++ | ||
case strings.Contains(field, "ScriptTask"): | ||
c.ScriptTask++ | ||
case strings.Contains(field, "SendTask"): | ||
c.SendTask++ | ||
case strings.Contains(field, "ServiceTask"): | ||
c.ServiceTask++ | ||
case strings.Contains(field, "Task"): | ||
c.Task++ | ||
case strings.Contains(field, "UserTask"): | ||
c.UserTask++ | ||
} | ||
|
||
c.Shape++ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module github.com/deemount/gobpmnCounter | ||
|
||
go 1.21.7 | ||
|
||
require github.com/deemount/gobpmnReflection v0.0.0-20240309120253-66d26591856d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
github.com/deemount/gobpmnReflection v0.0.0-20240309120253-66d26591856d h1:IW2e4maQjHymwLuETWMtbWH/ndSj1tZaceZAJrF60G8= | ||
github.com/deemount/gobpmnReflection v0.0.0-20240309120253-66d26591856d/go.mod h1:NhbSOQE5lfqYvNkZXsm6xWTq3Wpy5xBPaERNqM/0OgI= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package utils | ||
|
||
import "strings" | ||
|
||
// After get substring after a string | ||
func After(value string, a string) string { | ||
pos := strings.LastIndex(value, a) | ||
if pos == -1 { | ||
return "" | ||
} | ||
adjustedPos := pos + len(a) | ||
if adjustedPos >= len(value) { | ||
return "" | ||
} | ||
return value[adjustedPos:] //len(value) | ||
} |