lex-detect 0.2.0 → 0.2.1
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e8430d894d1792494f0781c7f13c28de7da13817c40fa3a9f80cfc4c89bc9ad
|
|
4
|
+
data.tar.gz: 2bff9f69460165c22a025dc97912639202cca9200366e91dafbc84dc9d37bb8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b087321a87beeff9cd42417286a39477edd5608ca8190bc67877b6e55b57f6bd4f971c05b802eadf47b68967acbb40c0e74b96c25a1d970d1431adffc3f43d2a
|
|
7
|
+
data.tar.gz: 6f9c61761fad7069ad09110f21d23227a664a606fcc5b50737d0d05c462ce9240b60e6f91a7d3b1684845b76c92f1500e2951a512725c33880eafacbc8ac3274
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.1] - 2026-03-22
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `Formatters::Json` passthrough formatter returning detections unchanged (or as pretty-printed JSON via `.to_json`)
|
|
7
|
+
- `Formatters` module entry point with `Formatters.format(detections, format:)` dispatcher for `:sarif`, `:markdown`, and `:json`
|
|
8
|
+
- `format_results` now delegates to `Formatters.format` instead of dispatching inline
|
|
9
|
+
- 5 new specs for `Formatters::Json` covering passthrough identity, field preservation, JSON serialization, and empty input
|
|
10
|
+
|
|
3
11
|
## [0.2.0] - 2026-03-22
|
|
4
12
|
|
|
5
13
|
### Added
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module Legion
|
|
6
|
+
module Extensions
|
|
7
|
+
module Detect
|
|
8
|
+
module Formatters
|
|
9
|
+
module Json
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def format(detections)
|
|
13
|
+
detections
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def to_json(detections)
|
|
17
|
+
::JSON.pretty_generate(format(detections))
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'legion/extensions/detect/formatters/json'
|
|
4
|
+
require 'legion/extensions/detect/formatters/sarif'
|
|
5
|
+
require 'legion/extensions/detect/formatters/markdown_pr'
|
|
6
|
+
|
|
7
|
+
module Legion
|
|
8
|
+
module Extensions
|
|
9
|
+
module Detect
|
|
10
|
+
module Formatters
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
def format(detections, format: :json)
|
|
14
|
+
case format.to_sym
|
|
15
|
+
when :sarif then Sarif.to_json(detections)
|
|
16
|
+
when :markdown then MarkdownPr.format(detections)
|
|
17
|
+
else Json.format(detections)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -4,8 +4,7 @@ require 'legion/extensions/detect/version'
|
|
|
4
4
|
require 'legion/extensions/detect/catalog'
|
|
5
5
|
require 'legion/extensions/detect/scanner'
|
|
6
6
|
require 'legion/extensions/detect/installer'
|
|
7
|
-
require 'legion/extensions/detect/formatters
|
|
8
|
-
require 'legion/extensions/detect/formatters/markdown_pr'
|
|
7
|
+
require 'legion/extensions/detect/formatters'
|
|
9
8
|
require_relative 'detect/runners/task_observer'
|
|
10
9
|
require_relative 'detect/runners/cancel_task'
|
|
11
10
|
|
|
@@ -46,11 +45,7 @@ module Legion
|
|
|
46
45
|
|
|
47
46
|
def format_results(format: :json, detections: nil)
|
|
48
47
|
results = detections || scan
|
|
49
|
-
|
|
50
|
-
when :sarif then Formatters::Sarif.to_json(results)
|
|
51
|
-
when :markdown then Formatters::MarkdownPr.format(results)
|
|
52
|
-
else results
|
|
53
|
-
end
|
|
48
|
+
Formatters.format(results, format: format)
|
|
54
49
|
end
|
|
55
50
|
end
|
|
56
51
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-detect
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -31,6 +31,8 @@ files:
|
|
|
31
31
|
- lib/legion/extensions/detect/actors/full_scan.rb
|
|
32
32
|
- lib/legion/extensions/detect/actors/observer_tick.rb
|
|
33
33
|
- lib/legion/extensions/detect/catalog.rb
|
|
34
|
+
- lib/legion/extensions/detect/formatters.rb
|
|
35
|
+
- lib/legion/extensions/detect/formatters/json.rb
|
|
34
36
|
- lib/legion/extensions/detect/formatters/markdown_pr.rb
|
|
35
37
|
- lib/legion/extensions/detect/formatters/sarif.rb
|
|
36
38
|
- lib/legion/extensions/detect/installer.rb
|