-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Clean themes A-L #2315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean themes A-L #2315
Conversation
seefood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
90% there.
| local offset=$((${#RELATIVE_PWD} - $MAX_PWD_LENGTH)) | ||
| local offset=$((${#RELATIVE_PWD} - MAX_PWD_LENGTH)) | ||
|
|
||
| if [ $offset -gt "0" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why the shellcheck doesn't complain about this unquoted $offset. Maybe it is because IFS is not modified inside this file and offset is ensured to contain a number in this context? However, the shell configuration should anticipate an arbitrary IFS value set outside the file by the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed that recent ShellCheck releases have become better at knowing when variables have a value that can only be a number. But I disagree that it should anticipate an arbitrary IFS value - the value deduction is just too handy and it covers 99% of setups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I disagree that it should anticipate an arbitrary
IFSvalue - the value deduction is just too handy and it covers 99% of setups.
I wouldn't argue that there would be a sane setup with IFS including numbers, but it is a valid usage to temporarily set IFS to a number, do something, and then revert it.
$ oldifs=${IFS-$' \t\n'}
$ IFS='blahblah'
$ do-something
$ IFS=$oldifsIn such a case, [ $offset -gt "0" ] may be broken temporarily for the third and fourth prompts.
Actually, one could simply rewrite it as ((offset > 0)), which is more obvious and easier to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I disagree that it should anticipate an arbitrary
IFSvalue - the value deduction is just too handy and it covers 99% of setups.
I was actually a bit confused about the point, but have you possibly misunderstood as if I thought ShellCheck should anticipate an arbitrary IFS? No, I don't think ShellCheck should anticipate an arbitrary IFS value. It is understandable that ShellCheck assumes the normal IFS when the script does not modify IFS. By the shell configuration in my original reply, I meant Bash-it (which is a configuration for interactive shell sessions), but I didn't mean ShellCheck. The situation with interactive shell settings are a bit different from that for normal shell scripts. The user has access to all the global variables, and the user may modify these at arbitrary time based on what the user wants to do. An interactive shell configuration should care about various possibilities for the commonly used variables, such as IFS.
Description
As per #1696, this cleans up various files by fixing ShellCheck errors.
This cleans 10 themes (and removes two entries from
clean_files.txtthat no longer exist.In the agnoster theme, I changed the "Git repository dirty check" to be more consistent with what I added in hawaii50 (to fix a ShellCheck issue).
Motivation and Context
As mentioned in #1696, this minimizes mistakes in the code.
How Has This Been Tested?
Ran
./lint_clean_files.shsuccessfully.Screenshots (if appropriate):
Types of changes
Checklist:
clean_files.txtand formatted it usinglint_clean_files.sh.