Skip to content

Commit

Permalink
chore: deno fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Nov 12, 2024
1 parent 9ea0d78 commit 58555ae
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/files/dwi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { parseBvalBvec } from './dwi.ts'

Deno.test('Test bval/bvec parsing', async (t) => {
await t.step('Load 3 bvals', async () => {
const bvals = parseBvalBvec('0 1 2 \n') // Typically ends with " \n"
const bvals = parseBvalBvec('0 1 2 \n') // Typically ends with " \n"
assertEquals(bvals, [['0', '1', '2']])
})
await t.step('Load 3 bvals - missing newline', async () => {
Expand Down Expand Up @@ -32,4 +32,3 @@ Deno.test('Test bval/bvec parsing', async (t) => {
assertEquals(bvecs, [['0', '1', '2'], ['0', '1', '2'], ['0', '1', '2']])
})
})

4 changes: 2 additions & 2 deletions src/issues/datasetIssues.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { nonSchemaIssues } from './list.ts'
import type { Issue, Severity, IssueDefinition, IssueFile } from '../types/issues.ts'
export type { Issue, Severity, IssueDefinition, IssueFile }
import type { Issue, IssueDefinition, IssueFile, Severity } from '../types/issues.ts'
export type { Issue, IssueDefinition, IssueFile, Severity }

// Code is deprecated, return something unusual but JSON serializable
const CODE_DEPRECATED = Number.MIN_SAFE_INTEGER
Expand Down
9 changes: 4 additions & 5 deletions src/issues/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,13 @@ export const bidsIssues: IssueDefinitionRecord = {
},
CITATION_CFF_VALIDATION_ERROR: {
severity: 'error',
reason:
"The file does not pass validation using the citation.cff standard's schema." +
'https://github.com/citation-file-format/citation-file-format/blob/main/schema-guide.md'
reason: "The file does not pass validation using the citation.cff standard's schema." +
'https://github.com/citation-file-format/citation-file-format/blob/main/schema-guide.md',
},
FILE_READ: {
severity: 'error',
reason: 'We were unable to read this file.'
}
reason: 'We were unable to read this file.',
},
}

const hedIssues: IssueDefinitionRecord = {
Expand Down
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export async function main(): Promise<ValidationResult> {
// Run the schema based validator
const schemaResult = await validate(tree, options, config)

let output_string = ""
let output_string = ''
if (options.json) {
output_string = resultToJSONStr(schemaResult)
output_string = resultToJSONStr(schemaResult)
} else {
output_string = consoleFormat(schemaResult, {
verbose: options.verbose ? options.verbose : false,
Expand All @@ -41,7 +41,7 @@ export async function main(): Promise<ValidationResult> {
if (globalThis.Deno) {
Deno.writeTextFileSync(options.outfile, output_string)
} else {
console.error("Output to file only supported in Deno runtime")
console.error('Output to file only supported in Deno runtime')
console.log(output_string)
}
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/schema/associations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ export async function buildAssociations(
try {
file = walkBack(source, inherit, extensions, suffix).next().value
} catch (error) {
if (error && typeof error === 'object' && 'code' in error && error.code === 'MULTIPLE_INHERITABLE_FILES') {
if (
error && typeof error === 'object' && 'code' in error &&
error.code === 'MULTIPLE_INHERITABLE_FILES'
) {
// @ts-expect-error
issues.add(error)
break
Expand Down
5 changes: 4 additions & 1 deletion src/schema/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ export class BIDSContext implements Context {
try {
sidecars = [...walkBack(this.file)]
} catch (error) {
if (error && typeof error === 'object' && 'code' in error && error.code === 'MULTIPLE_INHERITABLE_FILES') {
if (
error && typeof error === 'object' && 'code' in error &&
error.code === 'MULTIPLE_INHERITABLE_FILES'
) {
// @ts-expect-error
this.dataset.issues.add(error)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/setup/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type ValidatorOptions = {
}

const modalityType = new EnumType<string>(
Object.keys(schema.rules.modalities)
Object.keys(schema.rules.modalities),
)

/** Extendable Cliffy Command with built in BIDS validator options */
Expand Down
8 changes: 4 additions & 4 deletions src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export async function getVersion(): Promise<string> {
async function getLocalVersion(path: string): Promise<string> {
// safe.directory setting so we could still operate from another user
try {
const command = new Deno.Command("git", {
const command = new Deno.Command('git', {
args: ['-C', path, '-c', 'safe.directory=*', 'describe', '--tags', '--always'],
})
const { success, stdout } = await command.output();
const { success, stdout } = await command.output()
const description = new TextDecoder().decode(stdout).trim()
return description
} catch(err) {
return ""
} catch (err) {
return ''
}
}

Expand Down

0 comments on commit 58555ae

Please sign in to comment.