churn_vs_complexity 1.8.0 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +95 -0
- data/README.md +46 -23
- data/bin/churn_vs_complexity +6 -1
- data/lib/churn_vs_complexity/analysis_scope.rb +20 -0
- data/lib/churn_vs_complexity/churn.rb +41 -8
- data/lib/churn_vs_complexity/cli/main.rb +58 -19
- data/lib/churn_vs_complexity/cli/parser.rb +85 -121
- data/lib/churn_vs_complexity/cli.rb +2 -3
- data/lib/churn_vs_complexity/complexity/flog_calculator.rb +0 -3
- data/lib/churn_vs_complexity/complexity/lizard_calculator.rb +64 -0
- data/lib/churn_vs_complexity/complexity.rb +1 -7
- data/lib/churn_vs_complexity/complexity_validator.rb +1 -16
- data/lib/churn_vs_complexity/concurrent_calculator.rb +20 -23
- data/lib/churn_vs_complexity/delta/checker.rb +35 -21
- data/lib/churn_vs_complexity/delta/commit_hydrator.rb +1 -1
- data/lib/churn_vs_complexity/delta/complexity_annotator.rb +23 -5
- data/lib/churn_vs_complexity/delta/config.rb +15 -16
- data/lib/churn_vs_complexity/delta/factory.rb +2 -2
- data/lib/churn_vs_complexity/delta/multi_checker.rb +24 -25
- data/lib/churn_vs_complexity/delta/serializer.rb +7 -4
- data/lib/churn_vs_complexity/delta.rb +11 -49
- data/lib/churn_vs_complexity/diff/checker.rb +10 -3
- data/lib/churn_vs_complexity/diff/config.rb +29 -20
- data/lib/churn_vs_complexity/file_selector.rb +63 -114
- data/lib/churn_vs_complexity/focus/config.rb +42 -32
- data/lib/churn_vs_complexity/focus/serializer.rb +17 -4
- data/lib/churn_vs_complexity/gate/config.rb +35 -25
- data/lib/churn_vs_complexity/gate/serializer.rb +9 -2
- data/lib/churn_vs_complexity/git_strategy.rb +29 -10
- data/lib/churn_vs_complexity/hotspots/config.rb +29 -25
- data/lib/churn_vs_complexity/language_registry.rb +108 -0
- data/lib/churn_vs_complexity/language_validator.rb +1 -3
- data/lib/churn_vs_complexity/normal/config.rb +31 -100
- data/lib/churn_vs_complexity/normal/serializer/graph.rb +3 -2
- data/lib/churn_vs_complexity/normal/serializer/summary.rb +18 -14
- data/lib/churn_vs_complexity/normal/serializer/summary_hash.rb +36 -21
- data/lib/churn_vs_complexity/normal/serializer.rb +2 -1
- data/lib/churn_vs_complexity/normal.rb +17 -13
- data/lib/churn_vs_complexity/risk_classifier.rb +3 -19
- data/lib/churn_vs_complexity/timetravel/config.rb +34 -47
- data/lib/churn_vs_complexity/timetravel/schedule.rb +15 -0
- data/lib/churn_vs_complexity/timetravel/serializer/stats_calculator.rb +36 -32
- data/lib/churn_vs_complexity/timetravel/serializer.rb +16 -24
- data/lib/churn_vs_complexity/timetravel/traveller.rb +46 -15
- data/lib/churn_vs_complexity/timetravel.rb +36 -14
- data/lib/churn_vs_complexity/triage/checker.rb +24 -28
- data/lib/churn_vs_complexity/triage/collaborator_set.rb +11 -0
- data/lib/churn_vs_complexity/triage/config.rb +29 -26
- data/lib/churn_vs_complexity/triage.rb +1 -0
- data/lib/churn_vs_complexity/validator_set.rb +9 -0
- data/lib/churn_vs_complexity/version.rb +1 -1
- data/lib/churn_vs_complexity.rb +3 -0
- metadata +18 -59
- data/.devcontainer/devcontainer.json +0 -26
- data/.rubocop.yml +0 -25
- data/CLAUDE.md +0 -60
- data/Dockerfile +0 -34
- data/Dockerfile.dev +0 -27
- data/Rakefile +0 -6
- data/TODO +0 -11
- data/lib/churn_vs_complexity/complexity/eslint_calculator.rb +0 -40
- data/lib/churn_vs_complexity/complexity/go_calculator.rb +0 -48
- data/lib/churn_vs_complexity/complexity/kotlin_calculator.rb +0 -54
- data/lib/churn_vs_complexity/complexity/pmd/files_calculator.rb +0 -26
- data/lib/churn_vs_complexity/complexity/pmd/folder_calculator.rb +0 -20
- data/lib/churn_vs_complexity/complexity/pmd.rb +0 -54
- data/lib/churn_vs_complexity/complexity/python_calculator.rb +0 -50
- data/lib/churn_vs_complexity/complexity/rust_calculator.rb +0 -54
- data/lib/churn_vs_complexity/complexity/swift_calculator.rb +0 -54
- data/package-lock.json +0 -6
- data/tmp/eslint-support/complexity-calculator.js +0 -51
- data/tmp/eslint-support/package.json +0 -11
- data/tmp/pmd-support/ruleset.xml +0 -21
- data/tmp/test-support/delta/ruby-summary.txt +0 -55
- data/tmp/test-support/delta/ruby.csv +0 -12
- data/tmp/test-support/go/main.go +0 -11
- data/tmp/test-support/go/utils.go +0 -13
- data/tmp/test-support/java/small-example/src/main/java/org/example/Main.java +0 -10
- data/tmp/test-support/java/small-example/src/main/java/org/example/spice/Checker.java +0 -28
- data/tmp/test-support/javascript/complex.js +0 -43
- data/tmp/test-support/javascript/moderate.js +0 -12
- data/tmp/test-support/javascript/simple.js +0 -5
- data/tmp/test-support/javascript/typescript-example.ts +0 -26
- data/tmp/test-support/kotlin/Main.kt +0 -7
- data/tmp/test-support/kotlin/Utils.kt +0 -11
- data/tmp/test-support/python/example.py +0 -6
- data/tmp/test-support/python/utils.py +0 -9
- data/tmp/test-support/rust/main.rs +0 -7
- data/tmp/test-support/rust/utils.rs +0 -20
- data/tmp/test-support/swift/main.swift +0 -7
- data/tmp/test-support/swift/utils.swift +0 -24
- data/tmp/test-support/txt/abc.txt +0 -0
- data/tmp/test-support/txt/d.txt +0 -0
- data/tmp/test-support/txt/ef.txt +0 -0
- data/tmp/test-support/txt/ghij.txt +0 -0
- data/tmp/test-support/txt/klm.txt +0 -0
- data/tmp/test-support/txt/nopq.txt +0 -0
- data/tmp/test-support/txt/r.txt +0 -0
- data/tmp/test-support/txt/st.txt +0 -0
- data/tmp/test-support/txt/uvx.txt +0 -0
- data/tmp/test-support/txt/yz.txt +0 -0
- data/tmp/timetravel/.keep +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'pmd/folder_calculator'
|
|
4
|
-
require_relative 'pmd/files_calculator'
|
|
5
|
-
|
|
6
|
-
module ChurnVsComplexity
|
|
7
|
-
module Complexity
|
|
8
|
-
module PMD
|
|
9
|
-
CONCURRENCY = Etc.nprocessors
|
|
10
|
-
|
|
11
|
-
class << self
|
|
12
|
-
def resolve_ruleset_path
|
|
13
|
-
ruleset_path = File.join(gem_root, 'tmp', 'pmd-support', 'ruleset.xml')
|
|
14
|
-
raise "ruleset.xml not found in #{ruleset_path}" unless File.exist?(ruleset_path)
|
|
15
|
-
|
|
16
|
-
ruleset_path
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def resolve_cache_path(*components)
|
|
20
|
-
File.join(ChurnVsComplexity.tmp_dir_path(*components), 'pmd', 'pmd-cache')
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def check_dependencies!
|
|
24
|
-
`pmd --help`
|
|
25
|
-
rescue StandardError
|
|
26
|
-
raise Error, 'Could not execute PMD using command pmd'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
def gem_root = ROOT_PATH
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
class Parser
|
|
35
|
-
def self.empty_result = {}
|
|
36
|
-
|
|
37
|
-
def parse(output)
|
|
38
|
-
doc = JSON.parse(output)
|
|
39
|
-
doc['files'].each_with_object({}) do |file, result|
|
|
40
|
-
result[file['filename']] =
|
|
41
|
-
file['violations'].sum { |violation| extract_complexity(violation) }
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
private
|
|
46
|
-
|
|
47
|
-
def extract_complexity(violation)
|
|
48
|
-
# Find text 'total cyclomatic complexity of <number>'
|
|
49
|
-
violation['description'].match(/total cyclomatic complexity of (\d+)/)[1].to_i
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'json'
|
|
4
|
-
require 'open3'
|
|
5
|
-
|
|
6
|
-
module ChurnVsComplexity
|
|
7
|
-
module Complexity
|
|
8
|
-
module PythonCalculator
|
|
9
|
-
class << self
|
|
10
|
-
attr_writer :command_runner
|
|
11
|
-
|
|
12
|
-
def folder_based? = false
|
|
13
|
-
|
|
14
|
-
def calculate(files:)
|
|
15
|
-
json_output = run_radon(files)
|
|
16
|
-
parse_radon_output(json_output, files:)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def parse_radon_output(json_output, files:)
|
|
20
|
-
data = JSON.parse(json_output)
|
|
21
|
-
files.to_h do |file|
|
|
22
|
-
blocks = data[file] || []
|
|
23
|
-
total = blocks.sum { |b| b['complexity'] }
|
|
24
|
-
[file, total]
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def check_dependencies!
|
|
29
|
-
command_runner.call('radon --version 2>&1')
|
|
30
|
-
rescue Errno::ENOENT
|
|
31
|
-
raise Error, 'Needs radon installed (pip install radon)'
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
private
|
|
35
|
-
|
|
36
|
-
def command_runner
|
|
37
|
-
@command_runner || Open3.method(:capture2)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def run_radon(files)
|
|
41
|
-
files_arg = files.map { |f| "'#{f}'" }.join(' ')
|
|
42
|
-
stdout, status = command_runner.call("radon cc #{files_arg} -j")
|
|
43
|
-
raise Error, "radon failed (exit #{status.exitstatus}). Is it installed?" unless status.success?
|
|
44
|
-
|
|
45
|
-
stdout
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'open3'
|
|
4
|
-
|
|
5
|
-
module ChurnVsComplexity
|
|
6
|
-
module Complexity
|
|
7
|
-
module RustCalculator
|
|
8
|
-
class << self
|
|
9
|
-
attr_writer :command_runner
|
|
10
|
-
|
|
11
|
-
def folder_based? = false
|
|
12
|
-
|
|
13
|
-
def calculate(files:)
|
|
14
|
-
csv_output = run_lizard(files)
|
|
15
|
-
parse_lizard_output(csv_output, files:)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Lizard CSV format: NLOC,CCN,tokens,params,length,"loc","file","func","long_func",start,end
|
|
19
|
-
LIZARD_LINE_PATTERN = /^\d+,(\d+),\d+,\d+,\d+,"[^"]*","([^"]*)"/
|
|
20
|
-
|
|
21
|
-
def parse_lizard_output(csv_output, files:)
|
|
22
|
-
scores = Hash.new(0)
|
|
23
|
-
csv_output.each_line do |line|
|
|
24
|
-
match = line.match(LIZARD_LINE_PATTERN)
|
|
25
|
-
next unless match
|
|
26
|
-
|
|
27
|
-
scores[match[2]] += match[1].to_i
|
|
28
|
-
end
|
|
29
|
-
files.to_h { |file| [file, scores[file] || 0] }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def check_dependencies!
|
|
33
|
-
command_runner.call('lizard --version 2>&1')
|
|
34
|
-
rescue Errno::ENOENT
|
|
35
|
-
raise Error, 'Needs lizard installed (pip install lizard)'
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def command_runner
|
|
41
|
-
@command_runner || Open3.method(:capture2)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def run_lizard(files)
|
|
45
|
-
files_arg = files.map { |f| "'#{f}'" }.join(' ')
|
|
46
|
-
stdout, status = command_runner.call("lizard --csv #{files_arg}")
|
|
47
|
-
raise Error, "lizard failed (exit #{status.exitstatus}). Is it installed?" unless status.success?
|
|
48
|
-
|
|
49
|
-
stdout
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'open3'
|
|
4
|
-
|
|
5
|
-
module ChurnVsComplexity
|
|
6
|
-
module Complexity
|
|
7
|
-
module SwiftCalculator
|
|
8
|
-
class << self
|
|
9
|
-
attr_writer :command_runner
|
|
10
|
-
|
|
11
|
-
def folder_based? = false
|
|
12
|
-
|
|
13
|
-
def calculate(files:)
|
|
14
|
-
csv_output = run_lizard(files)
|
|
15
|
-
parse_lizard_output(csv_output, files:)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Lizard CSV format: NLOC,CCN,tokens,params,length,"loc","file","func","long_func",start,end
|
|
19
|
-
LIZARD_LINE_PATTERN = /^\d+,(\d+),\d+,\d+,\d+,"[^"]*","([^"]*)"/
|
|
20
|
-
|
|
21
|
-
def parse_lizard_output(csv_output, files:)
|
|
22
|
-
scores = Hash.new(0)
|
|
23
|
-
csv_output.each_line do |line|
|
|
24
|
-
match = line.match(LIZARD_LINE_PATTERN)
|
|
25
|
-
next unless match
|
|
26
|
-
|
|
27
|
-
scores[match[2]] += match[1].to_i
|
|
28
|
-
end
|
|
29
|
-
files.to_h { |file| [file, scores[file] || 0] }
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def check_dependencies!
|
|
33
|
-
command_runner.call('lizard --version 2>&1')
|
|
34
|
-
rescue Errno::ENOENT
|
|
35
|
-
raise Error, 'Needs lizard installed (pip install lizard)'
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def command_runner
|
|
41
|
-
@command_runner || Open3.method(:capture2)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def run_lizard(files)
|
|
45
|
-
files_arg = files.map { |f| "'#{f}'" }.join(' ')
|
|
46
|
-
stdout, status = command_runner.call("lizard --csv #{files_arg}")
|
|
47
|
-
raise Error, "lizard failed (exit #{status.exitstatus}). Is it installed?" unless status.success?
|
|
48
|
-
|
|
49
|
-
stdout
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
data/package-lock.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ESLint } from 'eslint';
|
|
2
|
-
|
|
3
|
-
import eslint from '@eslint/js';
|
|
4
|
-
import tseslint from 'typescript-eslint';
|
|
5
|
-
|
|
6
|
-
async function analyzeComplexity(files) {
|
|
7
|
-
const overrideConfig = tseslint.config(
|
|
8
|
-
eslint.configs.recommended,
|
|
9
|
-
...tseslint.configs.recommended,
|
|
10
|
-
{
|
|
11
|
-
rules: {
|
|
12
|
-
'complexity': ['warn', 0],
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const linter = new ESLint({
|
|
19
|
-
overrideConfigFile: true,
|
|
20
|
-
overrideConfig,
|
|
21
|
-
cwd: '/',
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
const results = await linter.lintFiles(files);
|
|
26
|
-
const complexityResults = results.map(result => {
|
|
27
|
-
const messages = result.messages.filter(msg => msg.ruleId === 'complexity');
|
|
28
|
-
const complexity = messages.reduce((sum, msg) => {
|
|
29
|
-
const complexityValue = parseInt(msg.message.match(/\d+/)[0], 10);
|
|
30
|
-
return sum + complexityValue;
|
|
31
|
-
}, 0);
|
|
32
|
-
|
|
33
|
-
if (complexity === 0) {
|
|
34
|
-
console.error("File has no complexity", result);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
file: result.filePath,
|
|
39
|
-
complexity,
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
console.log(JSON.stringify(complexityResults));
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error('Error during analysis:', error);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const files = JSON.parse(process.argv[2]);
|
|
51
|
-
analyzeComplexity(files);
|
data/tmp/pmd-support/ruleset.xml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0"?>
|
|
2
|
-
|
|
3
|
-
<ruleset name="Rules for churn vs complexity"
|
|
4
|
-
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
|
|
5
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
6
|
-
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
|
|
7
|
-
|
|
8
|
-
<description>
|
|
9
|
-
Find cyclomatic complexity in java files
|
|
10
|
-
</description>
|
|
11
|
-
|
|
12
|
-
<rule ref="category/java/design.xml/CyclomaticComplexity">
|
|
13
|
-
<properties>
|
|
14
|
-
<property name="classReportLevel" value="1"/>
|
|
15
|
-
<!-- We only want one report pr class -->
|
|
16
|
-
<property name="methodReportLevel" value="1000000"/>
|
|
17
|
-
<property name="cycloOptions" value=""/>
|
|
18
|
-
</properties>
|
|
19
|
-
</rule>
|
|
20
|
-
|
|
21
|
-
</ruleset>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
Commit: b20a9bddd04afb9c7a736cf4530fd3188b5f785e
|
|
2
|
-
Parent: 4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0
|
|
3
|
-
Next: 8cdaac516365bd7007b9f755bbe6f6e86d8e13dd
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
File, relative path: lib/churn_vs_complexity/serializer/timetravel.rb
|
|
7
|
-
Type of change: modified
|
|
8
|
-
Complexity: 58.34326171010786
|
|
9
|
-
|
|
10
|
-
File, relative path: lib/churn_vs_complexity/serializer/timetravel/stats_calculator.rb
|
|
11
|
-
Type of change: new
|
|
12
|
-
Complexity: 80.35549194682164
|
|
13
|
-
|
|
14
|
-
File, relative path: test/churn_vs_complexity/serializer/timetravel/quality_calculator_test.rb
|
|
15
|
-
Type of change: modified
|
|
16
|
-
Complexity: 13.054183368177016
|
|
17
|
-
|
|
18
|
-
File, relative path: test/churn_vs_complexity/serializer/timetravel/stats_calculator_test.rb
|
|
19
|
-
Type of change: new
|
|
20
|
-
Complexity: 12.2198021565134
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Commit: 4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0
|
|
25
|
-
Parent: 83deeccf8aa40e46cd0ca7e2c603c9726633256e
|
|
26
|
-
Next: b20a9bddd04afb9c7a736cf4530fd3188b5f785e
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
File, relative path: lib/churn_vs_complexity/config.rb
|
|
30
|
-
Type of change: modified
|
|
31
|
-
Complexity: 70.26655854867414
|
|
32
|
-
|
|
33
|
-
File, relative path: lib/churn_vs_complexity/serializer/pass_through.rb
|
|
34
|
-
Type of change: new
|
|
35
|
-
Complexity: 19.309088021254183
|
|
36
|
-
|
|
37
|
-
File, relative path: lib/churn_vs_complexity/serializer/summary_hash.rb
|
|
38
|
-
Type of change: modified
|
|
39
|
-
Complexity: 89.25682464940157
|
|
40
|
-
|
|
41
|
-
File, relative path: lib/churn_vs_complexity/serializer/timetravel.rb
|
|
42
|
-
Type of change: modified
|
|
43
|
-
Complexity: 131.0989019732436
|
|
44
|
-
|
|
45
|
-
File, relative path: lib/churn_vs_complexity/serializer/timetravel/quality_calculator.rb
|
|
46
|
-
Type of change: new
|
|
47
|
-
Complexity: 23.324498016752965
|
|
48
|
-
|
|
49
|
-
File, relative path: test/churn_vs_complexity/serializer/summary_hash_test.rb
|
|
50
|
-
Type of change: modified
|
|
51
|
-
Complexity: 14.396336540125482
|
|
52
|
-
|
|
53
|
-
File, relative path: test/churn_vs_complexity/serializer/timetravel/quality_calculator_test.rb
|
|
54
|
-
Type of change: new
|
|
55
|
-
Complexity: 13.054183368177016
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Commit, Relative Path, Type of Change, Complexity
|
|
2
|
-
b20a9bddd04afb9c7a736cf4530fd3188b5f785e, lib/churn_vs_complexity/serializer/timetravel.rb, modified, 58.34326171010786
|
|
3
|
-
b20a9bddd04afb9c7a736cf4530fd3188b5f785e, lib/churn_vs_complexity/serializer/timetravel/stats_calculator.rb, new, 80.35549194682164
|
|
4
|
-
b20a9bddd04afb9c7a736cf4530fd3188b5f785e, test/churn_vs_complexity/serializer/timetravel/quality_calculator_test.rb, modified, 13.054183368177016
|
|
5
|
-
b20a9bddd04afb9c7a736cf4530fd3188b5f785e, test/churn_vs_complexity/serializer/timetravel/stats_calculator_test.rb, new, 12.2198021565134
|
|
6
|
-
4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0, lib/churn_vs_complexity/config.rb, modified, 70.26655854867414
|
|
7
|
-
4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0, lib/churn_vs_complexity/serializer/pass_through.rb, new, 19.309088021254183
|
|
8
|
-
4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0, lib/churn_vs_complexity/serializer/summary_hash.rb, modified, 89.25682464940157
|
|
9
|
-
4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0, lib/churn_vs_complexity/serializer/timetravel.rb, modified, 131.0989019732436
|
|
10
|
-
4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0, lib/churn_vs_complexity/serializer/timetravel/quality_calculator.rb, new, 23.324498016752965
|
|
11
|
-
4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0, test/churn_vs_complexity/serializer/summary_hash_test.rb, modified, 14.396336540125482
|
|
12
|
-
4f3151f83e982eb8f2b8a4e7a7572a0af156c3c0, test/churn_vs_complexity/serializer/timetravel/quality_calculator_test.rb, new, 13.054183368177016
|
data/tmp/test-support/go/main.go
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package org.example.spice;
|
|
2
|
-
|
|
3
|
-
import java.util.Iterator;
|
|
4
|
-
import java.util.PrimitiveIterator;
|
|
5
|
-
import java.util.Random;
|
|
6
|
-
|
|
7
|
-
public class Checker {
|
|
8
|
-
public void check() {
|
|
9
|
-
for (int j = 0; j < 3; j++) {
|
|
10
|
-
var iter = tenRandomInts();
|
|
11
|
-
while (iter.hasNext()) {
|
|
12
|
-
var i = iter.nextInt();
|
|
13
|
-
if (i < 100) {
|
|
14
|
-
System.out.println("Bongo");
|
|
15
|
-
} else if (i > 200) {
|
|
16
|
-
System.out.println("Dingo");
|
|
17
|
-
} else {
|
|
18
|
-
System.out.println("Zapp");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
private static PrimitiveIterator.OfInt tenRandomInts() {
|
|
25
|
-
var randomInts = new Random().ints();
|
|
26
|
-
return randomInts.limit(10).iterator();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
function analyzeNumber(num) {
|
|
2
|
-
let result = '';
|
|
3
|
-
|
|
4
|
-
if (num < 0) {
|
|
5
|
-
result += 'negative ';
|
|
6
|
-
} else if (num > 0) {
|
|
7
|
-
result += 'positive ';
|
|
8
|
-
} else {
|
|
9
|
-
return 'zero';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (num % 2 === 0) {
|
|
13
|
-
result += 'even ';
|
|
14
|
-
} else {
|
|
15
|
-
result += 'odd ';
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (num % 3 === 0) {
|
|
19
|
-
result += 'divisible by 3 ';
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (num % 5 === 0) {
|
|
23
|
-
result += 'divisible by 5 ';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (isPrime(num)) {
|
|
27
|
-
result += 'prime ';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return result.trim();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function isPrime(num) {
|
|
34
|
-
if (num <= 1) return false;
|
|
35
|
-
for (let i = 2; i <= Math.sqrt(num); i++) {
|
|
36
|
-
if (num % i === 0) return false;
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
console.log(analyzeNumber(17));
|
|
42
|
-
console.log(analyzeNumber(30));
|
|
43
|
-
console.log(analyzeNumber(-7));
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
interface Person {
|
|
2
|
-
name: string;
|
|
3
|
-
age: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
function createGreeting(person: Person): string {
|
|
7
|
-
let greeting = `Hello, ${person.name}!`;
|
|
8
|
-
|
|
9
|
-
if (person.age < 18) {
|
|
10
|
-
greeting += " You're still a minor.";
|
|
11
|
-
} else if (person.age >= 18 && person.age < 65) {
|
|
12
|
-
greeting += " You're an adult.";
|
|
13
|
-
} else {
|
|
14
|
-
greeting += " You're a senior citizen.";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return greeting;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const alice: Person = { name: 'Alice', age: 30 };
|
|
21
|
-
const bob: Person = { name: 'Bob', age: 17 };
|
|
22
|
-
const charlie: Person = { name: 'Charlie', age: 70 };
|
|
23
|
-
|
|
24
|
-
console.log(createGreeting(alice));
|
|
25
|
-
console.log(createGreeting(bob));
|
|
26
|
-
console.log(createGreeting(charlie));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
fn calculate_sum(numbers: &[i32]) -> i32 {
|
|
2
|
-
let mut total = 0;
|
|
3
|
-
for n in numbers {
|
|
4
|
-
total += n;
|
|
5
|
-
}
|
|
6
|
-
total
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
fn classify(value: i32) -> &'static str {
|
|
10
|
-
match value {
|
|
11
|
-
0 => "zero",
|
|
12
|
-
1..=10 => "low",
|
|
13
|
-
11..=100 => "medium",
|
|
14
|
-
_ => "high",
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
fn is_even(n: i32) -> bool {
|
|
19
|
-
n % 2 == 0
|
|
20
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
func calculateSum(_ numbers: [Int]) -> Int {
|
|
2
|
-
var total = 0
|
|
3
|
-
for n in numbers {
|
|
4
|
-
total += n
|
|
5
|
-
}
|
|
6
|
-
return total
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
func classify(_ value: Int) -> String {
|
|
10
|
-
switch value {
|
|
11
|
-
case 0:
|
|
12
|
-
return "zero"
|
|
13
|
-
case 1...10:
|
|
14
|
-
return "low"
|
|
15
|
-
case 11...100:
|
|
16
|
-
return "medium"
|
|
17
|
-
default:
|
|
18
|
-
return "high"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
func isEven(_ n: Int) -> Bool {
|
|
23
|
-
return n % 2 == 0
|
|
24
|
-
}
|
|
File without changes
|
data/tmp/test-support/txt/d.txt
DELETED
|
File without changes
|
data/tmp/test-support/txt/ef.txt
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/tmp/test-support/txt/r.txt
DELETED
|
File without changes
|
data/tmp/test-support/txt/st.txt
DELETED
|
File without changes
|
|
File without changes
|
data/tmp/test-support/txt/yz.txt
DELETED
|
File without changes
|
data/tmp/timetravel/.keep
DELETED
|
File without changes
|