Skip to main content

nu_lint/rules/
mod.rs

1use crate::rule::Rule;
2
3pub mod groups;
4
5pub mod add_hat_external_commands;
6pub mod ansi_over_escape_codes;
7pub mod append_to_concat_assign;
8pub mod assign_then_return;
9pub mod catch_builtin_error_try;
10pub mod chained_append;
11pub mod chained_str_transform;
12pub mod check_complete_exit_code;
13pub mod check_typed_flag_before_use;
14pub mod collapsible_if;
15pub mod columns_in_to_has;
16pub mod columns_not_in_to_not_has;
17pub mod compound_assignment;
18pub mod contains_to_regex_op;
19pub mod custom_log_command;
20pub mod dangerous_file_operations;
21pub mod dispatch_with_subcommands;
22pub mod do_not_compare_booleans;
23pub mod documentation;
24pub mod dynamic_script_import;
25pub mod error_make;
26pub mod errors_to_stderr;
27pub mod exit_only_in_main;
28pub mod explicit_long_flags;
29pub mod external_script_as_argument;
30pub mod external_tools;
31pub mod filesystem;
32pub mod filtering;
33pub mod forbid_excessive_nesting;
34pub mod fragile_last_exit_code;
35pub mod get_optional_to_has;
36pub mod get_optional_to_not_has;
37pub mod glob_may_drop_quotes;
38pub mod hardcoded_math_constants;
39pub mod if_else_chain_to_match;
40pub mod if_null_to_default;
41pub mod ignore_over_dev_null;
42pub mod list_param_to_variadic;
43pub mod max_function_body_length;
44pub mod max_positional_params;
45pub mod merge_get_cell_path;
46pub mod merge_multiline_print;
47pub mod missing_stdin_in_shebang;
48pub mod naming;
49pub mod never_space_split;
50pub mod non_final_failure_check;
51pub mod not_is_empty_to_is_not_empty;
52pub mod nothing_outside_signature;
53pub mod parsing;
54pub mod positional_to_pipeline;
55pub mod posix_tools;
56pub mod range_for_iteration;
57pub mod record_assignments;
58pub mod redundant_ignore;
59pub mod redundant_nu_subprocess;
60pub mod remove_hat_not_builtin;
61pub mod remove_redundant_in;
62pub mod require_main_with_stdin;
63pub mod script_export_main;
64pub mod self_import;
65pub mod side_effects;
66pub mod single_call_command;
67pub mod source_to_use;
68pub mod spacing;
69pub mod spread_list_to_external;
70pub mod streaming_hidden_by_complete;
71pub mod string_may_be_bare;
72pub mod structured_data_to_csv_tool;
73pub mod structured_data_to_json_tool;
74pub mod transpose_items;
75pub mod try_instead_of_do;
76pub mod typing;
77pub mod unchecked_cell_path_index;
78pub mod unchecked_get_index;
79pub mod unescaped_interpolation;
80pub mod unnecessary_accumulate;
81pub mod unnecessary_mut;
82pub mod unsafe_dynamic_record_access;
83pub mod unused_helper_functions;
84pub mod unused_parameter;
85pub mod unused_variable;
86pub mod upstream;
87pub mod wrap_external_with_complete;
88
89/// All rules that are used by default when linting.
90pub const USED_RULES: &[&dyn Rule] = &[
91    add_hat_external_commands::RULE,
92    ansi_over_escape_codes::RULE,
93    append_to_concat_assign::RULE,
94    assign_then_return::RULE,
95    catch_builtin_error_try::RULE,
96    chained_append::RULE,
97    chained_str_transform::RULE,
98    check_complete_exit_code::RULE,
99    check_typed_flag_before_use::RULE,
100    collapsible_if::RULE,
101    columns_in_to_has::RULE,
102    columns_not_in_to_not_has::RULE,
103    compound_assignment::RULE,
104    contains_to_regex_op::RULE,
105    custom_log_command::RULE,
106    dangerous_file_operations::RULE,
107    dispatch_with_subcommands::RULE,
108    do_not_compare_booleans::RULE,
109    documentation::add_doc_comment_exported_fn::RULE,
110    documentation::descriptive_error_messages::RULE,
111    documentation::main_named_args_docs::RULE,
112    documentation::main_positional_args_docs::RULE,
113    dynamic_script_import::RULE,
114    error_make::add_help_to_error::RULE,
115    error_make::add_label_to_error::RULE,
116    error_make::add_span_to_label::RULE,
117    error_make::add_url_to_error::RULE,
118    error_make::error_make_for_non_fatal::RULE,
119    errors_to_stderr::RULE,
120    exit_only_in_main::RULE,
121    explicit_long_flags::RULE,
122    external_script_as_argument::RULE,
123    external_tools::curl_to_http::RULE,
124    external_tools::external_which_to_builtin::RULE,
125    external_tools::fd_to_glob::RULE,
126    external_tools::jq_to_nu_pipeline::RULE,
127    external_tools::wget_to_http_get::RULE,
128    filesystem::from_after_parsed_open::RULE,
129    filesystem::open_raw_from_to_open::RULE,
130    filesystem::string_param_as_path::RULE,
131    filtering::each_if_to_where::RULE,
132    filtering::for_filter_to_where::RULE,
133    filtering::omit_it_in_row_condition::RULE,
134    filtering::slice_to_drop::RULE,
135    filtering::slice_to_last::RULE,
136    filtering::slice_to_skip::RULE,
137    filtering::slice_to_take::RULE,
138    filtering::where_closure_drop_parameter::RULE,
139    forbid_excessive_nesting::RULE,
140    fragile_last_exit_code::RULE,
141    get_optional_to_has::RULE,
142    get_optional_to_not_has::RULE,
143    glob_may_drop_quotes::RULE,
144    hardcoded_math_constants::RULE,
145    if_else_chain_to_match::RULE,
146    if_null_to_default::RULE,
147    ignore_over_dev_null::RULE,
148    list_param_to_variadic::RULE,
149    max_function_body_length::RULE,
150    max_positional_params::RULE,
151    merge_get_cell_path::RULE,
152    record_assignments::USE_RECORD_SPREAD,
153    record_assignments::USE_LOAD_ENV,
154    merge_multiline_print::RULE,
155    missing_stdin_in_shebang::RULE,
156    naming::kebab_case_commands::RULE,
157    naming::screaming_snake_constants::RULE,
158    naming::snake_case_variables::RULE,
159    never_space_split::RULE,
160    non_final_failure_check::RULE,
161    not_is_empty_to_is_not_empty::RULE,
162    nothing_outside_signature::RULE,
163    parsing::lines_each_to_parse::RULE,
164    parsing::lines_instead_of_split::RULE,
165    parsing::simplify_regex_parse::RULE,
166    parsing::split_first_to_parse::RULE,
167    parsing::split_row_get_inline::RULE,
168    parsing::split_row_get_multistatement::RULE,
169    parsing::split_row_space_to_split_words::RULE,
170    positional_to_pipeline::RULE,
171    posix_tools::awk_to_pipeline::RULE,
172    posix_tools::bat_to_open::RULE,
173    posix_tools::cat_to_open::RULE,
174    posix_tools::date_to_date_now::RULE,
175    posix_tools::df_to_sys_disks::RULE,
176    posix_tools::external_cd_to_builtin::RULE,
177    posix_tools::external_ls_to_builtin::RULE,
178    posix_tools::external_sort_to_builtin::RULE,
179    posix_tools::external_uniq_to_builtin::RULE,
180    posix_tools::find_to_glob::RULE,
181    posix_tools::free_to_sys_mem::RULE,
182    posix_tools::grep_to_find_or_where::RULE,
183    posix_tools::head_to_first::RULE,
184    posix_tools::hostname_to_sys_host::RULE,
185    posix_tools::pager_to_explore::RULE,
186    posix_tools::read_to_input::RULE,
187    posix_tools::redundant_echo::RULE,
188    posix_tools::sed_to_str_transform::RULE,
189    posix_tools::tac_to_reverse::RULE,
190    posix_tools::tail_to_last::RULE,
191    posix_tools::uname_to_sys_host::RULE,
192    posix_tools::uptime_to_sys_host::RULE,
193    posix_tools::users_to_sys_users::RULE,
194    posix_tools::w_to_sys_users::RULE,
195    posix_tools::wc_to_length::RULE,
196    posix_tools::who_to_sys_users::RULE,
197    range_for_iteration::loop_counter::RULE,
198    range_for_iteration::while_counter::RULE,
199    redundant_ignore::RULE,
200    redundant_nu_subprocess::RULE,
201    remove_hat_not_builtin::RULE,
202    remove_redundant_in::RULE,
203    require_main_with_stdin::RULE,
204    script_export_main::RULE,
205    self_import::RULE,
206    side_effects::dont_mix_different_effects::RULE,
207    side_effects::each_nothing_to_for_loop::RULE,
208    side_effects::print_and_return_data::RULE,
209    side_effects::silence_stderr_data::RULE,
210    single_call_command::RULE,
211    source_to_use::RULE,
212    spacing::block_brace_spacing::RULE,
213    spacing::closure_brace_pipe_spacing::RULE,
214    spacing::closure_pipe_body_spacing::RULE,
215    spacing::no_trailing_spaces::RULE,
216    spacing::omit_list_commas::RULE,
217    spacing::pipe_spacing::RULE,
218    spacing::record_brace_spacing::RULE,
219    spacing::reflow_wide_lists::RULE,
220    spacing::reflow_wide_pipelines::RULE,
221    spacing::wrap_wide_records::RULE,
222    spread_list_to_external::RULE,
223    streaming_hidden_by_complete::RULE,
224    string_may_be_bare::RULE,
225    structured_data_to_csv_tool::RULE,
226    structured_data_to_json_tool::RULE,
227    transpose_items::RULE,
228    try_instead_of_do::RULE,
229    typing::add_type_hints_arguments::RULE,
230    typing::missing_in_type::RULE,
231    typing::missing_output_type::RULE,
232    unchecked_cell_path_index::RULE,
233    unchecked_get_index::RULE,
234    unescaped_interpolation::RULE,
235    unnecessary_accumulate::RULE,
236    unnecessary_mut::RULE,
237    unsafe_dynamic_record_access::RULE,
238    unused_helper_functions::RULE,
239    unused_parameter::RULE,
240    unused_variable::RULE,
241    upstream::nu_deprecated::RULE,
242    upstream::nu_parse_error::RULE,
243    wrap_external_with_complete::RULE,
244];