Skip to content

Commit

Permalink
Merge pull request #155 from jfeliu007/issue-154
Browse files Browse the repository at this point in the history
issue-154 - Added information in the README
  • Loading branch information
jfeliu007 authored May 16, 2023
2 parents bfc9b50 + 4a84cec commit bd49077
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 30 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,8 @@ testingsupport.MyStruct3 o-- testingsupport.MyStruct1

### Diagram using www.dumels.com
[UML Diagram](https://www.dumels.com/diagram/23ff0222-e93b-4e9f-a4ef-4d5d9b7a5c7d)

### Diagram rendered in plantuml online server
[UML Diagram](https://www.plantuml.com/plantuml/uml/SoWkIImgAStDuSfBp4qjBaXCJbKeIIqkoSnBBoujACWlAb6evb80WioyajIYD92qRwKdd0sIX09TXRJyV0rDXQJy_1mki6Wjc4pEIImk1ceABYagJIunLB2nKT08rd4iB4tCJIpAp4lLLB2p8zaO8np6uDHWJAozN70HRGMt_7o4ms6EgUL23HyzXDUqT7KLS4WQSM5gGmIZJGrkdOOOEX5-oiUhpI4rBmKOim00)

For instructions on how to render these diagrams locally using plantuml please visit [https://plantuml.com](https://plantuml.com)
4 changes: 2 additions & 2 deletions parser/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package parser

import "fmt"

//Alias defines a type that is an alias for some other type
// Alias defines a type that is an alias for some other type
type Alias struct {
Name string
PackageName string
Expand All @@ -20,7 +20,7 @@ func getNewAlias(name, packageName, aliasOf string) *Alias {
}
}

//AliasSlice implement the sort.Interface interface to allow for proper sorting of an alias slice
// AliasSlice implement the sort.Interface interface to allow for proper sorting of an alias slice
type AliasSlice []Alias

// Len is the number of elements in the collection.
Expand Down
1 change: 0 additions & 1 deletion parser/class_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ call the Render() function and this will return a string with the class diagram.
See github.com/jfeliu007/goplantuml/cmd/goplantuml/main.go for a command that uses this functions and outputs the text to
the console.
*/
package parser

Expand Down
6 changes: 3 additions & 3 deletions parser/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (

const packageConstant = "{packageName}"

//Field can hold the name and type of any field
// Field can hold the name and type of any field
type Field struct {
Name string
Type string
FullType string
}

//Returns a string representation of the given expression if it was recognized.
//Refer to the implementation to see the different string representations.
// Returns a string representation of the given expression if it was recognized.
// Refer to the implementation to see the different string representations.
func getFieldType(exp ast.Expr, aliases map[string]string) (string, []string) {
switch v := exp.(type) {
case *ast.Ident:
Expand Down
4 changes: 2 additions & 2 deletions parser/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
)

//Function holds the signature of a function with name, Parameters and Return values
// Function holds the signature of a function with name, Parameters and Return values
type Function struct {
Name string
Parameters []*Field
Expand All @@ -14,7 +14,7 @@ type Function struct {
FullNameReturnValues []string
}

//SignturesAreEqual Returns true if the two functions have the same signature (parameter names are not checked)
// SignturesAreEqual Returns true if the two functions have the same signature (parameter names are not checked)
func (f *Function) SignturesAreEqual(function *Function) bool {
result := true
result = result && (function.Name == f.Name)
Expand Down
26 changes: 13 additions & 13 deletions parser/struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"unicode"
)

//Struct represent a struct in golang, it can be of Type "class" or "interface" and can be associated
//with other structs via Composition and Extends
// Struct represent a struct in golang, it can be of Type "class" or "interface" and can be associated
// with other structs via Composition and Extends
type Struct struct {
PackageName string
Functions []*Function
Expand Down Expand Up @@ -38,9 +38,9 @@ func (st *Struct) ImplementsInterface(inter *Struct) bool {
return true
}

//AddToComposition adds the composition relation to the structure. We want to make sure that *ExampleStruct
//gets added as ExampleStruct so that we can properly build the relation later to the
//class identifier
// AddToComposition adds the composition relation to the structure. We want to make sure that *ExampleStruct
// gets added as ExampleStruct so that we can properly build the relation later to the
// class identifier
func (st *Struct) AddToComposition(fType string) {
if len(fType) == 0 {
return
Expand All @@ -51,9 +51,9 @@ func (st *Struct) AddToComposition(fType string) {
st.Composition[fType] = struct{}{}
}

//AddToExtends Adds an extends relationship to this struct. We want to make sure that *ExampleStruct
//gets added as ExampleStruct so that we can properly build the relation later to the
//class identifier
// AddToExtends Adds an extends relationship to this struct. We want to make sure that *ExampleStruct
// gets added as ExampleStruct so that we can properly build the relation later to the
// class identifier
func (st *Struct) AddToExtends(fType string) {
if len(fType) == 0 {
return
Expand All @@ -64,18 +64,18 @@ func (st *Struct) AddToExtends(fType string) {
st.Extends[fType] = struct{}{}
}

//AddToAggregation adds an aggregation type to the list of aggregations
// AddToAggregation adds an aggregation type to the list of aggregations
func (st *Struct) AddToAggregation(fType string) {
st.Aggregations[fType] = struct{}{}
}

//addToPrivateAggregation adds an aggregation type to the list of aggregations for private members
// addToPrivateAggregation adds an aggregation type to the list of aggregations for private members
func (st *Struct) addToPrivateAggregation(fType string) {
st.PrivateAggregations[fType] = struct{}{}
}

//AddField adds a field into this structure. It parses the ast.Field and extract all
//needed information
// AddField adds a field into this structure. It parses the ast.Field and extract all
// needed information
func (st *Struct) AddField(field *ast.Field, aliases map[string]string) {
theType, fundamentalTypes := getFieldType(field.Type, aliases)
theType = replacePackageConstant(theType, "")
Expand Down Expand Up @@ -103,7 +103,7 @@ func (st *Struct) AddField(field *ast.Field, aliases map[string]string) {
}
}

//AddMethod Parse the Field and if it is an ast.FuncType, then add the methods into the structure
// AddMethod Parse the Field and if it is an ast.FuncType, then add the methods into the structure
func (st *Struct) AddMethod(method *ast.Field, aliases map[string]string) {
f, ok := method.Type.(*ast.FuncType)
if !ok {
Expand Down
6 changes: 3 additions & 3 deletions testingsupport/connectionlabels/connectionlabels.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package connectionlabels

//AbstractInterface for testing purposes
// AbstractInterface for testing purposes
type AbstractInterface interface {
interfaceFunction() bool
}

//ImplementsAbstractInterface for testing purposes
// ImplementsAbstractInterface for testing purposes
type ImplementsAbstractInterface struct {
AliasOfInt
PublicUse AbstractInterface
Expand All @@ -15,5 +15,5 @@ func (iai *ImplementsAbstractInterface) interfaceFunction() bool {
return true
}

//AliasOfInt for testing purposes
// AliasOfInt for testing purposes
type AliasOfInt int
2 changes: 1 addition & 1 deletion testingsupport/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ type myInt int

var globalVariable int

//TestComplicatedAlias for testing purposes only
// TestComplicatedAlias for testing purposes only
type TestComplicatedAlias func(strings.Builder) bool
2 changes: 1 addition & 1 deletion testingsupport/renderingoptions/testfile.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package renderingoptions

//Test is for testing purposes
// Test is for testing purposes
type Test struct {
integer int
}
Expand Down
2 changes: 1 addition & 1 deletion testingsupport/subfolder/subfolder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ type test2 interface {
test()
}

//TestInterfaceAsField testing interface
// TestInterfaceAsField testing interface
type TestInterfaceAsField interface {
}
4 changes: 2 additions & 2 deletions testingsupport/subfolder2/subfolder2.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package subfolder2

//Subfolder2 structure for testing purpose only
// Subfolder2 structure for testing purpose only
type Subfolder2 struct {
}

//SubfolderFunction is for testing purposes
// SubfolderFunction is for testing purposes
func (s *Subfolder2) SubfolderFunction(b bool, i int) bool {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion testingsupport/subfolder3/subfolder3.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package subfolder3

//SubfolderInterface for testing purposes
// SubfolderInterface for testing purposes
type SubfolderInterface interface {
SubfolderFunction(bool, int) bool
}

0 comments on commit bd49077

Please sign in to comment.