Posts

Stackoverflow Answers Miss The Mark- CLI Input Validation

  I was testing out so_pip looking for re-usable code on SO and found https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response Someone posted a really specific "how do I do this specific thing: check if input is more or less than 18", the big picture answer is: Look, a CLI has to get input from people just like a browser or GUI does, but out-of-the-box there isn't an input field where you can set any properties to restrict user input. But you can get most of the way there by writing 6-10 lines of non-reusable code if all you want to do is write that little one-trick pony program. Summary of answers One interesting answer is linux only, I couldn’t test. Two related answers provide a function that force an input to be an integer in a range, or an arbitrary type in a range. The rest didn’t have re-usuable code, or if they did, it wasn’t for the main problem. One answer said use click.prompt and that is getting close to the corr...

Yamllint and Sonar

We start with what Sonar thinks about Yaml, it uses this Java based Yaml linter .  It is not a Sonar supported plug-in. It is not supported by Sonar, I can't file a bug against it with sonar That yaml linter appears to have no companion formatter. No formatter exists to format to it's idiosyncratic dialect (I checked a bunch, I'm well beyond the point where I'm getting a good return on my time) Filing bugs against prettier is unlikely to help, prettier as a project isn't tied to yamllint I filed a bug against yamllint, but I'm essentially asking them to either change their dialect to something an existing formatter uses or write their own formatter. I don't see that ever happening This just doesn't make any sense anyhow, yaml is machine generated, machine consumed. Machine formatting is fine and which machine formatter is used shouldn't strongly matter. Turning off all of yamllints formatting rules and leaving structural validity rules would be fine,...