Comments (2)
we shouldn't encourage people to think turning on set -e
means they don't need to add error checking
https://mywiki.wooledge.org/BashFAQ/105
set -u
seems a matter of taste. I don't know that it catches bugs that really matter. for typod vars, shellcheck is better imo, especially because it is a static analyzer.
pipefail can be a little insidious. consider tools that exit early like grep -q
-- if you were piping a large file to it, it could trigger a write to a closed ("broken") pipe, but not consistently. this is a fun bug to track down.
might be worthwhile adding an appendix on these options and why we don't require them all the time.
from styleguide.
we shouldn't encourage people to think turning on
set -e
means they don't need to add error checking
The errexit option (set -e
) clearly doesn’t prevent the need for proper error checking. I would even say it forces people not letting some silent errors here and there. I do not see how it could represent such an encouragement.
More I think about it, not exiting on error only makes sens for an interactive use of Bash, but not for a script. But it is indeed probably not always a good idea to set this option when the script is used. But during the development phase at least it is highly useful imo.
You’re right for the pipefail option. I don’t think it is as important as the errexit and nounset options.
The nounset (set -u
), imho, forces user not to let “dead” code that could make the code harder to (re)read, and to always choose default value for any variable.
Thank you for your answers.
from styleguide.
Related Issues (20)
- Neotree and google-c-style.el default to standard indentation in C++
- Go: update `interface{}` to `any` HOT 2
- unclear include order in C headers
- Style guide foe MarkDown files
- Google style guide
- Google style
- N8-J
- Google Style HOT 1
- FYI: the diamond problem is solved! HOT 2
- Any plans for the l10n?
- styleguide.css doesn't follow https://google.github.io/styleguide/htmlcssguide.html HOT 1
- Broken link in style guide HOT 3
- Java Guide
- Cpplint forbids more headers than the style guide
- Why output parameters be sugguested as reference rather than pointer
- Go Style Guide — Go Tip Episodes & Unit Testing Practices HOT 1
- How the 4.4 Column Limit: 100 rule works for JSNI Method Reference?
- issue:The length of the tab is extra. HOT 1
- Consider clarifying “containing only the aligned leading asterisk”
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from styleguide.