| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
| 8 import 'package:linter/src/linter.dart'; | 8 import 'package:linter/src/linter.dart'; |
| 9 import 'package:linter/src/rules.dart'; | 9 import 'package:linter/src/rules.dart'; |
| 10 import 'package:markdown/markdown.dart'; | 10 import 'package:markdown/markdown.dart'; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 These rules are under active development. Feedback is | 48 These rules are under active development. Feedback is |
| 49 [welcome](https://github.com/dart-lang/linter/issues)! | 49 [welcome](https://github.com/dart-lang/linter/issues)! |
| 50 '''; | 50 '''; |
| 51 | 51 |
| 52 const ruleLeadMatter = 'Rules are organized into familiar rule groups.'; | 52 const ruleLeadMatter = 'Rules are organized into familiar rule groups.'; |
| 53 | 53 |
| 54 /// Sorted list of contributed lint rules. | 54 /// Sorted list of contributed lint rules. |
| 55 final List<LintRule> rules = | 55 final List<LintRule> rules = |
| 56 new List<LintRule>.from(ruleRegistry, growable: false)..sort(); | 56 new List<LintRule>.from(ruleRegistry, growable: false)..sort(); |
| 57 | 57 |
| 58 String get enumeratePubRules => rules | 58 String get enumerateErrorRules => rules |
| 59 .where((r) => r.group == Group.pub) | 59 .where((r) => r.group == Group.errors) |
| 60 .map((r) => '${toDescription(r)}') | 60 .map((r) => '${toDescription(r)}') |
| 61 .join('\n\n'); | 61 .join('\n\n'); |
| 62 | 62 |
| 63 String get enumerateGroups => Group.builtin | 63 String get enumerateGroups => Group.builtin |
| 64 .map((Group g) => | 64 .map((Group g) => |
| 65 '<li><strong>${g.name}</strong> - ${markdownToHtml(g.description)}</li>'
) | 65 '<li><strong>${g.name}</strong> - ${markdownToHtml(g.description)}</li>'
) |
| 66 .join('\n'); | 66 .join('\n'); |
| 67 | 67 |
| 68 String get enumeratePubRules => rules |
| 69 .where((r) => r.group == Group.pub) |
| 70 .map((r) => '${toDescription(r)}') |
| 71 .join('\n\n'); |
| 72 |
| 68 String get enumerateStyleRules => rules | 73 String get enumerateStyleRules => rules |
| 69 .where((r) => r.group == Group.style) | 74 .where((r) => r.group == Group.style) |
| 70 .map((r) => '${toDescription(r)}') | 75 .map((r) => '${toDescription(r)}') |
| 71 .join('\n\n'); | 76 .join('\n\n'); |
| 72 | 77 |
| 73 void printUsage(ArgParser parser, [String error]) { | 78 void printUsage(ArgParser parser, [String error]) { |
| 74 var message = 'Generates lint docs.'; | 79 var message = 'Generates lint docs.'; |
| 75 if (error != null) { | 80 if (error != null) { |
| 76 message = error; | 81 message = error; |
| 77 } | 82 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 </p> | 210 </p> |
| 206 <ul> | 211 <ul> |
| 207 <p> | 212 <p> |
| 208 $enumerateGroups | 213 $enumerateGroups |
| 209 </p> | 214 </p> |
| 210 </ul> | 215 </ul> |
| 211 <p> | 216 <p> |
| 212 ${markdownToHtml(ruleFootMatter)} | 217 ${markdownToHtml(ruleFootMatter)} |
| 213 </p> | 218 </p> |
| 214 | 219 |
| 220 <h2 id="styleguide-rules">Error Rules</h2> |
| 221 |
| 222 $enumerateErrorRules |
| 223 |
| 215 <h2 id="styleguide-rules">Style Rules</h2> | 224 <h2 id="styleguide-rules">Style Rules</h2> |
| 216 | 225 |
| 217 $enumerateStyleRules | 226 $enumerateStyleRules |
| 218 | 227 |
| 219 <h2 id="styleguide-rules">Pub Rules</h2> | 228 <h2 id="styleguide-rules">Pub Rules</h2> |
| 220 | 229 |
| 221 $enumeratePubRules | 230 $enumeratePubRules |
| 222 | 231 |
| 223 </section> | 232 </section> |
| 224 </div> | 233 </div> |
| 225 <footer> | 234 <footer> |
| 226 <p>Project maintained by <a href="https://github.com/google">google</a>
</p> | 235 <p>Project maintained by <a href="https://github.com/google">google</a>
</p> |
| 227 <p>Hosted on GitHub Pages — Theme by <a href="https://github.com/
orderedlist">orderedlist</a></p> | 236 <p>Hosted on GitHub Pages — Theme by <a href="https://github.com/
orderedlist">orderedlist</a></p> |
| 228 </footer> | 237 </footer> |
| 229 <!--[if !IE]><script>fixScale(document);</script><![endif]--> | 238 <!--[if !IE]><script>fixScale(document);</script><![endif]--> |
| 230 <script type="text/javascript"> | 239 <script type="text/javascript"> |
| 231 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl
." : "http://www."); | 240 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl
." : "http://www."); |
| 232 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytic
s.com/ga.js' type='text/javascript'%3E%3C/script%3E")); | 241 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytic
s.com/ga.js' type='text/javascript'%3E%3C/script%3E")); |
| 233 </script> | 242 </script> |
| 234 <script type="text/javascript"> | 243 <script type="text/javascript"> |
| 235 try { | 244 try { |
| 236 var pageTracker = _gat._getTracker("UA-34425814-2"); | 245 var pageTracker = _gat._getTracker("UA-34425814-2"); |
| 237 pageTracker._trackPageview(); | 246 pageTracker._trackPageview(); |
| 238 } catch(err) {} | 247 } catch(err) {} |
| 239 </script> | 248 </script> |
| 240 </body> | 249 </body> |
| 241 </html> | 250 </html> |
| 242 '''; | 251 '''; |
| 243 } | 252 } |
| OLD | NEW |