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

ignore functions with more than one element ... #3792

Merged
merged 15 commits into from
Sep 12, 2022

Conversation

fmms
Copy link
Contributor

@fmms fmms commented Aug 26, 2022

Brief summary of the change made

fixes #3583

Are there any other side effects of this change that we should be aware of?

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with tox -e generate-fixture-yml).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

@codecov
Copy link

codecov bot commented Aug 28, 2022

Codecov Report

Merging #3792 (6bab1b7) into main (1ed4d84) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #3792   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          179       179           
  Lines        13727     13729    +2     
=========================================
+ Hits         13727     13729    +2     
Impacted Files Coverage Δ
src/sqlfluff/rules/L010.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@fmms fmms marked this pull request as ready for review August 28, 2022 15:59
Comment on lines 81 to 83
# If the parent element is a function_name and there is more than one element
# below it, we ignore it because it is most likely a user defined function.
# SUM() should be modified. However, dbo.myScalar() must not be modified.
Copy link
Member

Choose a reason for hiding this comment

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

I found this difficult to follow. Would it be easier to just say something like this:

Suggested change
# If the parent element is a function_name and there is more than one element
# below it, we ignore it because it is most likely a user defined function.
# SUM() should be modified. However, dbo.myScalar() must not be modified.
# Used by L030 (that inherits from this rule)
# If it's a qualified function_name (i.e with more than one part to
# function_name). Then it is likely an existing user defined function (UDF)
# which are case sensitive so ignore for this.

I wonder should there be a include_qualified_functions option in this (defaulted to false)?

Also, I think in some SQL dialects there might be a SYS schema or such like that contains the system functions, which are case insensitive? Then again not sure if there's a good reason to use that, so maybe fine to ignore that edge case.

test/fixtures/rules/std_rule_cases/L030.yml Outdated Show resolved Hide resolved
test/fixtures/rules/std_rule_cases/L030.yml Outdated Show resolved Hide resolved
fmms and others added 4 commits September 1, 2022 00:06
Co-authored-by: Barry Pollard <barrypollard@google.com>
Co-authored-by: Barry Pollard <barrypollard@google.com>
Co-authored-by: Barry Pollard <barrypollard@google.com>
@barrywhart
Copy link
Member

@tunetheweb: Could you take another look at this since you'd requested changes on it?

@barrywhart barrywhart merged commit afec099 into sqlfluff:main Sep 12, 2022
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.

L030: built-in tsql functions should be capitalized by L030 while protecting user defined functions
3 participants