E101.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. # Used to be the file for W191
  2. #: E101+1
  3. if False:
  4. print # indented with 1 tab
  5. #: E101+1
  6. y = x == 2 \
  7. or x == 3
  8. #: E101+5
  9. if (
  10. x == (
  11. 3
  12. ) or
  13. y == 4):
  14. pass
  15. #: E101+3
  16. if x == 2 \
  17. or y > 1 \
  18. or x == 3:
  19. pass
  20. #: E101+3
  21. if x == 2 \
  22. or y > 1 \
  23. or x == 3:
  24. pass
  25. #: E101+1
  26. if (foo == bar and baz == frop):
  27. pass
  28. #: E101+1
  29. if (foo == bar and baz == frop):
  30. pass
  31. #: E101+2 E101+3
  32. if start[1] > end_col and not (
  33. over_indent == 4 and indent_next):
  34. assert (0, "E121 continuation line over-"
  35. "indented for visual indent")
  36. #: E101+3
  37. def long_function_name(
  38. var_one, var_two, var_three,
  39. var_four):
  40. hello(var_one)
  41. #: E101+2
  42. if ((row < 0 or self.moduleCount <= row or
  43. col < 0 or self.moduleCount <= col)):
  44. raise Exception("%s,%s - %s" % (row, col, self.moduleCount))
  45. #: E101+1 E101+2 E101+3 E101+4 E101+5 E101+6
  46. if bar:
  47. assert (
  48. start, 'E121 lines starting with a '
  49. 'closing bracket should be indented '
  50. "to match that of the opening "
  51. "bracket's line"
  52. )
  53. # you want vertical alignment, so use a parens
  54. #: E101+3
  55. if ((foo.bar("baz") and
  56. foo.bar("frop")
  57. )):
  58. hello("yes")
  59. #: E101+3
  60. # also ok, but starting to look like LISP
  61. if ((foo.bar("baz") and
  62. foo.bar("frop"))):
  63. hello("yes")
  64. #: E101+1
  65. if (a == 2 or b == "abc def ghi" "jkl mno"):
  66. assert True
  67. #: E101+2
  68. if (a == 2 or b == """abc def ghi
  69. jkl mno"""):
  70. assert True
  71. #: E101+1 E101+2
  72. if length > options.max_line_length:
  73. assert options.max_line_length, \
  74. "E501 line too long (%d characters)" % length
  75. #: E101+1 E101+2
  76. if os.path.exists(os.path.join(path, PEP8_BIN)):
  77. cmd = ([os.path.join(path, PEP8_BIN)] +
  78. self._pep8_options(targetfile))
  79. # TODO Tabs in docstrings shouldn't be there, use \t.
  80. '''
  81. multiline string with tab in it'''
  82. # Same here.
  83. '''multiline string
  84. with tabs
  85. and spaces
  86. '''
  87. # Okay
  88. '''sometimes, you just need to go nuts in a multiline string
  89. and allow all sorts of crap
  90. like mixed tabs and spaces
  91. or trailing whitespace
  92. or long long long long long long long long long long long long long long long long long lines
  93. ''' # noqa
  94. # Okay
  95. '''this one
  96. will get no warning
  97. even though the noqa comment is not immediately after the string
  98. ''' + foo # noqa
  99. #: E101+2
  100. if foo is None and bar is "frop" and \
  101. blah == 'yeah':
  102. blah = 'yeahnah'
  103. #: E101+1 E101+2 E101+3
  104. if True:
  105. foo(
  106. 1,
  107. 2)
  108. #: E101+1 E101+2 E101+3 E101+4 E101+5
  109. def test_keys(self):
  110. """areas.json - All regions are accounted for."""
  111. expected = set([
  112. u'Norrbotten',
  113. u'V\xe4sterbotten',
  114. ])
  115. #: E101+1
  116. x = [
  117. 'abc'
  118. ]