Showing 257 of 257 total issues
Ambiguous variable name 'l' Open
default = [l-1 for l in self.via_layout]
- Read upRead up
- Exclude checks
Never use the characters 'l', 'O', or 'I' as variable names.
In some fonts, these characters are indistinguishable from the
numerals one and zero. When tempted to use 'l', use 'L' instead.
Okay: L = 0
Okay: o = 123
Okay: i = 42
E741: l = 0
E741: O = 123
E741: I = 42
Variables can be bound in several other contexts, including class
and function definitions, 'global' and 'nonlocal' statements,
exception handlers, and 'with' and 'for' statements.
In addition, we have a special handling for function parameters.
Okay: except AttributeError as o:
Okay: with lock as L:
Okay: foo(l=12)
Okay: for a in foo(l=12):
E741: except AttributeError as O:
E741: with lock as l:
E741: global I
E741: nonlocal l
E741: def foo(l):
E741: def foo(l=12):
E741: l = foo(l=12)
E741: for l in range(10):
E742: class I(object):
E743: def l(x):
Blank line at end of file Open
- Read upRead up
- Exclude checks
Trailing blank lines are superfluous.
Okay: spam(1)
W391: spam(1)\n
However the last line should end with a new line (warning W292).
Don't use variables in the printf format string. Use printf "..%s.." "$foo". Open
[ -z "$1" ] || printf "Error: $1\n"
- Read upRead up
- Exclude checks
Don't use variables in the printf format string. Use printf "..%s.." "$foo".
Problematic code:
printf "Hello, $NAME\n"
Correct code:
printf "Hello, %s\n" "$NAME"
Rationale:
printf
interprets escape sequences and format specifiers in the format string. If variables are included, any escape sequences or format specifiers in the data will be interpreted too, when you most likely wanted to treat it as data. Example:
coverage='96%'
printf "Unit test coverage: %s\n" "$coverage"
printf "Unit test coverage: $coverage\n"
The first printf writes Unit test coverage: 96%
.
The second writes bash: printf: `\': invalid format character
Exceptions
Sometimes you may actually want to interpret data as a format string, like in:
hexToAscii() { printf "\x$1"; }
hexToAscii 21
or when you have a pattern in a variable:
filepattern="file-%d.jpg"
printf -v filename "$filepattern" "$number"
These are valid use cases with no useful rewrites. Please [[ignore]] the warnings with a [[directive]].
Notice
Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.
Use $(..) instead of legacy ..
. Open
PYTHONPATH=`pwd` python -m nose2 -C --coverage "$KICADMODTREE_DIR" --coverage-report term-missing -s "$KICADMODTREE_DIR/tests"
- Read upRead up
- Exclude checks
Use $(STATEMENT) instead of legacy `STATEMENT`
Problematic code
echo "Current time: `date`"
Correct code
echo "Current time: $(date)"
Rationale
Backtick command substitution `STATEMENT`
is legacy syntax with several issues.
- It has a series of undefined behaviors related to quoting in POSIX.
- It imposes a custom escaping mode with surprising results.
- It's exceptionally hard to nest.
$(STATEMENT)
command substitution has none of these problems, and is therefore strongly encouraged.
Exceptions
None.
See also
Notice
Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.
TODO found Open
# TODO: allow writing into sub dir
- Exclude checks
TODO found Open
pass # TODO: throw warning because drill is not supported
- Exclude checks
TODO found Open
# TODO make size calculation more resilient
- Exclude checks
TODO found Open
self.width = kwargs.get('width', 0.12) # TODO: auto detection
- Exclude checks
TODO found Open
# TODO: +- pi border
- Exclude checks
TODO found Open
print("TODO: add angle side: {1}".format(float_angle))
- Exclude checks
TODO found Open
parser.add_argument('-v', '--verbose', help='show some additional information', action='store_true') # TODO
- Exclude checks
TODO found Open
self.width = kwargs.get('width', 0.12) # TODO: better variation to get line width
- Exclude checks
TODO found Open
# TODO: recursion detection
- Exclude checks
TODO found Open
# TODO: finish implementation
- Exclude checks
TODO found Open
from KicadModTree.nodes.base.Pad import Pad # TODO: why .KicadModTree is not enough?
- Exclude checks
TODO found Open
# TODO: most of the points are 2D Nodes
- Exclude checks
TODO found Open
# TODO: sort Text by type
- Exclude checks