File: import_style.test

package info (click to toggle)
hlint 3.10-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 988 kB
  • sloc: haskell: 7,098; lisp: 86; makefile: 3
file content (129 lines) | stat: -rw-r--r-- 4,347 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---------------------------------------------------------------------
RUN tests/importStyle-1.hs --hint=data/import_style.yaml
FILE tests/importStyle-1.hs
import HypotheticalModule1
import HypotheticalModule2
import HypotheticalModule3
import qualified HypotheticalModule3.SomeModule
import HypotheticalModule3.SomeModule qualified
import qualified HypotheticalModule3.OtherSubModule
OUTPUT
tests/importStyle-1.hs:1:1-26: Warning: Avoid restricted alias
Found:
  import HypotheticalModule1
Perhaps:
  import HypotheticalModule1 as HM1
Note: may break the code

tests/importStyle-1.hs:2:1-26: Warning: HypotheticalModule2 should be imported qualified or with an explicit import list
Found:
  import HypotheticalModule2
Perhaps:
  import qualified HypotheticalModule2
Note: may break the code

tests/importStyle-1.hs:3:1-26: Warning: HypotheticalModule3 should be imported qualified
Found:
  import HypotheticalModule3
Perhaps:
  import qualified HypotheticalModule3
Note: may break the code

tests/importStyle-1.hs:4:1-47: Warning: HypotheticalModule3.SomeModule should be imported unqualified
Found:
  import qualified HypotheticalModule3.SomeModule
Perhaps:
  import HypotheticalModule3.SomeModule
Note: may break the code

tests/importStyle-1.hs:5:1-47: Warning: HypotheticalModule3.SomeModule should be imported unqualified
Found:
  import HypotheticalModule3.SomeModule qualified
Perhaps:
  import HypotheticalModule3.SomeModule
Note: may break the code

tests/importStyle-1.hs:6:1-51: Warning: HypotheticalModule3.OtherSubModule should be imported post-qualified or unqualified
Found:
  import qualified HypotheticalModule3.OtherSubModule
Perhaps:
  import HypotheticalModule3.OtherSubModule qualified
Note: may break the code

6 hints

---------------------------------------------------------------------
RUN tests/importStyle-2.hs --hint=data/import_style.yaml
FILE tests/importStyle-2.hs
import HypotheticalModule1 as HM1
import qualified HypotheticalModule2
import HypotheticalModule2 (a, b, c, d)
import qualified HypotheticalModule3
import HypotheticalModule3.SomeModule
import HypotheticalModule3.OtherSubModule qualified
import HypotheticalModule3.OtherSubModule
OUTPUT
No hints

---------------------------------------------------------------------
RUN tests/importStyle-postqual-pos.hs --hint=data/import_style.yaml -XImportQualifiedPost
FILE tests/importStyle-postqual-pos.hs
import HypotheticalModule1 qualified as HM1
import HypotheticalModule2 qualified
import HypotheticalModule2 qualified as Arbitrary
import HypotheticalModule3 qualified
import HypotheticalModule3 qualified as Arbitrary
import HypotheticalModule4 qualified as HM4
import HypotheticalModule5 qualified
import HypotheticalModule5 qualified as HM5
OUTPUT
No hints

---------------------------------------------------------------------
RUN tests/importStyle-postqual-neg.hs --hint=data/import_style.yaml -XImportQualifiedPost
FILE tests/importStyle-postqual-neg.hs
import HypotheticalModule1 qualified
import qualified HypotheticalModule4
import qualified HypotheticalModule4 as Verbotten
import qualified HypotheticalModule4 as HM4
import HypotheticalModule5 as HM5
import qualified HypotheticalModule5

OUTPUT
tests/importStyle-postqual-neg.hs:1:1-36: Warning: Avoid restricted alias
Found:
  import HypotheticalModule1 qualified
Perhaps:
  import HypotheticalModule1 qualified as HM1
Note: may break the code

tests/importStyle-postqual-neg.hs:2:1-36: Warning: Avoid restricted alias
Found:
  import qualified HypotheticalModule4
Perhaps:
  import qualified HypotheticalModule4 as HM4
Note: may break the code

tests/importStyle-postqual-neg.hs:3:1-49: Warning: Avoid restricted alias
Found:
  import qualified HypotheticalModule4 as Verbotten
Perhaps:
  import qualified HypotheticalModule4 as HM4
Note: may break the code

tests/importStyle-postqual-neg.hs:5:1-33: Warning: HypotheticalModule5 should be imported post-qualified
Found:
  import HypotheticalModule5 as HM5
Perhaps:
  import HypotheticalModule5 qualified as HM5
Note: may break the code

tests/importStyle-postqual-neg.hs:6:1-36: Warning: HypotheticalModule5 should be imported post-qualified
Found:
  import qualified HypotheticalModule5
Perhaps:
  import HypotheticalModule5 qualified
Note: may break the code

5 hints
---------------------------------------------------------------------