-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
Add lint check as requested in #20717 #21143
Conversation
false | ||
end | ||
end | ||
end |
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.
Final newline missing.
# space before the end of the string | ||
def single_space_before(string) | ||
return false if string[-2] != ' ' | ||
return false if string[-3] == ' ' |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
# Check if there is one space and only one | ||
# space before the end of the string | ||
def single_space_before(string) | ||
return false if string[-2] != ' ' |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
# Check if the characters before the end of the string | ||
# are not what they should be | ||
def chars_before_incorrect(string) | ||
if config['style'] != 'new_line' |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
else | ||
return unless chars_before_incorrect(string) | ||
style_message = config['style'] == 'new_line' ? 'a new line' : 'one space' | ||
add_lint(line, 'Opening curly brace `{` should be ' \ |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
'`{` should be preceded by at least one space') | ||
else | ||
return unless chars_before_incorrect(string) | ||
style_message = config['style'] == 'new_line' ? 'a new line' : 'one space' |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [82/80]
if config['allow_single_line_padding'] && node_on_single_line?(node) | ||
return unless string[-2] != ' ' | ||
add_lint(line, 'Opening curly brace in a single line rule set '\ | ||
'`{` should be preceded by at least one space') |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
||
if config['allow_single_line_padding'] && node_on_single_line?(node) | ||
return unless string[-2] != ' ' | ||
add_lint(line, 'Opening curly brace in a single line rule set '\ |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
line = node.source_range.end_pos.line | ||
|
||
if config['allow_single_line_padding'] && node_on_single_line?(node) | ||
return unless string[-2] != ' ' |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
def check_for_space(node, string) | ||
line = node.source_range.end_pos.line | ||
|
||
if config['allow_single_line_padding'] && node_on_single_line?(node) |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
alias visit_rule check_node | ||
alias visit_while check_node | ||
|
||
private |
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.
Indent access modifiers like private.
source = source_from_range(node.source_range).strip | ||
|
||
# Only lint `@include`s which have curly braces | ||
if source[-1] == '{' |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -0,0 +1,77 @@ | |||
module SCSSLint | |||
# Checks for the presence of a single space before an opening brace. | |||
class Linter::VariableDefault < Linter |
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.
Use nested module/class definitions instead of compact style.
@@ -0,0 +1,77 @@ | |||
module SCSSLint |
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.
Missing frozen string literal comment.
end | ||
end | ||
end | ||
end |
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.
Final newline missing.
offsetparan = 0 | ||
offsetparan = offset_to(start_pos, '!default', offsetparan) | ||
if offsetparan == nil | ||
add_lint(node, 'This variable does not contain !default') |
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.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Yes the branch for v4 is |
@Johann-S I'm going to close this PR and open another PR since the scss code that I got was not from |
#20717
Edit: Should I make this PR merge into v4-dev instead of master branch because master does not contain the scss folder?