Skip to content

Commit

Permalink
style: Changes requested by eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando-hub527 committed Jun 6, 2024
1 parent 90dd958 commit 9959c34
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions internal/providers/gofpdf/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *text) AddCustomText(subs []*entity.SubText, cell *entity.Cell, textPs *
defer s.font.SetColor(originalColor)

Check warning on line 40 in internal/providers/gofpdf/text.go

View check run for this annotation

Codecov / codecov/patch

internal/providers/gofpdf/text.go#L38-L40

Added lines #L38 - L40 were not covered by tests

width := s.validTextProps(textPs, cell, cell.Width-textPs.Left-textPs.Right)
lines := s.orderSubTextsInLines(subs, width, textPs.BreakLineStrategy)
lines := s.orderSubTexts(subs, width, textPs.BreakLineStrategy)

Check warning on line 43 in internal/providers/gofpdf/text.go

View check run for this annotation

Codecov / codecov/patch

internal/providers/gofpdf/text.go#L42-L43

Added lines #L42 - L43 were not covered by tests

accumulateOffsetY := 0.0
sumFonts := 0.0
Expand Down Expand Up @@ -80,7 +80,7 @@ func (s *text) GetLinesQuantity(text string, textProp props.Text, colWidth float
}

// This method is responsible for checking the subtexts and adding them to the line according to the chosen strategy
func (s *text) orderSubTextsInLines(subs []*entity.SubText, widthAvailable float64, breakLineStrategy breakline.Strategy) [][]*entity.SubText {
func (s *text) orderSubTexts(subs []*entity.SubText, widthAvailable float64, breakLineStrategy breakline.Strategy) [][]*entity.SubText {
sizeLasLine := 0.0
newText := [][]*entity.SubText{}

Check warning on line 85 in internal/providers/gofpdf/text.go

View check run for this annotation

Codecov / codecov/patch

internal/providers/gofpdf/text.go#L83-L85

Added lines #L83 - L85 were not covered by tests

Expand All @@ -90,7 +90,7 @@ func (s *text) orderSubTextsInLines(subs []*entity.SubText, widthAvailable float
return newText

Check warning on line 90 in internal/providers/gofpdf/text.go

View check run for this annotation

Codecov / codecov/patch

internal/providers/gofpdf/text.go#L90

Added line #L90 was not covered by tests
}

// This method is responsible for making a new line with the subText sent, here it is defined whether the subText will be inserted in a new Line or in the current Line
// This method is responsible for making a new line with the subText sent.
func (s *text) factoryLine(sub *entity.SubText, widthAvailable float64, sizeLasLine float64, newText [][]*entity.SubText, getLines func(string, float64, float64) ([]string, float64)) (float64, [][]*entity.SubText) {

Check failure on line 94 in internal/providers/gofpdf/text.go

View workflow job for this annotation

GitHub Actions / lint

line is 215 characters (lll)
s.font.SetFont(sub.Prop.Family, sub.Prop.Style, sub.Prop.Size)
lineValues, currentSize := getLines(s.textToUnicode(sub.Value, &sub.Prop), widthAvailable, sizeLasLine)
Expand Down
40 changes: 20 additions & 20 deletions pkg/props/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,46 @@ type SubText struct {
Hyperlink *string
}

func (sub *SubText) MakeValid(font *Font) {
func (s *SubText) MakeValid(font *Font) {
undefinedValue := 0.0

Check warning on line 25 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L24-L25

Added lines #L24 - L25 were not covered by tests

if sub.Family == "" {
sub.Family = font.Family
if s.Family == "" {
s.Family = font.Family

Check warning on line 28 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L27-L28

Added lines #L27 - L28 were not covered by tests
}

if sub.Style == "" {
sub.Style = font.Style
if s.Style == "" {
s.Style = font.Style

Check warning on line 32 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L31-L32

Added lines #L31 - L32 were not covered by tests
}

if sub.Size == undefinedValue {
sub.Size = font.Size
if s.Size == undefinedValue {
s.Size = font.Size

Check warning on line 36 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L35-L36

Added lines #L35 - L36 were not covered by tests
}

if sub.Color == nil {
sub.Color = font.Color
if s.Color == nil {
s.Color = font.Color

Check warning on line 40 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L39-L40

Added lines #L39 - L40 were not covered by tests
}
}

func (t *SubText) ToMap() map[string]interface{} {
func (s *SubText) ToMap() map[string]interface{} {
m := make(map[string]interface{})
if t.Family != "" {
m["prop_font_family"] = t.Family
if s.Family != "" {
m["prop_font_family"] = s.Family

Check warning on line 47 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L44-L47

Added lines #L44 - L47 were not covered by tests
}

if t.Style != "" {
m["prop_font_style"] = t.Style
if s.Style != "" {
m["prop_font_style"] = s.Style

Check warning on line 51 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L50-L51

Added lines #L50 - L51 were not covered by tests
}

if t.Size != 0 {
m["prop_font_size"] = t.Size
if s.Size != 0 {
m["prop_font_size"] = s.Size

Check warning on line 55 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L54-L55

Added lines #L54 - L55 were not covered by tests
}

if t.Color != nil {
m["prop_color"] = t.Color.ToString()
if s.Color != nil {
m["prop_color"] = s.Color.ToString()

Check warning on line 59 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L58-L59

Added lines #L58 - L59 were not covered by tests
}

if t.Hyperlink != nil {
m["prop_hyperlink"] = *t.Hyperlink
if s.Hyperlink != nil {
m["prop_hyperlink"] = *s.Hyperlink

Check warning on line 63 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L62-L63

Added lines #L62 - L63 were not covered by tests
}

return m

Check warning on line 66 in pkg/props/text.go

View check run for this annotation

Codecov / codecov/patch

pkg/props/text.go#L66

Added line #L66 was not covered by tests
Expand Down

0 comments on commit 9959c34

Please sign in to comment.