Skip to content

Commit 8534723

Browse files
committed
Merge remote-tracking branch 'upstream/main' into dev
2 parents 5a335f5 + 587842a commit 8534723

File tree

10 files changed

+34
-15
lines changed

10 files changed

+34
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ The BIDS Validator can be run with the [Deno][] runtime
2727
(see [Deno - Installation][] for detailed installation instructions):
2828

2929
```shell
30-
deno run -ERN jsr:@bids/validator
30+
deno run -ERWN jsr:@bids/validator
3131
```
3232

3333
Deno by default sandboxes applications like a web browser.
34-
`-E`, `-R` and `-N` allow the validator to read environment variables,
35-
local files, and network locations.
34+
`-E`, `-R`, '-W', and `-N` allow the validator to read environment variables,
35+
read/write local files, and read network locations.
3636

3737
### Configuration file
3838

docs/user_guide/command-line.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ In general, there is no need to install Deno applications.
1010
`deno run` allows running from the Javascript Repository:
1111

1212
```sh
13-
deno run -ERN jsr:@bids/validator <dataset>
13+
deno run -ERWN jsr:@bids/validator <dataset>
1414
```
1515

1616
However, you can also install a lightweight script (into `$HOME/.deno/bin`):
1717

1818
```sh
19-
deno install -ERN -g -n bids-validator jsr:@bids/validator
19+
deno install -ERWN -g -n bids-validator jsr:@bids/validator
2020
```
2121

2222
Or compile a bundled binary:
2323

2424
```sh
25-
deno compile -ERN -o bids-validator jsr:@bids/validator
25+
deno compile -ERWN -o bids-validator jsr:@bids/validator
2626
```
2727

2828
## Usage
@@ -36,7 +36,7 @@ The BIDS Validator takes a single dataset as input:
3636
:sync: run
3737

3838
```sh
39-
deno run -ERN jsr:@bids/validator <dataset>
39+
deno run -ERWN jsr:@bids/validator <dataset>
4040
```
4141

4242
:::

src/files/filetree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const nullFile = {
88
stream: new ReadableStream({
99
start(controller) {
1010
controller.close()
11-
}
11+
},
1212
}),
1313
text: () => Promise.resolve(''),
1414
readBytes: async (size: number, offset?: number) => new Uint8Array(),

src/files/streams.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { assert, assertEquals } from '@std/assert'
22
import { createUTF8Stream, UnicodeDecodeError } from './streams.ts'
3-
import { streamFromUint8Array, streamFromString } from '../tests/utils.ts'
3+
import { streamFromString, streamFromUint8Array } from '../tests/utils.ts'
44

55
Deno.test('createUTF8Stream', async (t) => {
66
await t.step('should return a TransformStream with UTF8StreamTransformer', () => {

src/files/tsv.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { assert, assertEquals, assertNotStrictEquals, assertObjectMatch, assertStrictEquals } from '@std/assert'
1+
import {
2+
assert,
3+
assertEquals,
4+
assertNotStrictEquals,
5+
assertObjectMatch,
6+
assertStrictEquals,
7+
} from '@std/assert'
28
import { pathToFile } from './filetree.ts'
39
import { loadTSV } from './tsv.ts'
410
import { streamFromString } from '../tests/utils.ts'

src/issues/datasetIssues.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class DatasetIssues {
4242
if (!value) {
4343
continue
4444
}
45-
if (key === 'location' && typeof value === "string" && !value.startsWith('/')){
45+
if (key === 'location' && typeof value === 'string' && !value.startsWith('/')) {
4646
const key_ignore = ignore().add(value as string)
4747
found = found.filter((x) => x[key] && key_ignore.ignores(x[key].slice(1, x[key].length)))
4848
} else {

src/types/columns.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ Deno.test('ColumnsMap', async (t) => {
3737
// @ts-expect-error ibid
3838
assertEquals(columns.size, ['0'])
3939
})
40+
await t.step('set columns are permissible', () => {
41+
const columns = new ColumnsMap()
42+
// @ts-expect-error ts thinks size is protected property
43+
columns['set'] = ['0']
44+
// @ts-expect-error ibid
45+
assertEquals(columns.set, ['0'])
46+
})
4047
await t.step('missing columns are undefined', () => {
4148
const columns = new ColumnsMap()
4249
columns['a'] = ['0']

src/types/columns.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ const columnMapAccessorProxy = {
1515
prop: symbol | string,
1616
receiver: ColumnsMap,
1717
) {
18-
// Map.size exists, so we need to shadow it with the column contents
19-
if (prop === 'size') return target.get('size')
18+
// Map instance methods/properties that could plasubily be column names:
19+
if (
20+
['clear', 'delete', 'keys', 'set', 'values', 'size'].includes(
21+
prop as string,
22+
)
23+
) {
24+
return target.get(prop as string)
25+
}
2026
const value = Reflect.get(target, prop, receiver)
2127
if (typeof value === 'function') return value.bind(target)
2228
if (prop === Symbol.iterator) return target[Symbol.iterator].bind(target)

src/utils/memoize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type WithCache<T> = T & { cache: Map<string, any> }
22
interface FileLike {
3-
path: string,
3+
path: string
44
parent: { path: string }
55
}
66

src/validators/filenameIdentify.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Deno.test('test hasMatch', async (t) => {
6868

6969
await t.step('No match', async () => {
7070
const tmpFile = Deno.makeTempFileSync()
71-
const [ dir, base ] = tmpFile.split(SEPARATOR_PATTERN)
71+
const [dir, base] = tmpFile.split(SEPARATOR_PATTERN)
7272
const file = new BIDSFileDeno(dir, `/${base}`, ignore)
7373

7474
const context = new BIDSContext(file)

0 commit comments

Comments
 (0)