metz-scan 0.5.3 → 0.7.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.
- checksums.yaml +4 -4
- data/lib/metz_scan/analyzers/inheritance_descendants.rb +1 -1
- data/lib/metz_scan/analyzers/namespace_leak_pressure.rb +1 -1
- data/lib/metz_scan/analyzers/package_dependency_pressure.rb +1 -1
- data/lib/metz_scan/analyzers/package_map.rb +2 -2
- data/lib/metz_scan/analyzers/test_calls_private_method/call_site_collector.rb +79 -0
- data/lib/metz_scan/analyzers/test_calls_private_method/finding.rb +23 -0
- data/lib/metz_scan/analyzers/test_calls_private_method/metadata.rb +27 -0
- data/lib/metz_scan/analyzers/test_calls_private_method/node_predicates.rb +57 -0
- data/lib/metz_scan/analyzers/test_calls_private_method/receiver_resolution.rb +80 -0
- data/lib/metz_scan/analyzers/test_calls_private_method/scope_facts.rb +76 -0
- data/lib/metz_scan/analyzers/test_calls_private_method/scope_resolution.rb +56 -0
- data/lib/metz_scan/analyzers/test_calls_private_method/triage.rb +23 -0
- data/lib/metz_scan/analyzers/test_calls_private_method.rb +125 -0
- data/lib/metz_scan/cli.rb +7 -13
- data/lib/metz_scan/commands/explain.rb +11 -2
- data/lib/metz_scan/commands/project_analyzers.rb +3 -2
- data/lib/metz_scan/commands/report.rb +22 -8
- data/lib/metz_scan/commands/rules.rb +16 -4
- data/lib/metz_scan/commands/scan/auto_fix.rb +54 -54
- data/lib/metz_scan/commands/scan/check_failure.rb +42 -0
- data/lib/metz_scan/commands/scan/config_disables.rb +83 -0
- data/lib/metz_scan/commands/scan/config_exclusions.rb +112 -0
- data/lib/metz_scan/commands/scan/exclude_entries.rb +64 -0
- data/lib/metz_scan/commands/scan/exclude_entry_locator.rb +84 -0
- data/lib/metz_scan/commands/scan/exclude_provenance.rb +53 -0
- data/lib/metz_scan/commands/scan/execution_config_store.rb +142 -0
- data/lib/metz_scan/commands/scan/ignored_cli_options_note.rb +35 -0
- data/lib/metz_scan/commands/scan/inherited_include_rewriter.rb +43 -0
- data/lib/metz_scan/commands/scan/inline_directive_locator.rb +80 -0
- data/lib/metz_scan/commands/scan/json_guidance.rb +81 -0
- data/lib/metz_scan/commands/scan/offense_extractor.rb +29 -7
- data/lib/metz_scan/commands/scan/path_scoped_include_note.rb +73 -0
- data/lib/metz_scan/commands/scan/project_analyzer_offenses.rb +21 -5
- data/lib/metz_scan/commands/scan/project_analyzer_runner.rb +25 -24
- data/lib/metz_scan/commands/scan/project_config_scope.rb +105 -26
- data/lib/metz_scan/commands/scan/rubocop_failure.rb +38 -0
- data/lib/metz_scan/commands/scan/rubocop_invocation.rb +141 -0
- data/lib/metz_scan/commands/scan/runner.rb +94 -75
- data/lib/metz_scan/commands/scan/sarif_rule_descriptors.rb +6 -24
- data/lib/metz_scan/commands/scan/suppression_ledger.rb +113 -0
- data/lib/metz_scan/commands/scan/suppression_ledger_formatter.rb +54 -0
- data/lib/metz_scan/commands/scan/target_ruby_version.rb +3 -2
- data/lib/metz_scan/commands/scan/text_renderer.rb +5 -4
- data/lib/metz_scan/commands/scan.rb +48 -26
- data/lib/metz_scan/project_index/rubydex_backend/method_declarations.rb +33 -12
- data/lib/metz_scan/project_index/rubydex_backend/method_visibility.rb +155 -0
- data/lib/metz_scan/project_index/rubydex_backend.rb +2 -1
- data/lib/metz_scan/project_index.rb +1 -1
- data/lib/metz_scan/version.rb +1 -1
- data/metz-scan.gemspec +20 -12
- metadata +33 -14
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner/artifact_writer.rb +0 -51
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner/baseline_delta.rb +0 -231
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner/collaborators.rb +0 -76
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner/markdown_renderer.rb +0 -353
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner/readiness_catalog.rb +0 -123
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner/summary.rb +0 -333
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner/target_set.rb +0 -139
- data/lib/metz_scan/calibration/project_analyzer_evidence_runner.rb +0 -64
- data/lib/metz_scan/calibration/rubydex_drift_formatter.rb +0 -91
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "method_visibility"
|
|
4
|
+
|
|
3
5
|
module MetzScan
|
|
4
6
|
class ProjectIndex
|
|
5
7
|
class RubydexBackend
|
|
6
8
|
module MethodDeclarations
|
|
9
|
+
include MethodVisibility
|
|
10
|
+
|
|
7
11
|
def method_declarations
|
|
8
12
|
method_declaration_entries.sort_by do |declaration|
|
|
9
13
|
[declaration.owner_name.to_s, declaration.method_identity.to_s, declaration.path.to_s,
|
|
@@ -15,7 +19,7 @@ module MetzScan
|
|
|
15
19
|
|
|
16
20
|
def method_declaration_entries
|
|
17
21
|
graph.declarations.select { |declaration| method_declaration?(declaration) }
|
|
18
|
-
|
|
22
|
+
.filter_map { |declaration| method_declaration_for(declaration) }
|
|
19
23
|
end
|
|
20
24
|
|
|
21
25
|
def method_declaration?(declaration)
|
|
@@ -31,14 +35,13 @@ module MetzScan
|
|
|
31
35
|
owner_attributes = method_owner_attributes(declaration)
|
|
32
36
|
return unless owner_attributes
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
identity_attributes(declaration, owner_attributes, method_name)
|
|
36
|
-
.merge(location_attributes(declaration))
|
|
38
|
+
method_declaration_identity(declaration, owner_attributes)
|
|
37
39
|
end
|
|
38
40
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
def method_declaration_identity(declaration, owner_attributes)
|
|
42
|
+
location = location_attributes(declaration)
|
|
43
|
+
method_name = method_name_for(owner_attributes.fetch(:signature))
|
|
44
|
+
identity_attributes(declaration, owner_attributes, method_name, location).merge(location)
|
|
42
45
|
end
|
|
43
46
|
|
|
44
47
|
def method_owner_attributes(declaration)
|
|
@@ -50,11 +53,28 @@ module MetzScan
|
|
|
50
53
|
receiver_kind: receiver_kind_for(raw_owner_name) }
|
|
51
54
|
end
|
|
52
55
|
|
|
53
|
-
def identity_attributes(declaration, owner_attributes, method_name)
|
|
56
|
+
def identity_attributes(declaration, owner_attributes, method_name, location_attributes)
|
|
57
|
+
# For supported Ruby visibility forms, Rubydex::Method#visibility is this analyzer's one index assumption.
|
|
58
|
+
method_identity_attributes(declaration, owner_attributes, method_name, location_attributes)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def method_identity_attributes(declaration, owner_attributes, method_name, location_attributes)
|
|
54
62
|
receiver_kind = owner_attributes.fetch(:receiver_kind)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
core_identity_attributes(declaration, owner_attributes, method_name, receiver_kind)
|
|
64
|
+
.merge(visibility: visibility_for(declaration,
|
|
65
|
+
visibility_attributes(owner_attributes, method_name, receiver_kind,
|
|
66
|
+
location_attributes)))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def core_identity_attributes(declaration, owner_attributes, method_name, receiver_kind)
|
|
70
|
+
{ name: declaration.name, owner_name: owner_attributes.fetch(:owner_name),
|
|
71
|
+
method_name: method_name, signature: owner_attributes.fetch(:signature),
|
|
72
|
+
receiver_kind: receiver_kind, method_identity: method_identity_for(receiver_kind, method_name) }
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def visibility_attributes(owner_attributes, method_name, receiver_kind, location_attributes)
|
|
76
|
+
{ owner_name: owner_attributes.fetch(:owner_name), method_name: method_name,
|
|
77
|
+
receiver_kind: receiver_kind, path: location_attributes.fetch(:path) }
|
|
58
78
|
end
|
|
59
79
|
|
|
60
80
|
def location_attributes(declaration)
|
|
@@ -91,7 +111,8 @@ module MetzScan
|
|
|
91
111
|
|
|
92
112
|
def singleton_owner_name(raw_owner_name)
|
|
93
113
|
owner_name, singleton_tail = raw_owner_name.to_s.split("::<", 2)
|
|
94
|
-
|
|
114
|
+
tail_name = singleton_tail&.delete_suffix(">")
|
|
115
|
+
return unless tail_name == owner_name || tail_name == owner_name.split("::").last
|
|
95
116
|
|
|
96
117
|
owner_name
|
|
97
118
|
end
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rubocop"
|
|
4
|
+
|
|
5
|
+
module MetzScan
|
|
6
|
+
class ProjectIndex
|
|
7
|
+
class RubydexBackend
|
|
8
|
+
# AST overlay for `module_function` visibility: Rubydex 0.2.8 aborted on
|
|
9
|
+
# that form. Rubydex 0.3.0 and later resolve it, but the overlay stays as
|
|
10
|
+
# the conservative path.
|
|
11
|
+
module MethodVisibility
|
|
12
|
+
def visibility_for(declaration, attributes)
|
|
13
|
+
return module_function_visibility(attributes) if module_function_method?(attributes)
|
|
14
|
+
|
|
15
|
+
declaration.visibility.to_s
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def module_function_visibility(attributes)
|
|
19
|
+
attributes.fetch(:receiver_kind) == "singleton" ? "public" : "private"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def module_function_method?(attributes)
|
|
23
|
+
facts = module_function_facts_for(attributes.fetch(:path))
|
|
24
|
+
facts.fetch(module_function_owner_name(attributes.fetch(:owner_name)), [])
|
|
25
|
+
.include?(attributes.fetch(:method_name))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def module_function_owner_name(owner_name)
|
|
29
|
+
owner_name.to_s.split("::<", 2).first
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def module_function_facts_for(path)
|
|
33
|
+
return {} unless path && File.file?(path)
|
|
34
|
+
|
|
35
|
+
@module_function_facts_by_path ||= {}
|
|
36
|
+
@module_function_facts_by_path[path] ||= ModuleFunctionFacts.new(path).to_h
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
class ModuleFunctionFacts
|
|
40
|
+
def initialize(path)
|
|
41
|
+
@path = path
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def to_h
|
|
45
|
+
add_scope_tree_facts(ast, [], {})
|
|
46
|
+
rescue Parser::SyntaxError
|
|
47
|
+
{}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
attr_reader :path
|
|
53
|
+
|
|
54
|
+
def ast
|
|
55
|
+
processed_source.ast
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def processed_source
|
|
59
|
+
RuboCop::ProcessedSource.new(File.read(path), RUBY_VERSION.to_f)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def add_scope_tree_facts(node, owner_stack, facts)
|
|
63
|
+
return facts unless node
|
|
64
|
+
return add_scope_facts(node, owner_stack, facts) if scope_node?(node)
|
|
65
|
+
|
|
66
|
+
add_child_scope_facts(node, owner_stack, facts)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def add_child_scope_facts(node, owner_stack, facts)
|
|
70
|
+
node&.children&.each do |child|
|
|
71
|
+
add_child_scope_fact(child, owner_stack, facts) if child.is_a?(Parser::AST::Node)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
facts
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def add_child_scope_fact(child, owner_stack, facts)
|
|
78
|
+
return add_scope_facts(child, owner_stack, facts) if scope_node?(child)
|
|
79
|
+
|
|
80
|
+
add_child_scope_facts(child, owner_stack, facts)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def add_scope_facts(scope, owner_stack, facts)
|
|
84
|
+
owner_name = owner_name_for(scope, owner_stack)
|
|
85
|
+
nested_stack = owner_name ? [owner_name] : owner_stack
|
|
86
|
+
add_module_function_facts(facts, owner_name, scope) if owner_name
|
|
87
|
+
add_scope_tree_facts(scope.body, nested_stack, facts)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def add_module_function_facts(facts, owner_name, scope)
|
|
91
|
+
names = explicit_module_function_names(scope) + default_module_function_names(scope)
|
|
92
|
+
facts[owner_name] = Array(facts[owner_name]) | names unless names.empty?
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def owner_name_for(scope, owner_stack)
|
|
96
|
+
name = scope.identifier.const_name if scope.identifier&.const_type?
|
|
97
|
+
return unless name
|
|
98
|
+
return name if name.include?("::") || owner_stack.empty?
|
|
99
|
+
|
|
100
|
+
"#{owner_stack.last}::#{name}"
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def explicit_module_function_names(scope)
|
|
104
|
+
module_function_sends(scope).flat_map { |node| literal_names(node.arguments) }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def default_module_function_names(scope)
|
|
108
|
+
lines = bare_module_function_lines(scope)
|
|
109
|
+
direct_defs(scope).select { |node| lines.any? { |line| line < node.loc.keyword.line } }
|
|
110
|
+
.map { |node| node.method_name.to_s }
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def bare_module_function_lines(scope)
|
|
114
|
+
module_function_sends(scope).select { |node| node.arguments.empty? }
|
|
115
|
+
.map { |node| node.loc.selector.line }
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def module_function_sends(scope)
|
|
119
|
+
direct_descendants(scope, :send).select do |node|
|
|
120
|
+
!node.receiver && node.method_name == :module_function
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def direct_defs(scope)
|
|
125
|
+
direct_descendants(scope, :def)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def literal_names(arguments)
|
|
129
|
+
arguments.filter_map { |argument| literal_name(argument) }
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def literal_name(argument)
|
|
133
|
+
argument.value.to_s if argument&.sym_type? || argument&.str_type?
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def direct_descendants(scope, *types)
|
|
137
|
+
scope.each_descendant(*types).reject { |node| nested_scope_between?(node, scope) }
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def nested_scope_between?(node, scope)
|
|
141
|
+
node.each_ancestor.any? do |ancestor|
|
|
142
|
+
break false if ancestor.equal?(scope)
|
|
143
|
+
|
|
144
|
+
scope_node?(ancestor)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def scope_node?(node)
|
|
149
|
+
node&.class_type? || node&.module_type?
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
end
|
|
@@ -28,7 +28,8 @@ module MetzScan
|
|
|
28
28
|
require "rubydex"
|
|
29
29
|
|
|
30
30
|
files = ruby_files_for(paths)
|
|
31
|
-
|
|
31
|
+
# 0.4.0: Config owns workspace_path; Graph.new no longer takes it (Shopify/rubydex#965).
|
|
32
|
+
graph = Rubydex::Graph.configure_for_workspace(workspace_path_for(paths))
|
|
32
33
|
index_errors = index_graph(graph, files, workspace)
|
|
33
34
|
|
|
34
35
|
new(graph: graph, indexed_files: files, index_errors: index_errors)
|
|
@@ -8,7 +8,7 @@ module MetzScan
|
|
|
8
8
|
class ProjectIndex
|
|
9
9
|
Declaration = Struct.new(:name, :path, :kind, keyword_init: true)
|
|
10
10
|
MethodDeclaration = Struct.new(:name, :owner_name, :method_name, :signature, :path, :line, :column,
|
|
11
|
-
:receiver_kind, :method_identity, keyword_init: true)
|
|
11
|
+
:receiver_kind, :method_identity, :visibility, keyword_init: true)
|
|
12
12
|
Reference = Struct.new(:name, :path, :line, :column, keyword_init: true)
|
|
13
13
|
|
|
14
14
|
class UnknownBackendError < StandardError; end
|
data/lib/metz_scan/version.rb
CHANGED
data/metz-scan.gemspec
CHANGED
|
@@ -15,27 +15,35 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.homepage = "https://github.com/fuentesjr/metz-scan"
|
|
16
16
|
spec.license = "MIT"
|
|
17
17
|
|
|
18
|
-
spec.required_ruby_version = ">=
|
|
18
|
+
spec.required_ruby_version = ">= 4.0"
|
|
19
19
|
|
|
20
20
|
spec.metadata["source_code_uri"] = spec.homepage
|
|
21
|
+
spec.metadata["documentation_uri"] = "#{spec.homepage}/blob/main/README.md"
|
|
21
22
|
spec.metadata["changelog_uri"] = "#{spec.homepage}/releases"
|
|
22
23
|
spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
|
|
23
24
|
spec.metadata["github_repo"] = "ssh://github.com/fuentesjr/metz-scan"
|
|
24
25
|
spec.metadata["github_package_uri"] = "https://github.com/users/fuentesjr/packages/rubygems/package/metz-scan"
|
|
26
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
# Resolve files from the gemspec directory so evaluation is CWD-independent.
|
|
29
|
+
# Do not raise when the entrypoint is absent: Dependabot evaluates gemspecs in
|
|
30
|
+
# a sparse tree that only materializes require_relative targets (#41). Package
|
|
31
|
+
# completeness is checked by release_metadata_test against the full checkout.
|
|
32
|
+
gem_root = __dir__
|
|
33
|
+
spec.files = Dir.glob("lib/**/*", File::FNM_DOTMATCH, base: gem_root)
|
|
34
|
+
.reject { |f| File.directory?(File.join(gem_root, f)) } +
|
|
35
|
+
Dir.glob("bin/metz-scan", base: gem_root)
|
|
36
|
+
.select { |f| File.file?(File.join(gem_root, f)) } +
|
|
37
|
+
["LICENSE", "metz-scan.gemspec"].select { |f| File.exist?(File.join(gem_root, f)) }
|
|
36
38
|
spec.bindir = "bin"
|
|
37
39
|
spec.executables = ["metz-scan"]
|
|
38
40
|
spec.require_paths = ["lib"]
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
# The requirement is not the add_dependency argument. Dependabot's
|
|
43
|
+
# GemspecSanitizer replaces a call argument that interpolates a VERSION
|
|
44
|
+
# constant with a bare version, and Gem::Requirement.parse reads a bare
|
|
45
|
+
# version as "=". That drifts the lockfile PATH entry and a frozen install
|
|
46
|
+
# exits 16.
|
|
47
|
+
rubocop_metz_requirement = "~> #{MetzScan::VERSION}"
|
|
48
|
+
spec.add_dependency "rubocop-metz", rubocop_metz_requirement
|
|
41
49
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metz-scan
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Salvador Fuentes Jr
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.7.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.7.0
|
|
26
26
|
description: metz-scan is the user-facing CLI for the Sandi-Metz-inspired code-quality
|
|
27
27
|
toolchain. It runs RuboCop with the rubocop-metz plugin and renders developer-friendly
|
|
28
28
|
reports.
|
|
@@ -89,15 +89,15 @@ files:
|
|
|
89
89
|
- lib/metz_scan/analyzers/subclass_override_pressure/metadata.rb
|
|
90
90
|
- lib/metz_scan/analyzers/subclass_override_pressure/method_body_facts.rb
|
|
91
91
|
- lib/metz_scan/analyzers/subclass_override_pressure/triage.rb
|
|
92
|
-
- lib/metz_scan/
|
|
93
|
-
- lib/metz_scan/
|
|
94
|
-
- lib/metz_scan/
|
|
95
|
-
- lib/metz_scan/
|
|
96
|
-
- lib/metz_scan/
|
|
97
|
-
- lib/metz_scan/
|
|
98
|
-
- lib/metz_scan/
|
|
99
|
-
- lib/metz_scan/
|
|
100
|
-
- lib/metz_scan/
|
|
92
|
+
- lib/metz_scan/analyzers/test_calls_private_method.rb
|
|
93
|
+
- lib/metz_scan/analyzers/test_calls_private_method/call_site_collector.rb
|
|
94
|
+
- lib/metz_scan/analyzers/test_calls_private_method/finding.rb
|
|
95
|
+
- lib/metz_scan/analyzers/test_calls_private_method/metadata.rb
|
|
96
|
+
- lib/metz_scan/analyzers/test_calls_private_method/node_predicates.rb
|
|
97
|
+
- lib/metz_scan/analyzers/test_calls_private_method/receiver_resolution.rb
|
|
98
|
+
- lib/metz_scan/analyzers/test_calls_private_method/scope_facts.rb
|
|
99
|
+
- lib/metz_scan/analyzers/test_calls_private_method/scope_resolution.rb
|
|
100
|
+
- lib/metz_scan/analyzers/test_calls_private_method/triage.rb
|
|
101
101
|
- lib/metz_scan/cli.rb
|
|
102
102
|
- lib/metz_scan/commands/explain.rb
|
|
103
103
|
- lib/metz_scan/commands/project_analyzers.rb
|
|
@@ -105,9 +105,21 @@ files:
|
|
|
105
105
|
- lib/metz_scan/commands/rules.rb
|
|
106
106
|
- lib/metz_scan/commands/scan.rb
|
|
107
107
|
- lib/metz_scan/commands/scan/auto_fix.rb
|
|
108
|
+
- lib/metz_scan/commands/scan/check_failure.rb
|
|
108
109
|
- lib/metz_scan/commands/scan/compliance_scorecard.rb
|
|
110
|
+
- lib/metz_scan/commands/scan/config_disables.rb
|
|
111
|
+
- lib/metz_scan/commands/scan/config_exclusions.rb
|
|
112
|
+
- lib/metz_scan/commands/scan/exclude_entries.rb
|
|
113
|
+
- lib/metz_scan/commands/scan/exclude_entry_locator.rb
|
|
114
|
+
- lib/metz_scan/commands/scan/exclude_provenance.rb
|
|
115
|
+
- lib/metz_scan/commands/scan/execution_config_store.rb
|
|
109
116
|
- lib/metz_scan/commands/scan/github_annotations_renderer.rb
|
|
117
|
+
- lib/metz_scan/commands/scan/ignored_cli_options_note.rb
|
|
118
|
+
- lib/metz_scan/commands/scan/inherited_include_rewriter.rb
|
|
119
|
+
- lib/metz_scan/commands/scan/inline_directive_locator.rb
|
|
120
|
+
- lib/metz_scan/commands/scan/json_guidance.rb
|
|
110
121
|
- lib/metz_scan/commands/scan/offense_extractor.rb
|
|
122
|
+
- lib/metz_scan/commands/scan/path_scoped_include_note.rb
|
|
111
123
|
- lib/metz_scan/commands/scan/project_analyzer_breakdown.rb
|
|
112
124
|
- lib/metz_scan/commands/scan/project_analyzer_metadata.rb
|
|
113
125
|
- lib/metz_scan/commands/scan/project_analyzer_offenses.rb
|
|
@@ -117,10 +129,14 @@ files:
|
|
|
117
129
|
- lib/metz_scan/commands/scan/project_analyzer_triage_formatter.rb
|
|
118
130
|
- lib/metz_scan/commands/scan/project_analyzer_triage_priority.rb
|
|
119
131
|
- lib/metz_scan/commands/scan/project_config_scope.rb
|
|
132
|
+
- lib/metz_scan/commands/scan/rubocop_failure.rb
|
|
133
|
+
- lib/metz_scan/commands/scan/rubocop_invocation.rb
|
|
120
134
|
- lib/metz_scan/commands/scan/runner.rb
|
|
121
135
|
- lib/metz_scan/commands/scan/sarif_renderer.rb
|
|
122
136
|
- lib/metz_scan/commands/scan/sarif_rule_descriptors.rb
|
|
123
137
|
- lib/metz_scan/commands/scan/sarif_severity.rb
|
|
138
|
+
- lib/metz_scan/commands/scan/suppression_ledger.rb
|
|
139
|
+
- lib/metz_scan/commands/scan/suppression_ledger_formatter.rb
|
|
124
140
|
- lib/metz_scan/commands/scan/target_ruby_version.rb
|
|
125
141
|
- lib/metz_scan/commands/scan/text_renderer.rb
|
|
126
142
|
- lib/metz_scan/project_index.rb
|
|
@@ -129,6 +145,7 @@ files:
|
|
|
129
145
|
- lib/metz_scan/project_index/rubydex_backend/file_discovery.rb
|
|
130
146
|
- lib/metz_scan/project_index/rubydex_backend/location_formatting.rb
|
|
131
147
|
- lib/metz_scan/project_index/rubydex_backend/method_declarations.rb
|
|
148
|
+
- lib/metz_scan/project_index/rubydex_backend/method_visibility.rb
|
|
132
149
|
- lib/metz_scan/version.rb
|
|
133
150
|
- metz-scan.gemspec
|
|
134
151
|
homepage: https://github.com/fuentesjr/metz-scan
|
|
@@ -136,10 +153,12 @@ licenses:
|
|
|
136
153
|
- MIT
|
|
137
154
|
metadata:
|
|
138
155
|
source_code_uri: https://github.com/fuentesjr/metz-scan
|
|
156
|
+
documentation_uri: https://github.com/fuentesjr/metz-scan/blob/main/README.md
|
|
139
157
|
changelog_uri: https://github.com/fuentesjr/metz-scan/releases
|
|
140
158
|
bug_tracker_uri: https://github.com/fuentesjr/metz-scan/issues
|
|
141
159
|
github_repo: ssh://github.com/fuentesjr/metz-scan
|
|
142
160
|
github_package_uri: https://github.com/users/fuentesjr/packages/rubygems/package/metz-scan
|
|
161
|
+
rubygems_mfa_required: 'true'
|
|
143
162
|
rdoc_options: []
|
|
144
163
|
require_paths:
|
|
145
164
|
- lib
|
|
@@ -147,14 +166,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
147
166
|
requirements:
|
|
148
167
|
- - ">="
|
|
149
168
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: '
|
|
169
|
+
version: '4.0'
|
|
151
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
171
|
requirements:
|
|
153
172
|
- - ">="
|
|
154
173
|
- !ruby/object:Gem::Version
|
|
155
174
|
version: '0'
|
|
156
175
|
requirements: []
|
|
157
|
-
rubygems_version: 4.0.
|
|
176
|
+
rubygems_version: 4.0.20
|
|
158
177
|
specification_version: 4
|
|
159
178
|
summary: Sandi-Metz-inspired CLI wrapper around RuboCop.
|
|
160
179
|
test_files: []
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "fileutils"
|
|
4
|
-
require "json"
|
|
5
|
-
require "time"
|
|
6
|
-
|
|
7
|
-
module MetzScan
|
|
8
|
-
module Calibration
|
|
9
|
-
module ProjectAnalyzerEvidenceRunner
|
|
10
|
-
class ArtifactWriter
|
|
11
|
-
def initialize(summary:, output_dir:, run_id:)
|
|
12
|
-
@summary = summary
|
|
13
|
-
@output_dir = output_dir
|
|
14
|
-
@run_id = run_id || "project-analyzer-evidence-#{Time.now.utc.strftime('%Y%m%d-%H%M%S')}"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def call
|
|
18
|
-
FileUtils.mkdir_p(run_dir)
|
|
19
|
-
write_json
|
|
20
|
-
write_markdown
|
|
21
|
-
artifacts
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
attr_reader :summary, :output_dir, :run_id
|
|
27
|
-
|
|
28
|
-
def write_json
|
|
29
|
-
File.write(artifacts.fetch("json"), "#{JSON.pretty_generate(persisted_summary)}\n")
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def write_markdown
|
|
33
|
-
File.write(artifacts.fetch("markdown"), MarkdownRenderer.new(persisted_summary).call)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def persisted_summary
|
|
37
|
-
summary.merge("artifacts" => artifacts)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def artifacts
|
|
41
|
-
{ "directory" => run_dir, "json" => File.join(run_dir, "summary.json"),
|
|
42
|
-
"markdown" => File.join(run_dir, "summary.md") }
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def run_dir
|
|
46
|
-
File.join(File.expand_path(output_dir), run_id)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|