<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 13, 2016, at 1:43 PM, Jordan Rose <<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi, Michael. As one of the people who's been a strong believer of "warning flags result in style dialects", I think it's important to establish a use case here. What will people actually do with warning categories? What warnings will we allow turning off? Under what contexts?</div><div class=""><br class=""></div><div class="">For the "variable never mutated" warning, you mentioned that this doesn't make sense in a rapid experimentation environment. I'd say more specifically that it doesn't make sense in code you're actively changing. But Live Issues should be able to <i class="">know</i> what code you're actively changing, and only suppress the warning <i class="">there.</i></div><div class=""><br class=""></div><div class="">(We do have some ad hoc categorization today, including "REPL mode" as you mentioned. I'm fine with making that something more general.)</div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>I’ll look more at REPL mode and see how to better generalize that. It’s more in line with what I’m trying to accomplish, and it may not make sense to categorize all the warnings in Swift so much as call out limited sub-sets. If that’s the case, and doing so is more so the exception than the rule, then I’m more amenable to tags and/or Kate’s suggestions.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I guess I'd rather avoid eagerly classifying warnings, and I'll continue to argue against -W* and -Wno-* flags for the time being.</div><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>What about global flags, such as “-Werr” or equivalent? Do you have any thoughts about Dmitri’s point on multi-platform libraries and how they sometimes can trigger strict stylistic warnings excessively?</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Jordan</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 12, 2016, at 9:44, Michael Ilseman via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello, I'm interested in enabling finer-grained control over warning/error</div><div class="">reporting ala Clang. I've started to put in some infrastructure to</div><div class="">DiagnosticEngine, and now I'm at the point of determining categorization. </div><div class=""><br class=""></div><div class="">I'd like some input (and maybe even some bikeshedding!) on the community's</div><div class="">thoughts and preferences here. Here's my take on the issue:</div><div class=""><br class=""></div><div class="">When it comes to defining the categorization, I can see a few approaches: </div><div class=""><ol class="MailOutline"><li class=""> Categorize based on broad language-feature/compiler-area. E.g. "Availability" or “CommandLineArguments”</li><li class=""> Categorize based on the kind of warning. E.g. "Deprecated" or “Uninitialized"</li><li class=""> Categorize based on severity or specificity of warnings. E.g. "Pedantic" or "UnusedValue" or "NullDereference"</li></ol></div><div class=""><br class=""></div><div class="">And, of course, I think that preference should be given to how people would</div><div class="">actively like to use the categories to control warnings. For example, there's</div><div class="">a handful of warnings that makes less sense in a REPL or rapid experimentation</div><div class="">environment, such as variable_never_mutated.</div><div class=""><br class=""></div><div class="">Here's a straw-man proposal of some categorization. Of course, one developer's</div><div class="">annoying pedantic warning is another's life-saving code-smell detector. I am not</div><div class="">personally tied to these categorizations at all, I'm just interested in there</div><div class="">being something simple and basic. Below is a list of every warning in Swift with</div><div class="">an attempt to put it under a category.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Deprecated:</div><div class=""> var_not_allowed_in_pattern</div><div class=""> "Use of '%select{var|let}0' binding here is deprecated and will be "</div><div class=""> "removed in a future version of Swift"</div><div class=""> deprecated_c_style_for_stmt</div><div class=""> "C-style for statement is deprecated and will be removed in a future "</div><div class=""> "version of Swift"</div><div class=""> deprecated_convention_attribute</div><div class=""> "'@%0' attribute is deprecated; '@convention(%1)' should be used "</div><div class=""> "instead"</div><div class=""> availability_deprecated</div><div class=""> "%0 %select{is|%select{is|was}3}1 deprecated"</div><div class=""> "%select{| %select{on|in}3 %2%select{| %4}3}1"</div><div class=""> availability_deprecated_msg</div><div class=""> "%0 %select{is|%select{is|was}3}1 deprecated"</div><div class=""> "%select{| %select{on|in}3 %2%select{| %4}3}1: %5"</div><div class=""> availability_deprecated_rename</div><div class=""> "%0 %select{is|%select{is|was}3}1 deprecated"</div><div class=""> "%select{| %select{on|in}3 %2%select{| %4}3}1: renamed to '%5'"</div><div class=""> parameter_curry_syntax_removed</div><div class=""> "curried function declaration syntax will be removed in a future "</div><div class=""> "version of Swift; use a single parameter list"</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Unsupported:</div><div class=""> warning_parallel_execution_not_supported</div><div class=""> "parallel execution not supported; falling back to serial execution"</div><div class=""> unsupported_synthesize_init_variadic</div><div class=""> "synthesizing a variadic inherited initializer for subclass %0 is "</div><div class=""> "unsupported"</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Stylistic/Pedantic/Cleanliness:</div><div class=""> pbd_never_used_stmtcond</div><div class=""> "value %0 was defined but never used; consider replacing "</div><div class=""> "with boolean test"</div><div class=""> pbd_never_used</div><div class=""> "initialization of %select{variable|immutable value}1 %0 was never used"</div><div class=""> "; consider replacing with assignment to '_' or removing it"</div><div class=""> capture_never_used</div><div class=""> "capture %0 was never used",</div><div class=""> variable_never_used</div><div class=""> "%select{variable|immutable value}1 %0 was never used; "</div><div class=""> "consider replacing with '_' or removing it"</div><div class=""> variable_never_mutated</div><div class=""> "%select{variable|parameter}1 %0 was never mutated; "</div><div class=""> "consider changing to 'let' constant"</div><div class=""> variable_never_read</div><div class=""> "%select{variable|parameter}1 %0 was written to, but never read"</div><div class=""> expression_unused_result</div><div class=""> "result of call to %0 is unused"</div><div class=""> expression_unused_init_result</div><div class=""> "result of initializer is unused", ())</div><div class=""> expression_unused_result_message</div><div class=""> "result of call to %0 is unused: %1"</div><div class=""> expression_unused_result_nonmutating</div><div class=""> "result of call to non-mutating function %0 is unused; "</div><div class=""> "use %1 to mutate in-place"</div><div class=""> expression_unused_optional_try</div><div class=""> "result of 'try?' is unused"</div><div class=""> non_trailing_closure_before_default_args</div><div class=""> "closure parameter prior to parameters with default arguments will "</div><div class=""> "not be treated as a trailing closure"</div><div class=""> parameter_extraneous_double_up</div><div class=""> "extraneous duplicate parameter name; %0 already has an argument "</div><div class=""> "label"</div><div class=""> parameter_extraneous_empty_name</div><div class=""> "extraneous '_' in parameter: %0 has no keyword argument name"</div><div class=""> escaped_parameter_name</div><div class=""> "keyword '%0' does not need to be escaped in argument list"</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">CodeSmell/StrongStylisticHints:</div><div class=""> guard_always_succeeds</div><div class=""> "'guard' condition is always true, body is unreachable"</div><div class=""> warn_unqualified_access</div><div class=""> "use of %0 treated as a reference to %1 in %2 %3"</div><div class=""> var_pattern_didnt_bind_variables</div><div class=""> "'%0' pattern has no effect; sub-pattern didn't bind any variables"</div><div class=""> type_inferred_to_undesirable_type</div><div class=""> "%select{variable|constant}2 %0 inferred to have type %1, "</div><div class=""> "which may be unexpected"</div><div class=""> no_throw_in_try</div><div class=""> "no calls to throwing functions occur within 'try' expression"</div><div class=""> no_throw_in_do_with_catch</div><div class=""> "'catch' block is unreachable because no errors are thrown in 'do' block"</div><div class=""> required_initializer_override_keyword</div><div class=""> "'override' is implied when overriding a required initializer"</div><div class=""> if_always_true</div><div class=""> "'if' condition is always true"</div><div class=""> while_always_true</div><div class=""> "'while' condition is always true"</div><div class=""> warn_protocol_witness_optionality</div><div class=""> "%select{type|result|parameter|parameters|"</div><div class=""> "result and parameters}0 of %1 %select{has|has|has|have|have|}0"</div><div class=""> " different optionality than expected by protocol %2"</div><div class=""> optional_req_nonobjc_near_match</div><div class=""> "non-@objc %select{initializer %1|method %1|property %1|subscript}0 "</div><div class=""> "cannot satisfy optional requirement of @objc protocol %2"</div><div class=""> override_unnecessary_IUO</div><div class=""> "overriding %0 parameter of type %1 with implicitly unwrapped optional "</div><div class=""> "type %2",</div><div class=""> override_unnecessary_result_IUO</div><div class=""> "overriding %0 optional result type %1 with implicitly unwrapped "</div><div class=""> "optional type %2",</div><div class=""> inject_forced_downcast, sema_tce, none,</div><div class=""> "treating a forced downcast to %0 as optional will never produce 'nil'"</div><div class=""> recursive_accessor_reference, tce_sema, none,</div><div class=""> "attempting to %select{access|modify}1 %0 within its own "</div><div class=""> "%select{getter|setter}1",</div><div class=""> store_in_willset, tce_sema, none,</div><div class=""> "attempting to store to property %0 within its own willSet, which is "</div><div class=""> "about to be overwritten by the new value",</div><div class=""> isa_is_always_true</div><div class=""> "'%0' test is always true",</div><div class=""> conditional_downcast_coercion</div><div class=""> "conditional cast from %0 to %1 always succeeds"</div><div class=""> downcast_to_unrelated, sema_tcc, none,</div><div class=""> "cast from %0 to unrelated type %1 always fails"</div><div class=""> forced_downcast_noop</div><div class=""> "forced cast of %0 to same type has no effect"</div><div class=""> forced_downcast_coercion</div><div class=""> "forced cast from %0 to %1 always succeeds; did you mean to use 'as'?"</div><div class=""> extraneous_default_args_in_call</div><div class=""> "call to %0 has extraneous arguments that could use defaults"</div><div class=""> unreachable_code</div><div class=""> "will never be executed"</div><div class=""> unreachable_code_after_stmt</div><div class=""> "code after '%select{return|break|continue|throw}0' will never "</div><div class=""> "be executed"</div><div class=""> unreachable_case</div><div class=""> "%select{case|default}0 will never be executed"</div><div class=""> switch_on_a_constant</div><div class=""> "switch condition evaluates to a constant"</div><div class=""> integer_conversion_overflow_warn</div><div class=""> "integer overflows when converted from %0 to %1"</div><div class=""> integer_literal_overflow_warn</div><div class=""> "integer literal overflows when stored into %0"</div><div class=""> trailing_closure_excess_newlines</div><div class=""> "trailing closure is separated from call site by multiple newlines"</div><div class=""> lex_nul_character, lexing, none</div><div class=""> "nul character embedded in middle of file"</div><div class=""> unindented_code_after_return</div><div class=""> "expression following 'return' is treated as an argument of "</div><div class=""> "the 'return'"</div><div class=""> lex_editor_placeholder_in_playground</div><div class=""> "editor placeholder in source file"</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Attributes:</div><div class=""> attr_availability_unknown_platform</div><div class=""> "unknown platform '%0' for attribute '%1'"</div><div class=""> attr_warn_unused_result_expected_name</div><div class=""> "expected parameter 'message' or 'mutable_variant'"</div><div class=""> attr_warn_unused_result_duplicate_parameter</div><div class=""> "duplicate '%0' parameter; previous value will be ignored"</div><div class=""> attr_warn_unused_result_unknown_parameter</div><div class=""> "unknown parameter '%0' in 'warn_unused_result' attribute"</div><div class=""> attr_migration_id_expected_name</div><div class=""> "expected parameter 'pattern'"</div><div class=""> attr_migration_id_unknown_parameter</div><div class=""> "unknown parameter '%0' in '_migration_id' attribute"</div><div class=""> attr_migration_id_duplicate_parameter</div><div class=""> "duplicate '%0' parameter; previous value will be ignored"</div><div class=""> invalid_swift_name_method</div><div class=""> "too %select{few|many}0 parameters in swift_name attribute (expected %1; "</div><div class=""> "got %2)"</div><div class=""><br class=""></div><div class="">Availability:</div><div class=""> availability_query_useless_min_deployment</div><div class=""> "unnecessary check for '%0'; minimum deployment target ensures guard "</div><div class=""> "will always be true"</div><div class=""> availability_query_useless_enclosing_scope</div><div class=""> "unnecessary check for '%0'; enclosing scope ensures guard "</div><div class=""> "will always be true"</div><div class=""><br class=""></div><div class="">And the below I'm either struggling to think about how to categorize them</div><div class="">(perhaps no category at first), or un-familiar with what they're targeting</div><div class=""> warning_from_clang:</div><div class=""> "%0"</div><div class=""> could_not_rewrite_bridging_header, none, none,</div><div class=""> "failed to serialize bridging header; "</div><div class=""> "target may not be debuggable outside of its original project"</div><div class=""> omit_needless_words</div><div class=""> "%0 could be named %1 [-Womit-needless-words]"</div><div class=""> unused_compiler_version_component</div><div class=""> "the second version component is not used for comparison"</div><div class=""> unknown_build_config</div><div class=""> "unknown %0 for build configuration '%1'"</div><div class=""> sema_import_current_module</div><div class=""> "this file is part of module %0; ignoring import"</div><div class=""> sema_import_current_module_with_file</div><div class=""> "file '%0' is part of module %1; ignoring import"</div><div class=""> access_control_member_more</div><div class=""> "declaring %select{PRIVATE|an internal|a public}0 %1 for "</div><div class=""> "%select{a private|an internal|PUBLIC}2 %3"</div><div class=""> access_control_ext_member_more</div><div class=""> "declaring %select{PRIVATE|an internal|a public}0 %1 in "</div><div class=""> "%select{a private|an internal|PUBLIC}2 extension"</div><div class=""> emit_reference_dependencies_without_primary_file</div><div class=""> "ignoring -emit-reference-dependencies (requires -primary-file)"</div><div class=""> warning_no_such_sdk</div><div class=""> "no such SDK: '%0'"</div><div class=""> warn_cannot_stat_input</div><div class=""> "unable to determine when '%0' was last modified: %1"</div><div class=""> warning_unnecessary_repl_mode</div><div class=""> "unnecessary option '%0'; this is the default for '%1' "</div><div class=""> "with no input files"</div><div class=""> incremental_requires_output_file_map</div><div class=""> "ignoring -incremental (currently requires an output file map)"</div><div class=""> incremental_requires_build_record_entry</div><div class=""> "ignoring -incremental; output file map has no master dependencies "</div><div class=""> "entry (\"%0\" under \"\")"</div><div class=""><br class=""></div><div class="">I haven’t gotten to how to expose this to the user, and I’ll defer to the community for suggestions in that area. </div><div class=""><br class=""></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSAfvIv79DRjB1ap-2Bnk8Qt1NeGBMl8zPzGacITf8KM5uwnx0rU0Lt9khP6jmDY9hFm6YFot54zlRZ-2BhsWuG6BkyDRUy9BBFx1wPA0wlsmxcPZL9vq31UqF4GWko30gPxw59dpHIy4gmvdq7A6XOsmWIikjaP2f6jkMbwRg3HmKBpGWTSdxv1-2FMZVXmVnJ8e-2F8tU-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</div>
_______________________________________________<br class="">swift-dev mailing list<br class=""><a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-dev" class="">https://lists.swift.org/mailman/listinfo/swift-dev</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>