Skip to content

Commit 7eee5a8

Browse files
committed
chore: rename variable
1 parent 22dba1f commit 7eee5a8

4 files changed

Lines changed: 22 additions & 22 deletions

File tree

internal/types/action.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (a *Action) WriteDocumentation(inputTable, outputTable *strings.Builder) er
8080

8181
var output []byte
8282

83-
hasInputsData, Indices := utils.HasBytesInBetween(
83+
hasInputsData, indices := utils.HasBytesInBetween(
8484
input,
8585
[]byte(internal.InputAutoDocStart),
8686
[]byte(internal.InputAutoDocEnd),
@@ -90,7 +90,7 @@ func (a *Action) WriteDocumentation(inputTable, outputTable *strings.Builder) er
9090
inputsStr := strings.TrimSpace(inputTable.String())
9191

9292
if hasInputsData {
93-
output = utils.ReplaceBytesInBetween(output, Indices, []byte(inputsStr))
93+
output = utils.ReplaceBytesInBetween(output, indices, []byte(inputsStr))
9494
} else {
9595
re := regexp.MustCompile(fmt.Sprintf("(?m)^%s", internal.InputsHeader))
9696
output = re.ReplaceAllFunc(input, func(match []byte) []byte {
@@ -101,7 +101,7 @@ func (a *Action) WriteDocumentation(inputTable, outputTable *strings.Builder) er
101101
})
102102
}
103103

104-
hasOutputsData, Indices := utils.HasBytesInBetween(
104+
hasOutputsData, indices := utils.HasBytesInBetween(
105105
output,
106106
[]byte(internal.OutputAutoDocStart),
107107
[]byte(internal.OutputAutoDocEnd),
@@ -110,7 +110,7 @@ func (a *Action) WriteDocumentation(inputTable, outputTable *strings.Builder) er
110110
outputsStr := strings.TrimSpace(outputTable.String())
111111

112112
if hasOutputsData {
113-
output = utils.ReplaceBytesInBetween(output, Indices, []byte(outputsStr))
113+
output = utils.ReplaceBytesInBetween(output, indices, []byte(outputsStr))
114114
} else {
115115
re := regexp.MustCompile(fmt.Sprintf("(?m)^%s", internal.OutputsHeader))
116116
output = re.ReplaceAllFunc(output, func(match []byte) []byte {

internal/types/reusable.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (r *Reusable) WriteDocumentation(inputTable, outputTable, secretsTable *str
9393

9494
var output []byte
9595

96-
hasInputsData, Indices := utils.HasBytesInBetween(
96+
hasInputsData, indices := utils.HasBytesInBetween(
9797
input,
9898
[]byte(internal.InputAutoDocStart),
9999
[]byte(internal.InputAutoDocEnd),
@@ -103,7 +103,7 @@ func (r *Reusable) WriteDocumentation(inputTable, outputTable, secretsTable *str
103103
inputsStr := strings.TrimSpace(inputTable.String())
104104

105105
if hasInputsData {
106-
output = utils.ReplaceBytesInBetween(output, Indices, []byte(inputsStr))
106+
output = utils.ReplaceBytesInBetween(output, indices, []byte(inputsStr))
107107
} else {
108108
re := regexp.MustCompile(fmt.Sprintf("(?m)^%s", internal.InputsHeader))
109109
output = re.ReplaceAllFunc(input, func(match []byte) []byte {
@@ -114,7 +114,7 @@ func (r *Reusable) WriteDocumentation(inputTable, outputTable, secretsTable *str
114114
})
115115
}
116116

117-
hasOutputsData, Indices := utils.HasBytesInBetween(
117+
hasOutputsData, indices := utils.HasBytesInBetween(
118118
output,
119119
[]byte(internal.OutputAutoDocStart),
120120
[]byte(internal.OutputAutoDocEnd),
@@ -123,7 +123,7 @@ func (r *Reusable) WriteDocumentation(inputTable, outputTable, secretsTable *str
123123
outputsStr := strings.TrimSpace(outputTable.String())
124124

125125
if hasOutputsData {
126-
output = utils.ReplaceBytesInBetween(output, Indices, []byte(outputsStr))
126+
output = utils.ReplaceBytesInBetween(output, indices, []byte(outputsStr))
127127
} else {
128128
re := regexp.MustCompile(fmt.Sprintf("(?m)^%s", internal.OutputsHeader))
129129
output = re.ReplaceAllFunc(output, func(match []byte) []byte {
@@ -134,7 +134,7 @@ func (r *Reusable) WriteDocumentation(inputTable, outputTable, secretsTable *str
134134
})
135135
}
136136

137-
hasSecretsData, Indices := utils.HasBytesInBetween(
137+
hasSecretsData, indices := utils.HasBytesInBetween(
138138
output,
139139
[]byte(internal.SecretsAutoDocStart),
140140
[]byte(internal.SecretsAutoDocEnd),
@@ -143,7 +143,7 @@ func (r *Reusable) WriteDocumentation(inputTable, outputTable, secretsTable *str
143143
secretsStr := strings.TrimSpace(secretsTable.String())
144144

145145
if hasSecretsData {
146-
output = utils.ReplaceBytesInBetween(output, Indices, []byte(secretsStr))
146+
output = utils.ReplaceBytesInBetween(output, indices, []byte(secretsStr))
147147
} else {
148148
re := regexp.MustCompile(fmt.Sprintf("(?m)^%s", internal.SecretsHeader))
149149
output = re.ReplaceAllFunc(output, func(match []byte) []byte {

internal/utils/bytes_utils.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ import (
2222
)
2323

2424
// HasBytesInBetween checks if a byte array has a start and end byte array and returns true if and all occurrences of start and end
25-
func HasBytesInBetween(value, start, end []byte) (found bool, Indices [][]int) {
25+
func HasBytesInBetween(value, start, end []byte) (found bool, indices [][]int) {
2626
// Multiline regex
2727
findRegex := regexp.MustCompile(fmt.Sprintf(`(?s)%s(.*?)%s`, regexp.QuoteMeta(string(start)), regexp.QuoteMeta(string(end))))
28-
Indices = findRegex.FindAllIndex(value, -1)
28+
indices = findRegex.FindAllIndex(value, -1)
2929

30-
if len(Indices) == 0 {
31-
return false, Indices
30+
if len(indices) == 0 {
31+
return false, indices
3232
}
3333

34-
return true, Indices
34+
return true, indices
3535
}
3636

37-
// ReplaceBytesInBetween replaces a byte array between an array of start and end Indices with a new byte array
37+
// ReplaceBytesInBetween replaces a byte array between an array of start and end indices with a new byte array
3838
func ReplaceBytesInBetween(value []byte, indices [][]int, new []byte) []byte {
3939
t := make([]byte, 0, len(value)+len(new)*len(indices))
4040
prevIndex := 0

internal/utils/word_wrap.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ func WordWrap(s string, limit int) string {
2929
}
3030

3131
var (
32-
linkIndices = getAllLinksIndex(s)
33-
codeBlockIndices = getAllCodeBlocksIndex(s)
34-
codeIndices = getAllCodeIndex(s)
35-
parenthesisIndices = getAllParenthesisIndex(s)
36-
italicIndices = getAllItalicIndex(s)
32+
linkindices = getAllLinksIndex(s)
33+
codeBlockindices = getAllCodeBlocksIndex(s)
34+
codeindices = getAllCodeIndex(s)
35+
parenthesisindices = getAllParenthesisIndex(s)
36+
italicindices = getAllItalicIndex(s)
3737
start = 0
3838
)
3939

4040
// split the string into words that aren't between any of the links, code blocks, code and parenthesis
4141
strSlice := strings.FieldsFunc(s, func(r rune) bool {
42-
shouldExclude := isWithin(start, linkIndices) || isWithin(start, codeBlockIndices) || isWithin(start, codeIndices) || isWithin(start, parenthesisIndices) || isWithin(start, italicIndices)
42+
shouldExclude := isWithin(start, linkindices) || isWithin(start, codeBlockindices) || isWithin(start, codeindices) || isWithin(start, parenthesisindices) || isWithin(start, italicindices)
4343
start++
4444
return !shouldExclude && unicode.IsSpace(r)
4545
})

0 commit comments

Comments
 (0)