Skip to content
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 QuotingChecker #35

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

flavono123
Copy link

@flavono123 flavono123 commented Aug 15, 2018

YamlLint::Linter::QuotingChecker

  • Checks the quoted string using proper quotes for escape charaters.
  • Enforce the single qouted style for strings without escape characters.

Refactor

  • Define the abstract class YamlLint::Linter::RecursiveChecker, check at each value in Psych parsed yaml tree recursivley.
  • YamlLint::Linter::KeyOverlapDetector inherit from it.
  • Both overlapping keys and quoting conventions are checked, stack each error messages

Signed-off-by: Hansuk Hong flavono123@gmail.com

- Define the abstract class YamlLint::Linter::RecursiveChecker,
check at each value in Psych parsed yaml tree recursivley.
- YamlLint::Linter::KeyOverlapDetector inherit from it.

Signed-off-by: Hansuk Hong <flavono123@gmail.com>
@flavono123 flavono123 force-pushed the feature/lint-quoting-checker branch 2 times, most recently from 3f71855 to 3fa4fa0 Compare August 17, 2018 11:31
- Checks the quoted string using proper quotes for escape charaters.
- Enforce the single quoted style for strings without escape characters.

Signed-off-by: Hansuk Hong <flavono123@gmail.com>
- Remove the short circuit evaluation between checking overlapping
  keys and quoting.

Signed-off-by: Hansuk Hong <flavono123@gmail.com>
@shortdudey123
Copy link
Owner

Thanks for the feature!
After #39 and #36 are merged, I will have you rebase on master to verify the tests pass. Also, can you add a line to the CHANGELOG in the unreleased section following the existing format?

@@ -96,7 +96,10 @@ def check_filename(filename)
def check_data(yaml_data, errors_array)
valid = check_not_empty?(yaml_data, errors_array)
valid &&= check_syntax_valid?(yaml_data, errors_array)
valid &&= check_overlapping_keys?(yaml_data, errors_array)
valid &&= [
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just add a new line with the new method call and not put an array here?

end
end

def include_esacpe_characters?(node)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the spelling of escape?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants