Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6802ed9

Browse files
authored
Fixing most of the comment errors. (#152)
1 parent 56c3ec6 commit 6802ed9

File tree

24 files changed

+77
-63
lines changed

24 files changed

+77
-63
lines changed

‎customfuncs/customFuncs.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/jf-tech/omniparser/transformctx"
99
)
1010

11-
// CustomFuncType is the type of a custom function. Has to use interface{} given we support
11+
// CustomFuncType is the type of custom function. Has to use interface{} given we support
1212
// non-variadic and variadic functions.
1313
type CustomFuncType = interface{}
1414

@@ -43,7 +43,7 @@ var CommonCustomFuncs = map[string]CustomFuncType{
4343
}
4444

4545
// Coalesce returns the first non-empty string of the input strings. If no input strings are given or
46-
// all of them are empty, then empty string is returned. Note: a blank string (with only whitespaces)
46+
// all of them are empty, then an empty string is returned. Note: a blank string (with only whitespaces)
4747
// is not considered as empty.
4848
func Coalesce(_ *transformctx.Ctx, strs ...string) (string, error) {
4949
for _, str := range strs {
@@ -54,7 +54,7 @@ func Coalesce(_ *transformctx.Ctx, strs ...string) (string, error) {
5454
return "", nil
5555
}
5656

57-
// Concat custom_func concatenates a number of strings together. If no strings specified, "" is returned.
57+
// Concat concatenates a number of strings together. If no strings specified, "" is returned.
5858
func Concat(_ *transformctx.Ctx, strs ...string) (string, error) {
5959
var w strings.Builder
6060
for _, s := range strs {

‎customfuncs/datetime.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
// If layout is specific, then parseDateTime will parse datetime string using the supplied layout;
2424
// otherwise, it will default to times.SmartParse.
2525
//
26-
// If datetime string contains tz info in it (such as 'Z', or '-America/New_York' etc, or '-0700', etc)
26+
// If datetime string contains tz info in it (such as 'Z', or '-America/New_York' etc., or '-0700', etc.)
2727
// then fromTZ is IGNORED. Otherwise, then datetime string will be parsed in with its face value y/m/d/h/m/s
2828
// and bonded with the fromTZ, if fromTZ isn't "".
2929
//

‎extensions/omniv21/customfuncs/javascript.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const (
1515
argNameNode = "_node"
1616
)
1717

18-
// JSProgramCache caches *goja.Program. A *goja.Program is compiled javascript and it can be used
18+
// JSProgramCache caches *goja.Program. A *goja.Program is compiled javascript, and it can be used
1919
// across multiple goroutines and across different *goja.Runtime. If default loading cache capacity
2020
// is not desirable, change JSProgramCache to a loading cache with a different capacity at package
2121
// init time. Be mindful this will be shared across all use cases inside your process.
@@ -29,7 +29,7 @@ var jsRuntimePool sync.Pool
2929
// NodeToJSONCache caches *idr.Node to JSON translations.
3030
var NodeToJSONCache *caches.LoadingCache
3131

32-
// For debugging/testing purpose so we can easily disable all the caches. But not exported. We always
32+
// For debugging/testing purpose, so we can easily disable all the caches. But not exported. We always
3333
// want caching in production.
3434
var disableCaching = false
3535

‎extensions/omniv21/fileformat/csv/reader.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type ErrInvalidHeader string
2020

2121
func (e ErrInvalidHeader) Error() string { return string(e) }
2222

23-
// IsErrInvalidHeader checks if an err is of ErrInvalidHeader type.
23+
// IsErrInvalidHeader checks if the `err` is of ErrInvalidHeader type.
2424
func IsErrInvalidHeader(err error) bool {
2525
switch err.(type) {
2626
case ErrInvalidHeader:
@@ -114,7 +114,7 @@ func (r *reader) recordToNode(record []string) *idr.Node {
114114
root := idr.CreateNode(idr.DocumentNode, "")
115115
// - If actual record has more columns than declared in schema, we'll only use up to
116116
// what's declared in the schema;
117-
// - conversely, if the actual record has less columns than declared in schema, we'll
117+
// - conversely, if the actual record has fewer columns than declared in schema, we'll
118118
// use all that are in the record.
119119
for i := 0; i < maths.MinInt(len(record), len(r.decl.Columns)); i++ {
120120
col := idr.CreateNode(idr.ElementNode, r.decl.Columns[i].name())

‎extensions/omniv21/fileformat/edi/reader.go‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,6 @@ func (r *ediReader) Read() (*idr.Node, error) {
231231
if err != nil {
232232
return nil, err
233233
}
234-
if len(r.stack) <= 1 {
235-
// we have a raw segment waiting for processing but currently
236-
// the decl stack is effectively empty (with only the artificial
237-
// #root decl on it. We can get into this situation two ways:
238-
// 1.
239-
}
240234
cur := r.stackTop()
241235
if !cur.segDecl.matchSegName(rawSeg.Name) {
242236
if len(r.stack) <= 1 {

‎extensions/omniv21/fileformat/edi/reader2.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type ErrInvalidEDI string
1616

1717
func (e ErrInvalidEDI) Error() string { return string(e) }
1818

19-
// IsErrInvalidEDI checks if an err is of ErrInvalidEDI type.
19+
// IsErrInvalidEDI checks if the `err` is of ErrInvalidEDI type.
2020
func IsErrInvalidEDI(err error) bool {
2121
switch err.(type) {
2222
case ErrInvalidEDI:
@@ -139,9 +139,9 @@ func (r *NonValidatingReader) Read() (RawSeg, error) {
139139
r.segCount++
140140
// We are here because:
141141
// 1. we find next token (i.e. segment), great, let's process it, OR
142-
// 2. r.scanner.Scan() returns false and it's EOF (note scanner never returns EOF, it just returns false
142+
// 2. r.scanner.Scan() returns false, and it's EOF (note scanner never returns EOF, it just returns false
143143
// on Scan() and Err() returns nil). We need to return EOF, OR
144-
// 3. r.scanner.Scan() returns false Err() returns err, need to return the err wrapped.
144+
// 3. r.scanner.Scan() returns false Err() returns err, need to return the `err` wrapped.
145145
err := r.scanner.Err()
146146
if err != nil {
147147
return RawSeg{}, ErrInvalidEDI(fmt.Sprintf("cannot read segment, err: %s", err.Error()))
@@ -167,7 +167,7 @@ func (r *NonValidatingReader) Read() (RawSeg, error) {
167167
r.rawSeg.Elems,
168168
RawSegElem{
169169
// while (element) index in schema starts with 1, it actually refers to the first element
170-
// AFTER the seg name element, thus we use can i as ElemIndex directly.
170+
// AFTER the seg name element, thus we can use i as ElemIndex directly.
171171
ElemIndex: i,
172172
// comp_index always starts with 1
173173
CompIndex: 1,

‎extensions/omniv21/fileformat/edi/seg.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (d *SegDecl) maxOccurs() int {
7777
// for majority cases, segments have min=1, max=1, so default nil to 1
7878
return 1
7979
case *d.Max < 0:
80-
// typically schema writer uses -1 to indicate infinite; practically max int is good enough :)
80+
// typically, schema writer uses -1 to indicate infinite; practically max int is good enough :)
8181
return maths.MaxIntValue
8282
default:
8383
return *d.Max
@@ -87,7 +87,7 @@ func (d *SegDecl) maxOccurs() int {
8787
func (d *SegDecl) matchSegName(segName string) bool {
8888
switch d.isGroup() {
8989
case true:
90-
// Group (or socalled loop) itself doesn't have a segment name in EDI file (we do assign a
90+
// Group (or so-called loop) itself doesn't have a segment name in EDI file (we do assign a
9191
// name to it for xpath query reference, but that name isn't a segment name per se). A
9292
// group/loop's first non-group child, recursively if necessary, can be used as the group's
9393
// identifying segment name, per EDI standard. Meaning if a group's first non-group child's

‎extensions/omniv21/fileformat/fileformat.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type FormatReader interface {
3535
// For certain errors (like EOF or corruption) there is no point to keep on trying; while others
3636
// can be safely ignored.
3737
IsContinuableError(err error) bool
38-
// FormatReader must be able to format an error by providing context information (such as input
38+
// CtxAwareErr allows FormatReader to format an error by providing context information (such as input
3939
// file name and (approx.) error location, such as line number)
4040
errs.CtxAwareErr
4141
}

‎extensions/omniv21/fileformat/fixedlength/reader.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (r *reader) readByHeaderFooterEnvelope() (*idr.Node, error) {
9898
return nil, ErrInvalidEnvelope(r.fmtErrStr("incomplete envelope: %s", err.Error()))
9999
}
100100
for ; r.envelopeIndex < len(r.decl.Envelopes); r.envelopeIndex++ {
101-
// regex's are already validated
101+
// regex is already validated
102102
headerRegex, _ := caches.GetRegex(r.decl.Envelopes[r.envelopeIndex].ByHeaderFooter.Header)
103103
if headerRegex.Match(line) {
104104
break

‎extensions/omniv21/fileformat/json/reader.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type ErrNodeReadingFailed string
1414

1515
func (e ErrNodeReadingFailed) Error() string { return string(e) }
1616

17-
// IsErrNodeReadingFailed checks if an err is of ErrNodeReadingFailed type.
17+
// IsErrNodeReadingFailed checks if the `err` is of ErrNodeReadingFailed type.
1818
func IsErrNodeReadingFailed(err error) bool {
1919
switch err.(type) {
2020
case ErrNodeReadingFailed:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /