Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/sqlfluff/sqlfluff
/ functions
Functions
2,340 in github.com/sqlfluff/sqlfluff
⨍
Functions
2,340
◇
Types & classes
2,379
↳
Endpoints
59
↓ 3 callers
Method
slice_file
Slice the file to determine regions where we can fix. Args: raw_str (str): The raw string to be sliced. render_func (
src/sqlfluff/core/templaters/jinja.py:813
↓ 3 callers
Method
slice_info_for_literal
Returns a RawSliceInfo for a literal. In the alternate template, literals are replaced with a uniquely numbered, easy-to-parse litera
src/sqlfluff/core/templaters/slicers/tracer.py:431
↓ 3 callers
Function
slice_overlaps
Check whether two slices overlap. NOTE: This is designed only for use with *closed* and *positive* slices.
src/sqlfluff/core/helpers/slice.py:32
↓ 3 callers
Method
source_slice
Return a slice object for this slice.
src/sqlfluff/core/templaters/base.py:96
↓ 3 callers
Function
sum_dicts
Take the keys of two dictionaries and add their values.
src/sqlfluff/core/linter/linting_result.py:17
↓ 3 callers
Method
to_dict
Return a dict of properties. This is useful in the API for outputting violations.
src/sqlfluff/core/errors.py:111
↓ 3 callers
Method
to_segment
Create a segment from this lexed element.
src/sqlfluff/core/parser/lexer.py:108
↓ 3 callers
Method
update_progress
Update the progress bar if configured. If progress isn't configured, we do nothing. If `track_progress` is false we do nothing.
src/sqlfluff/core/parser/context.py:319
↓ 3 callers
Method
validate_segment_with_reparse
Checks correctness of new segment by re-parsing it.
src/sqlfluff/core/parser/segments/base.py:1250
↓ 3 callers
Method
warning_if_in
Warning only for this violation if it matches the iterable. Designed for rule codes so works with L001, LL0X but also TMP or PRS for
src/sqlfluff/core/errors.py:142
↓ 3 callers
Method
working_loc_after
Location tuple for the working position.
src/sqlfluff/core/parser/markers.py:77
↓ 3 callers
Function
wrap_elem
Wrap a string into a list of strings all less than <width>.
src/sqlfluff/cli/helpers.py:30
↓ 3 callers
Function
write_text
Write UTF-8 text content with a trailing newline.
docsv/scripts/assemble-site.py:65
↓ 2 callers
Method
__init__
( self, description: Optional[str] = None, pos: Optional["PositionMarker"] = None,
src/sqlfluff/core/errors.py:50
↓ 2 callers
Method
__init__
( self, linter: Linter, config: FluffConfig, )
src/sqlfluff/core/linter/runner.py:38
↓ 2 callers
Method
__resolve_selectable
Resolve the number of columns in a single Selectable. The selectable may or may not have wildcard (*) expressions. If it does, we att
src/sqlfluff/rules/ambiguous/AM07.py:139
↓ 2 callers
Method
_add_regex
Add regex pattern to table (deduplicated). Returns regex_id.
utils/build_parsers.py:153
↓ 2 callers
Method
_adjust_anchors_for_fixes
Makes simple fixes to the anchor position for fixes. Some rules return fixes where the anchor is too low in the tree. These are most
src/sqlfluff/core/rules/base.py:750
↓ 2 callers
Method
_analyze_result_columns
Given info on a list of SELECTs, determine whether to warn.
src/sqlfluff/rules/ambiguous/AM04.py:90
↓ 2 callers
Method
_apply_dbt_builtins
Check if dbt builtins should be applied from the provided config object. This method searches for a config section specified by the t
src/sqlfluff/core/templaters/jinja.py:519
↓ 2 callers
Method
_build_up_fixed_source_string
Use patches and raw file to fix the source file. This assumes that patches and slices have already been coordinated. If they haven't
src/sqlfluff/core/linter/linted_file.py:351
↓ 2 callers
Method
_class_types
(segments: Sequence[RawSegment])
src/sqlfluff/utils/reflow/elements.py:66
↓ 2 callers
Function
_clean_path
Clear out files matching the provided glob expression.
plugins/sqlfluff-templater-dbt/test/templater_test.py:463
↓ 2 callers
Method
_coalesce_fix_list
Generate list of fixes to convert CASE statement to COALESCE function.
src/sqlfluff/rules/structure/ST02.py:104
↓ 2 callers
Function
_collapse_table_cell
Collapse multiline rst list-table cell content to a single markdown cell.
docsv/scripts/generate-rules-docs.py:400
↓ 2 callers
Method
_column_only_fix_list
Generate list of fixes to reduce CASE statement to a single column.
src/sqlfluff/rules/structure/ST02.py:144
↓ 2 callers
Function
_construct_alignment_whitespace
Construct alignment whitespace using tabs or spaces. Args: width: Number of whitespace characters needed. indent_unit: Either 'ta
src/sqlfluff/utils/reflow/respace.py:32
↓ 2 callers
Function
_crawl_indent_points
Crawl through a reflow sequence, mapping existing indents. This is where *most* of the logic for smart indentation happens. The values return
src/sqlfluff/utils/reflow/reindent.py:831
↓ 2 callers
Function
_create_col_reference
(table_ref: str, column_name: str)
src/sqlfluff/rules/structure/ST07.py:217
↓ 2 callers
Method
_create_semicolon_and_delete_whitespace
( self, target_segment: BaseSegment, parent_segment: BaseSegment, anchor_segme
src/sqlfluff/rules/convention/CV06.py:306
↓ 2 callers
Method
_elements_from_raw_segments
Construct reflow elements from raw segments. NOTE: ReflowBlock elements should only ever have one segment which simplifies iteration
src/sqlfluff/utils/reflow/sequence.py:131
↓ 2 callers
Method
_eval_multiple_select_target_elements
Multiple select targets. Ensure each is on a separate line.
src/sqlfluff/rules/layout/LT09.py:175
↓ 2 callers
Method
_expand_rule_refs
Expand a list of rule references into a list of rule codes. Returns: :obj:`set` of :obj:`str` rule codes.
src/sqlfluff/core/rules/base.py:1007
↓ 2 callers
Method
_extract_macros
Load macros directly in a config and from load_macros_from_path. Args: config: The config to extract macros from. env
src/sqlfluff/core/templaters/jinja.py:261
↓ 2 callers
Method
_extract_macros_from_template
Take a template string and extract any macros from it. Lovingly inspired by http://codyaray.com/2015/05/auto-load-jinja2-macros Rais
src/sqlfluff/core/templaters/jinja.py:128
↓ 2 callers
Function
_extract_position
If a segment is present and is a literal, return it's source length.
src/sqlfluff/core/errors.py:30
↓ 2 callers
Method
_extract_references_from_expression
(self, segment: BaseSegment)
src/sqlfluff/rules/structure/ST11.py:89
↓ 2 callers
Method
_filter_occurrences
Filter a dict of occurrences to just those within a slice.
src/sqlfluff/core/templaters/python.py:677
↓ 2 callers
Method
_find_element_idx_with
Helper method to find an element within a segment. Note: This method is currently excluded from test coverage because it is not
src/sqlfluff/utils/reflow/sequence.py:293
↓ 2 callers
Method
_get_elem
Get the actual object we're referencing.
src/sqlfluff/core/parser/grammar/base.py:372
↓ 2 callers
Function
_get_filtered_parse_violations
Return parse and templating violations after applying ignore settings.
src/sqlfluff/cli/commands.py:107
↓ 2 callers
Method
_get_from_expression_element_alias
(from_expr_element: BaseSegment)
src/sqlfluff/rules/convention/CV12.py:261
↓ 2 callers
Method
_get_indentation
Calculate the indentation level for rebuilding nested struct. This is only a best attempt as the input may not be equally indented. The layou
src/sqlfluff/rules/structure/ST04.py:161
↓ 2 callers
Method
_get_last_statement
Get the last statement from a file segment.
src/sqlfluff/rules/convention/CV06.py:67
↓ 2 callers
Function
_get_point_pos_at_idx
( segments: Sequence["BaseSegment"], idx: int )
src/sqlfluff/core/parser/match_result.py:19
↓ 2 callers
Function
_get_sqlfluff_version
Get the SQLFluff package version from importlib. NOTE: At the stage of loading plugins, SQLFluff isn't fully initialised and so we can't use
src/sqlfluff/core/plugin/host.py:33
↓ 2 callers
Function
_get_user_config_dir_path
Get the user config dir for this system. Args: sys_platform (str): The result of ``sys.platform()``. Provided as an argument
src/sqlfluff/core/config/loader.py:51
↓ 2 callers
Method
_handle_comma_separated_values
(self)
src/sqlfluff/core/config/fluffconfig.py:142
↓ 2 callers
Method
_handle_lint_path_exception
(fname: Optional[str], e: BaseException)
src/sqlfluff/core/linter/runner.py:100
↓ 2 callers
Method
_handle_preceding_inline_comments
Adjust segments to not move preceding inline comments. We don't want to move inline comments that are on the same line as the precedi
src/sqlfluff/rules/convention/CV06.py:94
↓ 2 callers
Function
_handle_unparsable
Handles the treatment of files with templating and parsing issues. By default, any files with templating or parsing errors shouldn't have fix
src/sqlfluff/cli/commands.py:1025
↓ 2 callers
Function
_handle_zero_length_slice
Generate placeholders and loop segments from a zero length slice. This method checks for: 1. Backward jumps (inserting :obj:`TemplateLoop`).
src/sqlfluff/core/parser/lexer.py:351
↓ 2 callers
Method
_init_global
Initializes any global state. May be overridden by subclasses to apply global configuration, initialize logger state in child process
src/sqlfluff/core/linter/runner.py:91
↓ 2 callers
Method
_initialise_dialect
( self, dialect: Optional[str], require_dialect: bool = True )
src/sqlfluff/core/config/fluffconfig.py:156
↓ 2 callers
Method
_is_one_line_statement
Check if the statement containing the provided segment is one line.
src/sqlfluff/rules/convention/CV06.py:150
↓ 2 callers
Method
_is_simple_function
Return whether a function segment is considered simple.
src/sqlfluff/rules/structure/ST06.py:99
↓ 2 callers
Method
_is_trim_tag
Return whether a raw slice is a Jinja tag with whitespace trimming.
src/sqlfluff/core/templaters/jinja.py:105
↓ 2 callers
Method
_iter_available_targets
Iterate along a list of valid alias targets.
src/sqlfluff/rules/references/RF03.py:103
↓ 2 callers
Method
_iter_reference_parts
Extract the elements of a reference and yield.
src/sqlfluff/dialects/dialect_ansi.py:1099
↓ 2 callers
Function
_load_plugin
Loads a single plugin with a bit of error handling.
src/sqlfluff/core/plugin/host.py:56
↓ 2 callers
Function
_load_user_appdir_config
Load the config from the user's OS specific appdir config directory.
src/sqlfluff/core/config/loader.py:250
↓ 2 callers
Function
_match_file_extension
Match file path against extensions. Assumes that valid_extensions is already all lowercase. Returns: True if the file has an extensi
src/sqlfluff/core/linter/discovery.py:127
↓ 2 callers
Method
_missing_space_after_from
(segment: BaseSegment)
src/sqlfluff/rules/structure/ST05.py:495
↓ 2 callers
Method
_normalise_newlines
Normalise newlines to unix-style line endings.
src/sqlfluff/core/linter/linter.py:165
↓ 2 callers
Function
_normalize_table_row
Pad a table row to the expected number of columns.
docsv/scripts/generate-rules-docs.py:411
↓ 2 callers
Function
_parse_and_crawl_outer
Helper function for select crawlers. Given a SQL statement this crawls the SQL and instantiates a Query on the outer relevant segment.
test/utils/analysis/query_test.py:9
↓ 2 callers
Function
_paths_fix
Handle fixing from paths.
src/sqlfluff/cli/commands.py:1143
↓ 2 callers
Method
_preface
Returns the preamble to any logging.
src/sqlfluff/core/parser/segments/base.py:724
↓ 2 callers
Method
_process_lint_result
( self, res: LintResult, templated_file: Optional[TemplatedFile], ignore_mask:
src/sqlfluff/core/rules/base.py:618
↓ 2 callers
Method
_raw_slices_from_templated_slices
( templated_file: TemplatedFile, templated_slices: list[slice], file_end_slice: Option
src/sqlfluff/core/rules/fix.py:392
↓ 2 callers
Method
_rebuild_spacing
( self, indent_str: str, nested_clauses: Segments )
src/sqlfluff/rules/structure/ST04.py:216
↓ 2 callers
Method
_register_segment_class_types
Record _class_types for a grammar entry's Python segment class. Populates ``segment_class_types_sparse`` and ``segment_class_types_data``
utils/build_parsers.py:135
↓ 2 callers
Function
_run_templater_and_verify_result
( dbt_templater, project_dir, fname, dbt_fluff_config, dbt_project_folder, )
plugins/sqlfluff-templater-dbt/test/templater_test.py:131
↓ 2 callers
Method
_safe_create_replace_file
( input_path: str, output_path: str, write_buff: str, encoding: str )
src/sqlfluff/core/linter/linted_file.py:419
↓ 2 callers
Method
_seek_newline
Seek in a direction, looking for newlines. Args: segments: A sequence of segments to seek within. idx: The index of t
src/sqlfluff/rules/layout/LT03.py:68
↓ 2 callers
Function
_segmentify
Apply casing and convert strings to Keywords.
src/sqlfluff/rules/structure/ST05.py:606
↓ 2 callers
Function
_setup_config
Helper function to set up config consistently for pass & fail functions.
src/sqlfluff/utils/testing/rules.py:104
↓ 2 callers
Method
_slice_source_file_using_patches
Use patches to safely slice up the file before fixing. This uses source only slices to avoid overwriting sections of templated code i
src/sqlfluff/core/linter/linted_file.py:271
↓ 2 callers
Method
_slice_template
Slice a templated python string into token tuples. This uses Formatter() as per: https://docs.python.org/3/library/string.html#string
src/sqlfluff/core/templaters/python.py:528
↓ 2 callers
Method
_split_invariants
Split a sliced file on its invariant literals. We prioritise the _longest_ invariants first as they are more likely to be the anchors
src/sqlfluff/core/templaters/python.py:575
↓ 2 callers
Method
_split_uniques_coalesce_rest
Within each of the compound sections split on unique literals. For everything else we coalesce to the dominant type. Returns:
src/sqlfluff/core/templaters/python.py:714
↓ 2 callers
Function
_stdin_fix
Handle fixing from stdin.
src/sqlfluff/cli/commands.py:1094
↓ 2 callers
Method
_trim_end
Trim the ends of a intermediate segment.
src/sqlfluff/core/templaters/python.py:32
↓ 2 callers
Method
_trim_match
Given a string, trim if we are allowed to. Returns: :obj:`tuple` of LexedElement
src/sqlfluff/core/parser/lexer.py:182
↓ 2 callers
Function
_update_crawl_balances
Update the tracking of untaken indents and balances. This is an internal helper function for `_crawl_indent_points`.
src/sqlfluff/utils/reflow/reindent.py:813
↓ 2 callers
Method
_validate_config_options
Ensure that all config options are valid. Config options can also be checked for a specific rule e.g CP01.
src/sqlfluff/core/rules/base.py:929
↓ 2 callers
Function
_validate_layout_config
Validate the layout config section of the config. We check for valid key values and for the depth of the structure. NOTE: For now we don
src/sqlfluff/core/config/validate.py:22
↓ 2 callers
Method
_warn_unfixable
(code: str)
src/sqlfluff/core/linter/linter.py:388
↓ 2 callers
Method
add
Add a new `LintedDir` to this result.
src/sqlfluff/core/linter/linting_result.py:47
↓ 2 callers
Function
apply_fixes
Apply a dictionary of fixes to this segment. Used in to apply fixes found in linting. If a segment remains unchanged then the original is ret
src/sqlfluff/core/linter/fix.py:107
↓ 2 callers
Method
as_dict
Dict representation for logging/testing.
src/sqlfluff/utils/analysis/query.py:197
↓ 2 callers
Method
as_records
Return the result as a list of dictionaries. Each record contains a key specifying the filepath, and a list of violations. This metho
src/sqlfluff/core/linter/linting_result.py:180
↓ 2 callers
Function
assert_matches
Assert that a matcher does or doesn't work on a string. The optional `matchstring` argument, which can optionally be None, allows to either t
test/core/parser/lexer_test.py:32
↓ 2 callers
Function
assert_rule_raises_violations_in_file
Assert that a given rule raises given errors in specific positions of a file. Args: rule (str): The rule we're looking for. fpath
src/sqlfluff/utils/testing/rules.py:230
↓ 2 callers
Method
closing_balance
The closing indent balance of the line.
src/sqlfluff/utils/reflow/reindent.py:208
↓ 2 callers
Method
coalesce
Coalesce this whole slice into a single one. Brutally.
src/sqlfluff/core/templaters/python.py:143
↓ 2 callers
Function
combine_dicts
Take any set of dictionaries and combine them.
src/sqlfluff/core/linter/linting_result.py:26
↓ 2 callers
Method
common_with
Get the common depth and hashes with the other.
src/sqlfluff/utils/reflow/depthmap.py:82
↓ 2 callers
Function
compute_parse_tree_hash
Given a parse tree, compute a consistent hash value for it.
test/conftest.py:150
↓ 2 callers
Method
copy_depth_info
Copy the depth info for one segment and apply to another. This mutates the existing depth map. That's ok because it's an idempotent o
src/sqlfluff/utils/reflow/depthmap.py:169
← previous
next →
401–500 of 2,340, ranked by callers