<div dir="ltr">This would also be very restrictive on a lot of common & not-unreasonable patterns. A 5-way switch-case with a guard statement in each case has a complexity of 10, but few people would find it unreadable. Implementing the HTML5 spec, even if you break each state up into its own function, often requires case statements with 20-30 branches, and the adoption agency algorithm itself has cyclomatic complexity > 10. An autogenerated lexer can have hundreds of branches within a function, but since it is generated by code and the programmer just looks at a bunch of regexps, nobody cares.<div><br></div><div>I would love to see some of the compiler information (token stream, parse tree, type analysis, and CFG) exposed as libraries, though, for linters and other semantic analysis tools to use.<br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 31, 2016 at 11:40 AM, Developer via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>I agree. It would be awesome to have a code linter that takes this into account though, but I don't see it as a full-fledged sema phase.<br><br>~Robert Widmann</div><div><br>2016/01/31 12:34、David Turnbull via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> のメッセージ:<br><br></div><div><div class="h5"><blockquote type="cite"><div><div dir="ltr"><div>The language doesn't have to evolve to make this part of the code analyzer. I don't need cyclomatic complexity analysis in the language or the regular build process. Better to compile faster.</div><div><br></div><div>-david</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 31, 2016 at 8:45 AM, Amir Michail via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think that this one metric built into the language would have a huge impact on Swift development and for the better.<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></div></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div></div>