Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

too_many_branches.py 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. """ Test for too many branches. """
  2. # pylint: disable=using-constant-test
  3. def wrong(): # [too-many-branches]
  4. """ Has too many branches. """
  5. if 1:
  6. pass
  7. elif 1:
  8. pass
  9. elif 1:
  10. pass
  11. elif 1:
  12. pass
  13. elif 1:
  14. pass
  15. elif 1:
  16. pass
  17. try:
  18. pass
  19. finally:
  20. pass
  21. if 2:
  22. pass
  23. while True:
  24. pass
  25. if 1:
  26. pass
  27. elif 2:
  28. pass
  29. elif 3:
  30. pass
  31. def good():
  32. """ Too many branches only if we take
  33. into consideration the nested functions.
  34. """
  35. def nested_1():
  36. """ empty """
  37. if 1:
  38. pass
  39. elif 2:
  40. pass
  41. elif 3:
  42. pass
  43. elif 4:
  44. pass
  45. nested_1()
  46. try:
  47. pass
  48. finally:
  49. pass
  50. try:
  51. pass
  52. finally:
  53. pass
  54. if 1:
  55. pass
  56. elif 2:
  57. pass
  58. elif 3:
  59. pass
  60. elif 4:
  61. pass
  62. elif 5:
  63. pass
  64. elif 6:
  65. pass
  66. elif 7:
  67. pass