Skip to content

Commit

Permalink
stylecheck: nnkArglist -> nnkArgList (#127)
Browse files Browse the repository at this point in the history
* stylecheck: nnkArglist -> nnkArgList

* --stylecheck:error iff >= 1.6.0
  • Loading branch information
tersec authored Jul 18, 2022
1 parent 9a3130e commit f173efc
Show file tree
Hide file tree
Showing 25 changed files with 148 additions and 12 deletions.
14 changes: 12 additions & 2 deletions stew.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,19 @@ requires "nim >= 1.2.0",

### Helper functions
proc test(args, path: string) =
# nnkArglist was changed to nnkArgList, so can't always use --styleCheck:error
# https://github.com/nim-lang/Nim/pull/17529
# https://github.com/nim-lang/Nim/pull/19822
let styleCheckStyle =
if (NimMajor, NimMinor) < (1, 6):
"hint"
else:
"error"

# Compilation language is controlled by TEST_LANG
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " & args &
" -r --hints:off --skipParentCfg --styleCheck:usages --styleCheck:error " & path
exec "nim " & getEnv("TEST_LANG", "c") & " " & getEnv("NIMFLAGS") & " " &
args & " -r --hints:off --skipParentCfg --styleCheck:usages --styleCheck:" &
styleCheckStyle & " " & path

task test, "Run all tests":
test "--threads:off", "tests/all_tests"
Expand Down
2 changes: 1 addition & 1 deletion stew/shims/macros.nim
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ macro unpackArgs*(callee: untyped, args: untyped): untyped =
for arg in args:
let arg = if arg.kind == nnkHiddenStdConv: arg[1]
else: arg
if arg.kind == nnkArglist:
if arg.kind == nnkArgList:
for subarg in arg:
result.add subarg
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/all_tests.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# stew
# Copyright 2018-2019 Status Research & Development GmbH
# Copyright 2018-2022 Status Research & Development GmbH
# Licensed under either of
#
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
Expand Down
2 changes: 2 additions & 0 deletions tests/ranges/all.nim
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
{.used.}

import
ttypedranges, tstackarrays, tbitranges
8 changes: 8 additions & 0 deletions tests/ranges/tbitranges.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
random, unittest2,
../../stew/ranges/bitranges, ../../stew/bitseqs
Expand Down
8 changes: 8 additions & 0 deletions tests/ranges/tstackarrays.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2, math,
../../stew/ptrops,
Expand Down
8 changes: 8 additions & 0 deletions tests/ranges/ttypedranges.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2, sets,
../../stew/ranges/[typedranges, ptr_arith]
Expand Down
8 changes: 8 additions & 0 deletions tests/test_assign2.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2020-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2,
../stew/assign2
Expand Down
8 changes: 8 additions & 0 deletions tests/test_bitops2.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import unittest2

import ../stew/bitops2
Expand Down
8 changes: 8 additions & 0 deletions tests/test_bitseqs.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2, strformat,
../stew/[bitseqs]
Expand Down
4 changes: 3 additions & 1 deletion tests/test_byteutils.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# byteutils
# Copyright (c) 2018 Status Research & Development GmbH
# Copyright (c) 2018-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2,
../stew/byteutils
Expand Down
8 changes: 8 additions & 0 deletions tests/test_ctops.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2020-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import unittest2
import ../stew/ctops

Expand Down
8 changes: 8 additions & 0 deletions tests/test_endians2.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import unittest2

import ../stew/endians2
Expand Down
4 changes: 3 additions & 1 deletion tests/test_interval_set.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nimbus - Types, data structures and shared utilities used in network sync
#
# Copyright (c) 2018-2021 Status Research & Development GmbH
# Copyright (c) 2018-2022 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
Expand All @@ -9,6 +9,8 @@
# at your option. This file may not be copied, modified, or
# distributed except according to those terms.

{.used.}

import
unittest2,
../stew/interval_set
Expand Down
8 changes: 8 additions & 0 deletions tests/test_io2.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2020-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import unittest2
import ../stew/io2

Expand Down
4 changes: 3 additions & 1 deletion tests/test_keyed_queue.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Copyright (c) 2018-2022 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
Expand All @@ -8,6 +8,8 @@
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.

{.used.}

import
std/[algorithm, sequtils, strformat, strutils, tables],
unittest2,
Expand Down
9 changes: 8 additions & 1 deletion tests/test_macros.nim
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Copyright (c) 2020-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2,
../stew/shims/macros


template unknown() {.pragma.}
template zero() {.pragma.}
template one(one: string) {.pragma.}
Expand Down
4 changes: 3 additions & 1 deletion tests/test_ptrops.nim
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# stew
# Copyright 2018-2019 Status Research & Development GmbH
# Copyright 2018-2022 Status Research & Development GmbH
# Licensed under either of
#
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
#
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import unittest2

import ../stew/ptrops
Expand Down
2 changes: 2 additions & 0 deletions tests/test_results.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{.used.}

# nim-result is also available stand-alone from https://github.com/arnetheduck/nim-result/

import ../stew/results
Expand Down
4 changes: 3 additions & 1 deletion tests/test_sequtils2.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# byteutils
# Copyright (c) 2018 Status Research & Development GmbH
# Copyright (c) 2018-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2,
../stew/sequtils2
Expand Down
8 changes: 8 additions & 0 deletions tests/test_sets.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2,
../stew/shims/sets
Expand Down
4 changes: 3 additions & 1 deletion tests/test_sorted_set.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Nimbus
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Copyright (c) 2018-2022 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
# http://www.apache.org/licenses/LICENSE-2.0)
Expand All @@ -8,6 +8,8 @@
# at your option. This file may not be copied, modified, or distributed except
# according to those terms.

{.used.}

import
std/[algorithm, sequtils, strformat, tables],
../stew/sorted_set,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_templateutils.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2,
../stew/templateutils
Expand Down
8 changes: 8 additions & 0 deletions tests/test_varints.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2019-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import
unittest2, random,
../stew/[varints, byteutils]
Expand Down
9 changes: 8 additions & 1 deletion tests/test_winacl.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Copyright (c) 2020-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license: http://opensource.org/licenses/MIT
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.used.}

import unittest2
import ../stew/io2

when defined(windows):
import ../stew/windows/acl
Expand Down

0 comments on commit f173efc

Please sign in to comment.