Showing 2,660 of 2,660 total issues
Color literals like #ccc
should only be used in variable declarations; they should be referred to via variable everywhere else. Open
border-bottom: 1px solid #ccc;
- Exclude checks
Color literals like #ccc
should only be used in variable declarations; they should be referred to via variable everywhere else. Open
border-top: 1px solid #ccc;
- Exclude checks
Each selector in a comma sequence should be on its own single line Open
h1 + p, h1 + pre + p {
- Exclude checks
Properties should be ordered background-color, border-radius, color Open
border-radius: 0;
- Exclude checks
Unnecessary parent selector (&) Open
& > p {
- Exclude checks
Color literals like #909090
should only be used in variable declarations; they should be referred to via variable everywhere else. Open
color: #909090;
- Exclude checks
Don't use variables in the printf format string. Use printf "..%s.." "$foo". Open
printf "\n${CLEAR_LINE}${GREEN}đźš” Rubocop has autocorrected your transgressions!${NO_COLOR}\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.
Expected item on line 317 to appear before line 313. Rule sets should be ordered as follows: @extends
, @includes
without @content
, properties, @includes
with @content
, nested rule sets Open
@extend %left-col;
- Exclude checks
Unnecessary parent selector (&) Open
& > ul, & > ol {
- Exclude checks
Color literals like #ddd
should only be used in variable declarations; they should be referred to via variable everywhere else. Open
border-top: 1px solid #ddd;
- Exclude checks
Each selector in a comma sequence should be on its own single line Open
h1 + h2, h1 + div + h2 {
- Exclude checks
border-top: 0
is preferred over border-top: none
Open
border-top: none;
- Exclude checks
Properties should be ordered font-size, padding Open
padding: 10px;
- Exclude checks
Each selector in a comma sequence should be on its own single line Open
p, li, dt, dd {
- Exclude checks
Merge rule aside.warning:before
with rule on line 445 Open
aside.warning:before {
- Exclude checks
Expected item on line 498 to appear before line 488. Rule sets should be ordered as follows: @extends
, @includes
without @content
, properties, @includes
with @content
, nested rule sets Open
@extend %right-col;
- Exclude checks
Color literals like #404040
should only be used in variable declarations; they should be referred to via variable everywhere else. Open
border-bottom: 1px solid #404040;
- Exclude checks
Don't use variables in the printf format string. Use printf "..%s.." "$foo". Open
printf "\n${CLEAR_LINE}${GREEN}âť“ Some of your files are partially staged- add the corrections yourself and commit with -n.${NO_COLOR}\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.
Unnecessary parent selector (&) Open
& > h1, & > h2, & > div {
- Exclude checks
Properties should be ordered border-bottom, color, text-decoration Open
color: #fff;
- Exclude checks