]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/handler/test_reek_handler.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / ale / test / handler / test_reek_handler.vader
1 Before:
2   Save g:ale_ruby_reek_show_context
3   Save g:ale_ruby_reek_show_wiki_link
4
5   let g:ale_ruby_reek_show_context = 0
6   let g:ale_ruby_reek_show_wiki_link = 0
7
8   runtime ale_linters/ruby/reek.vim
9
10 After:
11   Restore
12
13   call ale#linter#Reset()
14
15 Execute(The reek handler should parse JSON correctly, with only context enabled):
16   let g:ale_ruby_reek_show_context = 1
17
18   AssertEqual
19   \ [
20   \     {
21   \         'lnum': 12,
22   \         'text': 'Context#method violates rule number one',
23   \         'code': 'Rule1',
24   \         'type': 'W',
25   \     },
26   \     {
27   \         'lnum': 34,
28   \         'text': 'Context#method violates rule number two',
29   \         'code': 'Rule2',
30   \         'type': 'W',
31   \     },
32   \     {
33   \         'lnum': 56,
34   \         'text': 'Context#method violates rule number two',
35   \         'code': 'Rule2',
36   \         'type': 'W',
37   \     },
38   \ ],
39   \ ale_linters#ruby#reek#Handle(347, [
40   \     '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"},{"context":"Context#method","lines":[34, 56],"message":"violates rule number two","smell_type":"Rule2","source":"/home/user/file.rb","name":"bad code","count":2,"wiki_link":"https://example.com/Rule1.md"}]'
41   \ ])
42
43 Execute(The reek handler should parse JSON correctly, with no context or wiki links):
44   AssertEqual
45   \ [
46   \     {
47   \         'lnum': 12,
48   \         'text': 'violates rule number one',
49   \         'code': 'Rule1',
50   \         'type': 'W',
51   \     },
52   \ ],
53   \ ale_linters#ruby#reek#Handle(347, [
54   \     '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]'
55   \ ])
56
57 Execute(The reek handler should parse JSON correctly, with both context and wiki links):
58   let g:ale_ruby_reek_show_context = 1
59   let g:ale_ruby_reek_show_wiki_link = 1
60
61   AssertEqual
62   \ [
63   \     {
64   \         'lnum': 12,
65   \         'text': 'Context#method violates rule number one [https://example.com/Rule1.md]',
66   \         'code': 'Rule1',
67   \         'type': 'W',
68   \     },
69   \ ],
70   \ ale_linters#ruby#reek#Handle(347, [
71   \     '[{"context":"Context#method","lines":[12],"message":"violates rule number one","smell_type":"Rule1","source":"/home/user/file.rb","parameter":"bad parameter","wiki_link":"https://example.com/Rule1.md"}]'
72   \ ])
73
74 Execute(The reek handler should parse JSON correctly when there is no output from reek):
75   AssertEqual
76   \ [],
77   \ ale_linters#ruby#reek#Handle(347, [
78   \ ])
79
80 Execute(The reek handler should handle garbage output):
81   AssertEqual
82   \ [],
83   \ ale_linters#ruby#reek#Handle(347, [
84   \   'No such command in 2.4.1 of ruby',
85   \ ])