-
Notifications
You must be signed in to change notification settings - Fork 24
/
main.rb
44 lines (37 loc) · 994 Bytes
/
main.rb
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
# frozen_string_literal: true
require "flay"
require "json"
require "cc/engine/analyzers/reporter"
require "cc/engine/analyzers/analyzer_base"
module CC
module Engine
module Analyzers
module Go
class Main < CC::Engine::Analyzers::Base
LANGUAGE = "go"
PATTERNS = ["**/*.go"].freeze
DEFAULT_MASS_THRESHOLD = 100
DEFAULT_FILTERS = [
"(GenDecl _ (specs (ImportSpec ___)) _)",
"(comments ___)",
].freeze
POINTS_PER_OVERAGE = 10_000
REQUEST_PATH = "/go"
def transform_sexp(sexp)
sexp.delete_if { |node| node[0] == :name }
end
def use_sexp_lines?
false
end
private
def process_file(file)
parse(file, REQUEST_PATH)
end
def default_filters
DEFAULT_FILTERS.map { |filter| Sexp::Matcher.parse filter }
end
end
end
end
end
end