Repository navigation
Open
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
When the configuration file datastructure is incorrect,the bot fails in weird and wonderful ways. e.g.
{
"projectName": "coding_challenge-13",
"projectOwner": "zeroDevs",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"contributors": [
{
"login": "The24thDS",
"name": "David Sima",
"avatar_url": "https://avatars0.githubusercontent.com/u/26633429?v=4",
"profile": "https://github.com/The24thDS",
"contributions": [
"code",
"bug",
"review"
]
},
{
"login": "mikeattara",
"name": "Mike Perry Y Attara",
"avatar_url": "https://avatars1.githubusercontent.com/u/31483629?v=4",
"profile": "https://mikeattara.com",
"contributions": [
"ideas",
"code",
"review",
"test"
]
},
{
"login": "AkinAguda",
"name": "Akinwunmi Aguda",
"avatar_url": "https://avatars0.githubusercontent.com/u/39712415?v=4",
"profile": "https://github.com/AkinAguda",
"contributions": [
"bug"
]
},
{
"login": "jakebolam",
"name": "Jake Bolam",
"avatar_url": "https://avatars2.githubusercontent.com/u/3534236?v=4",
"profile": "https://jakebolam.com",
"contributions": [
"question"
]
},
{
"login": "aneagoie",
"name": "Andrei Neagoie",
"avatar_url": "https://avatars3.githubusercontent.com/u/10776230?v=4",
"profile": "https://github.com/aneagoie",
"contributions": [
"bug",
"code",
"ideas",
"review"
]
},
{
"login": "MattCSmith",
"name": "Matt Smith",
"avatar_url": "https://avatars3.githubusercontent.com/u/6190356?v=4",
"profile": "https://github.com/MattCSmith",
"contributions": [
"question",
"bug",
"code",
"ideas",
"review"
]
},
{
"contributions": [
"ideas"
]
},
]
}
Technically valid JSON but the schema is busted.
Describe the solution you'd like
Provide great error messages, so users no whats wrong with the schema.
Even better: Auto fix it!
Additional context
See: https://sentry.io/all-contributors/github-bot/issues/859146506/?query=is%3Aunresolved
Also issues: zeroDevs/FullstackTrends_Challenge-13#182
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
Berkmann18 commentedon Feb 6, 2019
An approach to this would be:
There are some interesting solutions in this SO post (although most are for only fixing quote issues).
https://jsontuneup.com/ might be a helpful example.
In any case, this comes down to the CLI dependency not being able to parse a malformed configuration file. I started looking into that and found a decent library that provides much more informative errors and which I'm currently exploiting to see if I can get an auto-fixer into the mix.
feat: added a JSON handler/fixer [wip]
jakebolam commentedon Mar 30, 2019
This also broke the schema. Specifying invalid contribution types in the JSON. See sentry: https://sentry.io/organizations/all-contributors/issues/957977140/events/50916998062/
[-]Better error handling when the configuration file is malformed.[/-][+]Better error handling when the configuration file data structure is incorrect[/+]feat: added a JSON handler/fixer (#165)