Skip to content

Commit

Permalink
Fix codespell config to skip multiple files (#837)
Browse files Browse the repository at this point in the history
* trying to get codespell to trigger before merge to main

* iterating

* https://github.com/codespell-project/actions-codespell

* iterating

* iterating

* iterating

* iterating

* iterating

* more

* more

* more
  • Loading branch information
johnkerl authored Jan 4, 2022
1 parent eac9275 commit 0c75713
Show file tree
Hide file tree
Showing 32 changed files with 71 additions and 64 deletions.
2 changes: 2 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ nd
nin
numer
Wit
te
wee
6 changes: 3 additions & 3 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
fetch-depth: 0

# Run linter against code base
# https://github.com/codespell-project/codespell
- name: Codespell
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
ignore_words_file: .codespellignore
skip:
- "**/*.csv"
- "**/*.txt"
# ignore_words_list: denom,inout,iput,nd,nin,numer,te,wee
skip: "*.csv,*.dkvp,*.txt,*.js,*.html,*.map,./tags,./test/cases"
2 changes: 1 addition & 1 deletion docs/src/miller-programming-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ You can read more about this in the [arithmetic reference](reference-main-arithm
## Absent data

In addition to types including string, number (int/float), maps, and arrays,
Miller varibles can also be **absent**. This is when a variable never had a
Miller variables can also be **absent**. This is when a variable never had a
value assigned to it. Miller's treatment of absent data is intended to make it
easy for you to handle [non-homogeneous data](record-heterogeneity.md). We'll
see more in the [null-data reference](reference-main-null-data.md) but the
Expand Down
2 changes: 1 addition & 1 deletion docs/src/miller-programming-language.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ You can read more about this in the [arithmetic reference](reference-main-arithm
## Absent data

In addition to types including string, number (int/float), maps, and arrays,
Miller varibles can also be **absent**. This is when a variable never had a
Miller variables can also be **absent**. This is when a variable never had a
value assigned to it. Miller's treatment of absent data is intended to make it
easy for you to handle [non-homogeneous data](record-heterogeneity.md). We'll
see more in the [null-data reference](reference-main-null-data.md) but the
Expand Down
4 changes: 2 additions & 2 deletions docs/src/reference-dsl-higher-order-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ respectively.

The [`select`](reference-dsl-builtin-functions.md#select) function takes a map
or array as its first argument and a function as second argument. It includes
each input element in the ouptut if the function returns true.
each input element in the output if the function returns true.

For arrays, that function should take one argument, for array element; for
maps, it should take two, for map-element key and value. In either case it
Expand Down Expand Up @@ -776,7 +776,7 @@ Sorted, then cubed, then summed:

### Remember return

From other languages it's easy to accidentially write
From other languages it's easy to accidentally write

<pre class="pre-highlight-in-pair">
<b>mlr -n put 'end { print select([1,2,3,4,5], func (e) { e >= 3 })}'</b>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/reference-dsl-higher-order-functions.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ respectively.

The [`select`](reference-dsl-builtin-functions.md#select) function takes a map
or array as its first argument and a function as second argument. It includes
each input element in the ouptut if the function returns true.
each input element in the output if the function returns true.

For arrays, that function should take one argument, for array element; for
maps, it should take two, for map-element key and value. In either case it
Expand Down Expand Up @@ -426,7 +426,7 @@ GENMD-EOF

### Remember return

From other languages it's easy to accidentially write
From other languages it's easy to accidentally write

GENMD-RUN-COMMAND-TOLERATING-ERROR
mlr -n put 'end { print select([1,2,3,4,5], func (e) { e >= 3 })}'
Expand Down
4 changes: 2 additions & 2 deletions docs/src/reference-dsl-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Quick links:
Dates/times are not a separate data type; Miller uses ints for
[seconds since the epoch](https://en.wikipedia.org/wiki/Unix_time) and strings for formatted
date/times. In this page we take a look at what some of the various options are
for processing datetimes andd timezones in your data.
for processing datetimes and timezones in your data.

See also the [section on time-related
functions](reference-dsl-builtin-functions.md#time-functions) for
Expand All @@ -43,7 +43,7 @@ they're independent of timezone or daylight-savings time.
One minus is that, being just numbers, they're not particularly human-readable
-- hence the to-string and from-string functions described below. Another
caveat (not really a minus) is that _epoch milliseconds_, rather than epoch
seconds, are common in some contexts, particulary JavaScript. If you ever
seconds, are common in some contexts, particularly JavaScript. If you ever
(anywhere) see a timestamp for the year 49,000-something -- probably someone is
treating epoch-milliseconds as epoch-seconds.

Expand Down
4 changes: 2 additions & 2 deletions docs/src/reference-dsl-time.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Dates/times are not a separate data type; Miller uses ints for
[seconds since the epoch](https://en.wikipedia.org/wiki/Unix_time) and strings for formatted
date/times. In this page we take a look at what some of the various options are
for processing datetimes andd timezones in your data.
for processing datetimes and timezones in your data.

See also the [section on time-related
functions](reference-dsl-builtin-functions.md#time-functions) for
Expand All @@ -27,7 +27,7 @@ they're independent of timezone or daylight-savings time.
One minus is that, being just numbers, they're not particularly human-readable
-- hence the to-string and from-string functions described below. Another
caveat (not really a minus) is that _epoch milliseconds_, rather than epoch
seconds, are common in some contexts, particulary JavaScript. If you ever
seconds, are common in some contexts, particularly JavaScript. If you ever
(anywhere) see a timestamp for the year 49,000-something -- probably someone is
treating epoch-milliseconds as epoch-seconds.

Expand Down
6 changes: 3 additions & 3 deletions docs/src/shapes-of-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Look at the file to find names of fields:
</pre>
<pre class="pre-non-highlight-in-pair">
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz
masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
</pre>

Expand All @@ -65,7 +65,7 @@ Use XTAB output format to get a sharper picture of where records/fields are bein
<b>mlr --icsv --oxtab cat data/colours.csv </b>
</pre>
<pre class="pre-non-highlight-in-pair">
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz

KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
</pre>
Expand All @@ -83,7 +83,7 @@ ES Blanco
FI Valkoinen
FR Blanc
IT Bianco
NL Wit
NL Witter
PL Biały
RO Alb
TR Beyaz
Expand Down
6 changes: 3 additions & 3 deletions docs/src/shapes-of-data.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Look at the file to find names of fields:
GENMD-CARDIFY-HIGHLIGHT-ONE
cat data/colours.csv
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz
masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
GENMD-EOF

Expand All @@ -41,7 +41,7 @@ Use XTAB output format to get a sharper picture of where records/fields are bein

GENMD-CARDIFY-HIGHLIGHT-ONE
mlr --icsv --oxtab cat data/colours.csv
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Witter;Biały;Alb;Beyaz

KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
GENMD-EOF
Expand All @@ -57,7 +57,7 @@ ES Blanco
FI Valkoinen
FR Blanc
IT Bianco
NL Wit
NL Witter
PL Biały
RO Alb
TR Beyaz
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/auxents/regtest/entry.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ================================================================
// TOOO
// TODO
// ================================================================

package regtest
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/auxents/repl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ FILENAME="foo.dat",FILENUM=1,NR=1,FNR=1

This is a small modification around the [CST](../../dsl/cst/) and the [`put` verb](../../transformers/put_or_filter.go).. Most of the keystroking here is for online help and command-line parsing.

One subtlety is that non-assignment expressions like `NR < 10` are filter statements within `put` -- they can be used to control whether or not a given record is included in the outut stream. Here, in the REPL, these expressions are simply printed to the terminal. And for `:skip until ...` or `:process until ...`, they're used as the exit condition to break out of reading input records.
One subtlety is that non-assignment expressions like `NR < 10` are filter statements within `put` -- they can be used to control whether or not a given record is included in the output stream. Here, in the REPL, these expressions are simply printed to the terminal. And for `:skip until ...` or `:process until ...`, they're used as the exit condition to break out of reading input records.

# File structure

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/auxents/repl/dsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (repl *Repl) handleDSLStringAux(
repl.runtimeState.Inrec = outrec

// The filter expression for the main Miller DSL is any non-assignment
// statment like 'true' or '$x > 0.5' etc. For the REPL, we re-use this for
// statement like 'true' or '$x > 0.5' etc. For the REPL, we re-use this for
// interactive expressions to be printed to the terminal. For the main DSL,
// the default is mlrval.FromTrue(); for the REPL, the default is
// mlrval.VOID.
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/auxents/repl/session.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ================================================================
// Top-level handler for a REPL session, including setup/construction, and
// ingesting command-lines. Command-line strings are triaged and send off to
// the appropriate handlers: DSL parse/execute if the comand is a DSL statement
// the appropriate handlers: DSL parse/execute if the command is a DSL statement
// (like '$z = $x + $y'); REPL-command-line parse/execute otherwise (like
// ':open foo.dat' or ':help').
//
Expand Down Expand Up @@ -66,7 +66,7 @@ func NewRepl(
runtimeState := runtime.NewEmptyState(options)
runtimeState.Update(inrec, context)
// The filter expression for the main Miller DSL is any non-assignment
// statment like 'true' or '$x > 0.5' etc. For the REPL, we re-use this for
// statement like 'true' or '$x > 0.5' etc. For the REPL, we re-use this for
// interactive expressions to be printed to the terminal. For the main DSL,
// the default is mlrval.FromTrue(); for the REPL, the default is
// mlrval.VOID.
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/auxents/repl/verbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func handleLoad(repl *Repl, args []string) bool {
// ----------------------------------------------------------------
func usageOpen(repl *Repl) {
fmt.Printf(
":open {one or more data-file names in the format specifed by %s %s}.\n",
":open {one or more data-file names in the format specified by %s %s}.\n",
repl.exeName, repl.replName,
)
fmt.Print(
Expand Down Expand Up @@ -515,7 +515,7 @@ func handleSkipOrProcessUntil(repl *Repl, dslString string, processingNotSkippin
repl,
recordAndContext,
processingNotSkipping,
true, // testingByFilterExpression -- since we're continuing until the filter expresssion is true
true, // testingByFilterExpression -- since we're continuing until the filter expression is true
)
if shouldBreak {
break
Expand Down Expand Up @@ -597,7 +597,7 @@ func skipOrProcessRecord(
// ----------------------------------------------------------------
func usageWrite(repl *Repl) {
fmt.Println(":write with no arguments.")
fmt.Println("Sends the current record (maybe modifed by statements you enter)")
fmt.Println("Sends the current record (maybe modified by statements you enter)")
fmt.Printf("to standard output, with format as specified by %s %s.\n",
repl.exeName, repl.replName)
}
Expand Down
44 changes: 22 additions & 22 deletions internal/pkg/auxents/termcvt.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func termcvtUsage(verbName string, o *os.File, exitCode int) {
}

func termcvtMain(args []string) int {
inTerm := "\n"
outTerm := "\n"
inputTerminator := "\n"
outputTerminator := "\n"
doInPlace := false

// 'mlr' and 'termcvt' are already argv[0] and argv[1].
Expand All @@ -49,30 +49,30 @@ func termcvtMain(args []string) int {
} else if opt == "-I" {
doInPlace = true
} else if opt == "--cr2crlf" {
inTerm = "\r"
outTerm = "\r\n"
inputTerminator = "\r"
outputTerminator = "\r\n"
} else if opt == "--lf2crlf" {
inTerm = "\n"
outTerm = "\r\n"
inputTerminator = "\n"
outputTerminator = "\r\n"
} else if opt == "--crlf2cr" {
inTerm = "\r\n"
outTerm = "\r"
inputTerminator = "\r\n"
outputTerminator = "\r"
} else if opt == "--lf2cr" {
inTerm = "\n"
outTerm = "\r"
inputTerminator = "\n"
outputTerminator = "\r"
} else if opt == "--crlf2lf" {
inTerm = "\r\n"
outTerm = "\n"
inputTerminator = "\r\n"
outputTerminator = "\n"
} else if opt == "--cr2lf" {
inTerm = "\r"
outTerm = "\n"
inputTerminator = "\r"
outputTerminator = "\n"
} else {
termcvtUsage(verb, os.Stderr, 1)
}
}

if len(args) == 0 {
termcvtFile(os.Stdin, os.Stdout, inTerm, outTerm)
termcvtFile(os.Stdin, os.Stdout, inputTerminator, outputTerminator)

} else if doInPlace {
for _, filename := range args {
Expand All @@ -94,7 +94,7 @@ func termcvtMain(args []string) int {
os.Exit(1)
}

termcvtFile(istream, ostream, inTerm, outTerm)
termcvtFile(istream, ostream, inputTerminator, outputTerminator)

istream.Close()
// TODO: check return status
Expand All @@ -118,20 +118,20 @@ func termcvtMain(args []string) int {
os.Exit(1)
}

termcvtFile(istream, os.Stdout, inTerm, outTerm)
termcvtFile(istream, os.Stdout, inputTerminator, outputTerminator)

istream.Close()
}
}
return 0
}

func termcvtFile(istream *os.File, ostream *os.File, inTerm string, outTerm string) {
func termcvtFile(istream *os.File, ostream *os.File, inputTerminator string, outputTerminator string) {
lineReader := bufio.NewReader(istream)
inTermFinal := []byte(inTerm[len(inTerm)-1:])[0] // bufio.Reader.ReadString takes char not string delimiter :(
inputTerminatorBytes := []byte(inputTerminator[len(inputTerminator)-1:])[0] // bufio.Reader.ReadString takes char not string delimiter :(

for {
line, err := lineReader.ReadString(inTermFinal)
line, err := lineReader.ReadString(inputTerminatorBytes)
if err == io.EOF {
break
}
Expand All @@ -143,7 +143,7 @@ func termcvtFile(istream *os.File, ostream *os.File, inTerm string, outTerm stri
}

// This is how to do a chomp:
line = strings.TrimRight(line, inTerm)
ostream.Write([]byte(line + outTerm))
line = strings.TrimRight(line, inputTerminator)
ostream.Write([]byte(line + outputTerminator))
}
}
2 changes: 1 addition & 1 deletion internal/pkg/bifs/arithmetic.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func BIF_minus_binary(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval {
// 2**63-1 (or is less than -2**63) using integer arithmetic (it may have
// already overflowed) *or* using double-precision (granularity). Instead we
// check if the absolute value of the product exceeds the largest representable
// double less than 2**63. (An alterative would be to do all integer multiplies
// double less than 2**63. (An alternative would be to do all integer multiplies
// using handcrafted multi-word 128-bit arithmetic).

func times_n_ii(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval {
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/bifs/collections.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ func BIF_append(input1, input2 *mlrval.Mlrval) *mlrval.Mlrval {
}

// ----------------------------------------------------------------
// First argumemnt is prefix.
// First argument is prefix.
// Second argument is delimiter.
// Third argument is map or array.
// flatten("a", ".", {"b": { "c": 4 }}) is {"a.b.c" : 4}.
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/climain/mlrcli_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func parseCommandLinePassTwo(
options,
true, // false for first pass of CLI-parse, true for second pass -- this is the first pass
)
// Unparseable verb-setups should have been found in pass one.
// Unparsable verb-setups should have been found in pass one.
lib.InternalCodingErrorIf(transformer == nil)
// Make sure we consumed the entire verb sequence as parsed by pass one.
lib.InternalCodingErrorIf(argi != argc)
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/climain/mlrcli_shebang.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func maybeInterpolateDashS(args []string) []string {
}

// TODO: maybe support comment lines deeper within the script-file.
// Make sure they're /^[\s]+#/ since we dont' want to disrupt a "#" within
// Make sure they're /^[\s]+#/ since we don't want to disrupt a "#" within
// strings which are not actually comment characters.

// Re-join lines to strings, and pass off to a shell-parser to split into
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/input/record_reader_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (reader *RecordReaderJSON) processHandle(
//
// Miller lets users (on an opt-in basis) have comments in their data files,
// for all formats including JSON. Comments are only honored at start of line.
// Users can have them be printed to stdout straightaway, or simply discarded.
// Users can have them be printed to stdout straight away, or simply discarded.
//
// For most file formats Miller is doing line-based I/O and can deal with
// comment lines easily and simply. But for JSON, the Go library needs an
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/lib/unbackslash.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var unbackslashReplacements = map[byte]string{
'?': "?",
}

// UnbackslashStringLiteral replaces "\t" with TAB, etc. for DSL expresions
// UnbackslashStringLiteral replaces "\t" with TAB, etc. for DSL expressions
// like '$foo = "a\tb"'. See also
// https://en.wikipedia.org/wiki/Escape_sequences_in_C
// (predates the port of Miller from C to Go).
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/mlrval/mlrval_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package mlrval
// MlrvalFromPending is designed solely for the JSON API, for something
// intended to be mutated after construction once its type is (later) known.
// Whereas ERROR, ABSENT, etc are all singletons, this one
// must be mutable and therefor non-singleton.
// must be mutable and therefore non-singleton.

func MlrvalFromPending() Mlrval {
return Mlrval{
Expand Down
Loading

0 comments on commit 0c75713

Please sign in to comment.