Opened 7 years ago
Closed 7 years ago
#30283 closed Cleanup/optimization (fixed)
Lint errors in django_bash_completion script
| Reported by: | Albert Wang | Owned by: | Albert Wang |
|---|---|---|---|
| Component: | Utilities | Version: | 2.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The django_bash_completion script has a few bash lint warnings from shellcheck. None of the errors are likely to affect users, except for using grep -E instead of egrep which should increase compatibility with different systems.
In extras/django_bash_completion line 1:
# #########################################################################
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang.
In extras/django_bash_completion line 46:
echo $PYTHON_EXE | egrep "python([3-9]\.[0-9])?" >/dev/null 2>&1
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2196: egrep is non-standard and deprecated. Use grep -E instead.
In extras/django_bash_completion line 47:
if [[ $? == 0 ]]; then
^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
In extras/django_bash_completion line 49:
echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2196: egrep is non-standard and deprecated. Use grep -E instead.
In extras/django_bash_completion line 50:
if [[ $? == 0 ]]; then
^-- SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.
In extras/django_bash_completion line 51:
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \
^-- SC2097: This assignment is only seen by the forked process.
In extras/django_bash_completion line 53:
DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) )
^-- SC2098: This expansion will not see the mentioned assignment.
In extras/django_bash_completion line 67:
pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ")
^-- SC2086: Double quote to prevent globbing and word splitting.
Note:
See TracTickets
for help on using tickets.
PR at https://code.djangoproject.com/ticket/30283