gergich 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/{bin → exe}/gergich +0 -0
  3. data/{bin → exe}/master_bouncer +0 -0
  4. data/lib/gergich/capture/androidlint_capture.rb +10 -5
  5. data/lib/gergich/capture/brakeman_capture.rb +3 -2
  6. data/lib/gergich/capture/eslint_capture.rb +2 -1
  7. data/lib/gergich/capture/flake8_capture.rb +1 -1
  8. data/lib/gergich/capture/i18nliner_capture.rb +1 -1
  9. data/lib/gergich/capture/rubocop_capture.rb +38 -3
  10. data/lib/gergich/capture/shellcheck_capture.rb +2 -1
  11. data/lib/gergich/capture/stylelint_capture.rb +2 -5
  12. data/lib/gergich/capture/swiftlint_capture.rb +3 -3
  13. data/lib/gergich/capture/yamllint_capture.rb +31 -0
  14. data/lib/gergich/capture.rb +12 -5
  15. data/lib/gergich/cli/gergich.rb +6 -4
  16. data/lib/gergich/cli/master_bouncer.rb +6 -6
  17. data/lib/gergich/cli.rb +1 -1
  18. data/lib/gergich.rb +27 -28
  19. metadata +65 -41
  20. data/LICENSE +0 -20
  21. data/README.md +0 -178
  22. data/bin/check_coverage +0 -8
  23. data/bin/run_tests.sh +0 -52
  24. data/spec/gergich/capture/androidlint_capture_spec.rb +0 -61
  25. data/spec/gergich/capture/brakeman_capture_spec.rb +0 -91
  26. data/spec/gergich/capture/custom_capture_spec.rb +0 -41
  27. data/spec/gergich/capture/eslint_capture_spec.rb +0 -31
  28. data/spec/gergich/capture/flake8_capture_spec.rb +0 -23
  29. data/spec/gergich/capture/i18nliner_capture_spec.rb +0 -25
  30. data/spec/gergich/capture/rubocop_capture_spec.rb +0 -66
  31. data/spec/gergich/capture/shellcheck_capture_spec.rb +0 -83
  32. data/spec/gergich/capture/stylelint_capture_spec.rb +0 -54
  33. data/spec/gergich/capture/swiftlint_capture_spec.rb +0 -42
  34. data/spec/gergich/capture_spec.rb +0 -75
  35. data/spec/gergich_spec.rb +0 -379
  36. data/spec/spec_helper.rb +0 -92
  37. data/spec/support/capture_shared_examples.rb +0 -19
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::EslintCapture do
6
- let(:output) do
7
- <<~OUTPUT
8
- jsapp/models/user.js
9
- 4:21 error Missing semicolon semi
10
- 5:1 warning Too much cowbell cowbell-overload
11
- OUTPUT
12
- end
13
- let(:comments) do
14
- [
15
- {
16
- path: "jsapp/models/user.js",
17
- position: 4,
18
- message: "[eslint] Missing semicolon",
19
- severity: "error"
20
- },
21
- {
22
- path: "jsapp/models/user.js",
23
- position: 5,
24
- message: "[eslint] Too much cowbell",
25
- severity: "warn"
26
- }
27
- ]
28
- end
29
-
30
- it_behaves_like "a captor"
31
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::Flake8Capture do
6
- let(:output) do
7
- <<~OUTPUT
8
- ./djangogeneric/settings/base.py:73:80: E501 line too long (81 > 79 characters)
9
- OUTPUT
10
- end
11
- let(:comments) do
12
- [
13
- {
14
- path: "./djangogeneric/settings/base.py",
15
- position: 73,
16
- message: "[flake8] E501 line too long (81 > 79 characters)",
17
- severity: "error"
18
- }
19
- ]
20
- end
21
-
22
- it_behaves_like "a captor"
23
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::I18nlinerCapture do
6
- let(:output) do
7
- <<~OUTPUT
8
- 1)
9
- invalid signature on line 4: <unsupported expression>
10
- jsapp/models/user.js
11
- OUTPUT
12
- end
13
- let(:comments) do
14
- [
15
- {
16
- path: "jsapp/models/user.js",
17
- position: 4,
18
- message: "[i18n] invalid signature: <unsupported expression>",
19
- severity: "error"
20
- }
21
- ]
22
- end
23
-
24
- it_behaves_like "a captor"
25
- end
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::RubocopCapture do
6
- let(:output) do
7
- <<~OUTPUT
8
- Offenses:
9
-
10
- bin/gergich:47:8: C: Prefer double-quoted strings
11
- if ENV['DEBUG']
12
- ^^^^^^^
13
- foo/bar/baz.rb:1:2: W: no context for this one :shrug:
14
- lib/gergich.rb:10:9: E: this is a terrible name
15
-
16
- seriously, what were you thinking?
17
- def foo
18
- ^^^
19
- lib/gergich.rb:22:55: W: Line is too long. [55/54]
20
- def initialize(ref = "HEAD", revision_number = nil)
21
- ^^
22
- OUTPUT
23
- end
24
- let(:comments) do
25
- [
26
- {
27
- path: "bin/gergich",
28
- position: 47,
29
- message: "[rubocop] Prefer double-quoted strings\n\n if ENV['DEBUG']\n ^^^^^^^\n",
30
- severity: "info"
31
- },
32
- {
33
- path: "foo/bar/baz.rb",
34
- position: 1,
35
- message: "[rubocop] no context for this one :shrug:\n",
36
- severity: "warn"
37
- },
38
- {
39
- path: "lib/gergich.rb",
40
- position: 10,
41
- message: <<~OUTPUT,
42
- [rubocop] this is a terrible name
43
-
44
- seriously, what were you thinking?
45
-
46
- def foo
47
- ^^^
48
- OUTPUT
49
- severity: "error"
50
- },
51
- {
52
- path: "lib/gergich.rb",
53
- position: 22,
54
- message: <<~OUTPUT,
55
- [rubocop] Line is too long. [55/54]
56
-
57
- def initialize(ref = "HEAD", revision_number = nil)
58
- ^^
59
- OUTPUT
60
- severity: "warn"
61
- }
62
- ]
63
- end
64
-
65
- it_behaves_like "a captor"
66
- end
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::ShellcheckCapture do
6
- let(:output) do
7
- <<~'OUTPUT'
8
- [
9
- {
10
- "file": "bin/sync-translations.sh",
11
- "line": 23,
12
- "endLine": 23,
13
- "column": 21,
14
- "endColumn": 21,
15
- "level": "style",
16
- "code": 2006,
17
- "message": "Use $(..) instead of legacy `..`."
18
- },
19
- {
20
- "file": "bin/sync-translations.sh",
21
- "line": 23,
22
- "endLine": 23,
23
- "column": 43,
24
- "endColumn": 43,
25
- "level": "warning",
26
- "code": 2046,
27
- "message": "Quote this to prevent word splitting."
28
- },
29
- {
30
- "file": "bin/sync-translations.sh",
31
- "line": 32,
32
- "endLine": 32,
33
- "column": 62,
34
- "endColumn": 62,
35
- "level": "info",
36
- "code": 2086,
37
- "message": "Double quote to prevent globbing and word splitting."
38
- },
39
- {
40
- "file": "fail.sh",
41
- "line": 3,
42
- "endLine": 3,
43
- "column": 12,
44
- "endColumn": 12,
45
- "level": "error",
46
- "code": 1101,
47
- "message": "Delete trailing spaces after \\ to break line (or use quotes for literal space)."
48
- }
49
- ]
50
- OUTPUT
51
- end
52
-
53
- let(:comments) do
54
- [
55
- {
56
- path: "bin/sync-translations.sh",
57
- position: 23,
58
- message: "Use $(..) instead of legacy `..`.",
59
- severity: "info"
60
- },
61
- {
62
- path: "bin/sync-translations.sh",
63
- position: 23,
64
- message: "Quote this to prevent word splitting.",
65
- severity: "warn"
66
- },
67
- {
68
- path: "bin/sync-translations.sh",
69
- position: 32,
70
- message: "Double quote to prevent globbing and word splitting.",
71
- severity: "info"
72
- },
73
- {
74
- path: "fail.sh",
75
- position: 3,
76
- message: "Delete trailing spaces after \\ to break line (or use quotes for literal space).",
77
- severity: "error"
78
- }
79
- ]
80
- end
81
-
82
- it_behaves_like "a captor"
83
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::StylelintCapture do
6
- let(:output) do
7
- <<~OUTPUT
8
- app/stylesheets/base/_print.scss
9
- 3:17 ✖ Unexpected invalid hex color "#owiehfi" color-no-invalid-hex
10
- 3:17 ⚠ Expected "#owiehfi" to be "#OWIEHFI" color-hex-case
11
-
12
- app/stylesheets/base/_variables.scss
13
- 2:15 ✖ Unexpected invalid hex color "#2D3B4" color-no-invalid-hex
14
- 30:15 ⚠ Expected "#2d3b4a" to be "#2D3B4A" color-hex-case
15
- 45:12 ℹ Expected "#2d3b4a" to be "#2D3B4A" color-hex-case
16
- OUTPUT
17
- end
18
- let(:comments) do
19
- [
20
- {
21
- path: "app/stylesheets/base/_print.scss",
22
- position: 3,
23
- message: "[stylelint] Unexpected invalid hex color \"#owiehfi\"",
24
- severity: "error"
25
- },
26
- {
27
- path: "app/stylesheets/base/_print.scss",
28
- position: 3,
29
- message: "[stylelint] Expected \"#owiehfi\" to be \"#OWIEHFI\"",
30
- severity: "warn"
31
- },
32
- {
33
- path: "app/stylesheets/base/_variables.scss",
34
- position: 2,
35
- message: "[stylelint] Unexpected invalid hex color \"#2D3B4\"",
36
- severity: "error"
37
- },
38
- {
39
- path: "app/stylesheets/base/_variables.scss",
40
- position: 30,
41
- message: "[stylelint] Expected \"#2d3b4a\" to be \"#2D3B4A\"",
42
- severity: "warn"
43
- },
44
- {
45
- path: "app/stylesheets/base/_variables.scss",
46
- position: 45,
47
- message: "[stylelint] Expected \"#2d3b4a\" to be \"#2D3B4A\"",
48
- severity: "info"
49
- }
50
- ]
51
- end
52
-
53
- it_behaves_like "a captor"
54
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../support/capture_shared_examples"
4
-
5
- RSpec.describe Gergich::Capture::SwiftlintCapture do
6
- # rubocop:disable Metrics/LineLength
7
- let(:colon_violation) { "Colon Violation: Colons should be next to the identifier when specifying a type. (colon)" }
8
- let(:line_length_violation) { "Line Length Violation: Line should be 100 characters or less: currently 129 characters (line_length)" }
9
- let(:force_cast_violation) { "Force Cast Violation: Force casts should be avoided. (force_cast)" }
10
- # rubocop:enable Metrics/LineLength
11
- let(:output) do
12
- <<~OUTPUT
13
- /path/to/My.swift:13:22: warning: #{colon_violation}
14
- /path/to/Fail.swift:76: warning: #{line_length_violation}
15
- /path/to/Cast.swift:15:9: error: #{force_cast_violation}
16
- OUTPUT
17
- end
18
- let(:comments) do
19
- [
20
- {
21
- path: "/path/to/My.swift",
22
- position: 13,
23
- message: "[swiftlint] #{colon_violation}",
24
- severity: "warn"
25
- },
26
- {
27
- path: "/path/to/Fail.swift",
28
- position: 76,
29
- message: "[swiftlint] #{line_length_violation}",
30
- severity: "warn"
31
- },
32
- {
33
- path: "/path/to/Cast.swift",
34
- position: 15,
35
- message: "[swiftlint] #{force_cast_violation}",
36
- severity: "error"
37
- }
38
- ]
39
- end
40
-
41
- it_behaves_like "a captor"
42
- end
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../../lib/gergich/capture"
4
-
5
- RSpec.describe Gergich::Capture do
6
- let!(:draft) { double }
7
-
8
- let :output do
9
- <<~OUTPUT
10
- #{path}
11
- 4:21 error Missing semicolon semi
12
- OUTPUT
13
- end
14
-
15
- before do
16
- allow(Gergich::Draft).to receive(:new).and_return(draft)
17
- $stdin = StringIO.new(output)
18
- end
19
-
20
- after do
21
- $stdin = STDIN
22
- end
23
-
24
- context "stdin" do
25
- let(:path) { "jsapp/models/user.js" }
26
-
27
- it "should catch errors" do
28
- expect(draft).to receive(:add_comment).with(
29
- "jsapp/models/user.js",
30
- 4,
31
- "[eslint] Missing semicolon",
32
- "error"
33
- )
34
- described_class.run("eslint", "-", suppress_output: true)
35
- end
36
-
37
- it "shouldn't eat stdin" do
38
- allow(draft).to receive(:add_comment)
39
- expect($stdout).to receive(:puts).exactly(output.lines.size).times
40
- described_class.run("eslint", "-")
41
- end
42
- end
43
-
44
- context "absolute paths" do
45
- before do
46
- allow(described_class).to receive(:base_path).and_return("/the/directory/")
47
- end
48
-
49
- context "under us" do
50
- let(:path) { "/the/directory/jsapp/models/user.js" }
51
- it "should be relativized" do
52
- expect(draft).to receive(:add_comment).with(
53
- "jsapp/models/user.js",
54
- 4,
55
- "[eslint] Missing semicolon",
56
- "error"
57
- )
58
- described_class.run("eslint", "-", suppress_output: true)
59
- end
60
- end
61
-
62
- context "elsewhere" do
63
- let(:path) { "/other/directory/jsapp/models/user.js" }
64
- it "should not be relativized" do
65
- expect(draft).to receive(:add_comment).with(
66
- "/other/directory/jsapp/models/user.js",
67
- 4,
68
- "[eslint] Missing semicolon",
69
- "error"
70
- )
71
- described_class.run("eslint", "-", suppress_output: true)
72
- end
73
- end
74
- end
75
- end