* Calculate Tempalte info with Line using class
* _LineSummary for the win
* _Memory joins the team
* L003 preformance improvements
* Correct Comment Errors
* Coverage fixes
* linting errors
* memo is_empty
* Fix coverage
* linting Issue
* Seperate out more sub elements
* Hanging into method
* Running Again
* further clean up
* spelling Errors
* Comments spelling and fStrings
* Linting Bugs
* Fixed now incorrect tests
* remove unneeded test
* remove useless lcass method
* Compact rules
* be explicit
* Fix cli output test
* Fix typos
* denest functions and gitignore
* DAte no longer capital
* Introduce dbt 1.0.0 and update old references.
* Fix profiles dir import issues
* Fix a couple more errors
* Choose dbt_utils version based on the dbt version, change how we check if a model is disabled (#2087)
* Choose dbt_utils version based on the dbt version
* Skip the script if dbt templater is not installed
* In dbt 1.0, need to look up disabled models a different way
* Add fixture for changed whitespace in dbt_utils 0.8.0
* Database connection failures raise an exception in dbt 1.0.0
* Lint
* Some tweaks suggested in the PR review (#2088)
* Some tweaks suggested in the PR review
* Empty commit
Co-authored-by: Niall Woodward <niall@niallrees.com>
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
* Issue 1437: Robust Jinja raw/templated slice mapping
* Parametrize the test
* Add a basic (no whitespace control) test case
* Now correctly handling block_start whitespace stripping
* Add test case
* Enhance test case
* Handle variables with whitespace stripping, add a test for it
* Tidying, update test case
* Handle comments
* Add test for issue 1608
* Fix some things that were causing lint messages
* The test for this issue needs to run "fix"
* Add missing file, update .gitignore
* "no cover"
* Trigger build
* PR review, "no cover"
* Add two more test cases, basic_data and strip_right_data
* PR review
* More comments on the algorithm
* More comments
* Handle right whitespace stripping similarly as left
* Test updates
* Remove test case changes that were added in this PR and stopped working when I added handling for right whitespace stripping
* Add "pragma no cover"
* Change how I'm doing "pragma: no cover" to be simpler/safer
Co-authored-by: Barry Hart <barry.hart@mailchimp.com>
Co-authored-by: Barry Pollard <barry@tunetheweb.com>
* Add editorconfig, giattributes and convert some files
* Convert more files
* Update .gitatttributes
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
Co-authored-by: Barry Hart <barrywhart@yahoo.com>
* Add newline to compiled_sql string
* Prevent unwanted deletion of trailing newline in source SQL when using dbt compiler
* Revert .gitignore to include conda env
* Update CHANGELOG
* Update CHANGELOG
* remove conda env, causes confusion
* remove agate requirement, let owners decide
* Update CHANGELOG
* Run black
* Add newline to .gitignore - next level irony
* Cleanup WET code
* Run black
* Use list comprehension
* Save progress
* Simplified approach to handle trailing newlines
* Run black
* add back in exclude_rules
* Remove appended newline in dbt_test. Handled by templaters/dbt.py directly
* Fix test__templater_dbt_templating_test_lex to reflect improved trailing newline handling
* Ignore flake8 D418 errors
* Remove unneeded #noqa after merging in linting fixes from upstream
* Update dbt tests
* Trt removign whitespace from test assert string
* Remove commented code used for debugging
* Update comments for clarity
* Update docs
* Run black
* Fix CHANGELOG typo
* Update .gitignore to account for direnv config
* Fix comment typo in templaters/dbt.py
* Remove unneeded comment
* Simplify tests using fixtures
* Run black
* #noqa fixes
* Fix fixture list
* Simplify docstring
Co-authored-by: NiallRees <niall@niallrees.com>
* 🙈 Ignore coverage report
* 🤝 Implement common sense coverage exclusions
1. Don't need to test `sqlfluff/__main__ since it's tested by subprocess.check_output rather than imported directly
2. Ignore version checks for now, since we're not implementing any different behaviors by version. I could also exclude these lines in particular with a `pragma: no cover` if you prefer.
* ♻️ Simplify trailing whitespace fixes
This was interesting -- the `else:` was never being hit in the tests, which didn't originally make sense to me 🤔 because that should break the `while True:` condition. It must be getting broken by something else? Either way, this makes it more readable and ensures coverage
* 💀 Remove dead code from Rule_L002._eval
I tried to create test cases to hit this code, but couldn't figure it out. It seems like checking at the beginning and checking at newlines covers all use cases for this rule.
* 💪 Improve coverage for Rule_L003._make_indent
There didn't seem to be any test cases for indent_unit = tabs, so +1 for
that. Also got rid of the error handling, which is now taken care of at
the config level
* 💀 Remove dead code from Rule_L003._coerce_indent_to
🤔 Seems like the intention of this was to remove any hanging
indents, when an incorrect indent is found on a segement. Try as I may
I couldn't hit this line, so I'm guessing we don't need it
🤷♂️
* 💀 Remove dead code from Rule_L003._eval
1. `else: pass` isn't necessary
2. No need to check if a comment wasn't found, because previous if logic
already ensures that a comment was found
* ✅ Add L008 test case comma w/o whitespace
* 🐛 Allow capitalised keywords
This was actually a bug that we squashed early, since I discovered that
it wasn't being hit by tests, and then my test case failed.
Hooray for coverage! 🎉
Also get rid of config checking, which is handled separately
* 🔥 Remove uneeded check from Rule_L011
If there wasn't whitespace or a new line before an alias, then it
wouldn't register as an alias in SQL.
Unless you can think of a test case, then I think this is safe to remove
* ✅ Test allow_scalar cases for Rule_L013
* 💀 Remove dead code from Rule_L016._eval_line_for_break.Section
There was some other untested code in here, but I thought it better to
leave it in, since it's specifically meant to catch cases we can't
imagine
* 💀 Remove dead code from Rule_L017._eval
* 💀 Remove dead code from Rule_L003._eval_line_for_breaks
I made sure that getting a double comma was impossible, don't think we
need to keep this check in here
* 💀 Remove dead code from Rule_L018._eval
* ✅ Add test cases for Rule_L018
* 💀 Remove dead code from Rule_L019._last_code_seg
There is no need for this check, since we'll always check that
len(raw_stack) > 1 in self._eval
* ✅ Add test for Rule_L020.__lint_references_and_aliases
* ✅ Add test cases for Rule_L021._eval
* ✅ Add test cases for Rule_L022._eval
* 📛 Rename var for easier debugging
In pdb, `r` shows the current stack, and so it made it hard to inspect
this value in debugging
* 🐛 Fix wildcard reference name
Score another for discovering unlinted lines 🎉
* ↩️ Revert f6d97ed, add test case instead"
* 🤦♂️ Add back in removed test