3 ms·
I feel like every person who advocates for -Werror shows up to a codebase with a billion warnings once and then assumes that nobody can ever voluntarily keep th
by saagarjha 3y ago
I feel like every person who advocates for -Werror shows up to a codebase with a billion warnings once and then assumes that nobody can ever voluntarily keep their code compiling without warnings if they don’t have the build stop immediately so they can fix it.
I’ve worked on dozens of non-legacy codebases and in every single one we don’t have warnings last for long, because going from zero to a few warnings is annoying. I don’t want that spam in my logs and I definitely don’t want suspicious constructs in my codebase. For the ones that enable -Werror, by the way, I always disable it so I can work and clean things up before committing. It’s just basic hygiene and discipline, the same as formatting your code before sending a PR. If your team doesn’t have that then it has bigger problems.
- vlovich123 3y agoHow many people were involved in this codebase at a given time and how many years was the project ongoing?
- saagarjha 3y agoProfessionally the ones that did this had between 2-200 engineers working on them at any given time. Most code was a decade or so old, with some legacy components that were older or vendored (but in many cases were not touched much and may have certain warnings disabled). iOS-focused, so Swift, Objective-C, C++ in Xcode. In open source projects most of the ones I work on have a handful of regular contributors and a couple dozen one-off or other irregular contributions. In many cases we don't get all the warnings on every system that anyone uses but if someone goes "fix warnings for GCC 13 on Alpha" or whatever environment they're using we are more than happy to take their changes, and if it warns in CI or on any of our machines we'll either bring it up during PR review or submit a change soon afterwards to fix it. I'm too young to have projects more than a few years old but there's a decent number of other open source projects with a long history and many contributors that compile with no warnings on say their Linux CI and maybe a handful if you pass it through Apple Clang (since they don't test that much).
- derefr 3y agoIt sounds like you don't want your compiler to stop on errors, but rather, you want your CI to recognize errors, and to prevent the merging of feature branches that have any warnings.
- code_biologist 3y agoMaybe this is what you're saying, but to have CI prevent the merging of feature branches that introduce new warnings? That's my favorite setup for introducing lint or lint rules to a large codebase.
- derefr 3y agoYes, but no need for the added complexity of a delta of warnings against the base branch. The presumption here (given the GP comment) is that main has no warnings, since warnings are only allowed "during development", and should be cleaned up before production. So the CI only has to be intelligent enough to prevent merging (to main) of a branch with any warnings.