Skip to content

Conversation

@rwblair
Copy link
Member

@rwblair rwblair commented Dec 18, 2025

fixes #293

Sins committed in this PR:

  • Web version iterates through all files from directory upload to find .bids-validator-config.json
  • Web versions uses alert()

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.18%. Comparing base (cb9752b) to head (be5b560).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #329   +/-   ##
=======================================
  Coverage   87.18%   87.18%           
=======================================
  Files          51       51           
  Lines        3801     3801           
  Branches      615      615           
=======================================
  Hits         3314     3314           
  Misses        477      477           
  Partials       10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +36 to +45
const defaultConfig = join(absolutePath, '.bids-validator-config.json')
try {
await Deno.lstat(defaultConfig)
config = JSON.parse(Deno.readTextFileSync(defaultConfig))
options.config = defaultConfig
} catch {
if (!(err instanceof Deno.errors.NotFound)) {
throw err;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we did what we do for .bidsignore and pull it out of the tree? We don't need a filesystem hit to check if it's there.

Suggested change
const defaultConfig = join(absolutePath, '.bids-validator-config.json')
try {
await Deno.lstat(defaultConfig)
config = JSON.parse(Deno.readTextFileSync(defaultConfig))
options.config = defaultConfig
} catch {
if (!(err instanceof Deno.errors.NotFound)) {
throw err;
}
}
const configFile = tree.get('.bids-validator-config.json') as BIDSFile
if (configFile) {
config = await configFile.text().then((text) => JSON.parse(text))
}

We could also use our JSON loader and create an issue. Probably better not to crash...

Comment on lines +57 to 64
let config = {}
const configFile = dirHandle.find(file => file.name ==='.bids-validator-config.json')
if (configFile) {
config = configFile.text().then(text => JSON.parse(text)).catch((err) => {
alert(`Failed to load ".bids-validator-config.json". \n\nUsing empty configuration object:\n\n${err}`)
})
}
const fileTree = await fileListToTree(dirHandle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly:

Suggested change
let config = {}
const configFile = dirHandle.find(file => file.name ==='.bids-validator-config.json')
if (configFile) {
config = configFile.text().then(text => JSON.parse(text)).catch((err) => {
alert(`Failed to load ".bids-validator-config.json". \n\nUsing empty configuration object:\n\n${err}`)
})
}
const fileTree = await fileListToTree(dirHandle)
const fileTree = await fileListToTree(dirHandle)
let config = {}
const configFile = fileTree.get('.bids-validator-config.json') as BIDSFile
if (configFile) {
config = await configFile.text().then(text => JSON.parse(text)).catch((err) => {
alert(`Failed to load ".bids-validator-config.json". \n\nUsing empty configuration object:\n\n${err}`)
})
}

@effigies
Copy link
Contributor

Oh, and we probably need to add .bids-validator-config.json to our default ignores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return default config file to be .bids-validator-config.json ?

3 participants