rubycritic-simplecov 4.1.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 +7 -0
- data/CHANGELOG.md +290 -0
- data/CONTRIBUTING.md +93 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +259 -0
- data/ROADMAP.md +56 -0
- data/Rakefile +28 -0
- data/bin/rubycritic +10 -0
- data/lib/rubycritic/analysers/attributes.rb +29 -0
- data/lib/rubycritic/analysers/churn.rb +30 -0
- data/lib/rubycritic/analysers/complexity.rb +30 -0
- data/lib/rubycritic/analysers/coverage.rb +118 -0
- data/lib/rubycritic/analysers/helpers/ast_node.rb +76 -0
- data/lib/rubycritic/analysers/helpers/flay.rb +13 -0
- data/lib/rubycritic/analysers/helpers/flog.rb +17 -0
- data/lib/rubycritic/analysers/helpers/methods_counter.rb +25 -0
- data/lib/rubycritic/analysers/helpers/modules_locator.rb +42 -0
- data/lib/rubycritic/analysers/helpers/parser.rb +14 -0
- data/lib/rubycritic/analysers/helpers/reek.rb +11 -0
- data/lib/rubycritic/analysers/smells/flay.rb +79 -0
- data/lib/rubycritic/analysers/smells/flog.rb +69 -0
- data/lib/rubycritic/analysers/smells/reek.rb +53 -0
- data/lib/rubycritic/analysers_runner.rb +41 -0
- data/lib/rubycritic/analysis_summary.rb +40 -0
- data/lib/rubycritic/browser.rb +19 -0
- data/lib/rubycritic/cli/application.rb +34 -0
- data/lib/rubycritic/cli/options/argv.rb +137 -0
- data/lib/rubycritic/cli/options/file.rb +100 -0
- data/lib/rubycritic/cli/options.rb +33 -0
- data/lib/rubycritic/colorize.rb +17 -0
- data/lib/rubycritic/command_factory.rb +25 -0
- data/lib/rubycritic/commands/base.rb +18 -0
- data/lib/rubycritic/commands/ci.rb +14 -0
- data/lib/rubycritic/commands/compare.rb +106 -0
- data/lib/rubycritic/commands/default.rb +38 -0
- data/lib/rubycritic/commands/help.rb +18 -0
- data/lib/rubycritic/commands/status_reporter.rb +45 -0
- data/lib/rubycritic/commands/utils/build_number_file.rb +37 -0
- data/lib/rubycritic/commands/version.rb +16 -0
- data/lib/rubycritic/configuration.rb +69 -0
- data/lib/rubycritic/core/analysed_module.rb +93 -0
- data/lib/rubycritic/core/analysed_modules_collection.rb +95 -0
- data/lib/rubycritic/core/location.rb +47 -0
- data/lib/rubycritic/core/rating.rb +30 -0
- data/lib/rubycritic/core/smell.rb +84 -0
- data/lib/rubycritic/generators/console_report.rb +20 -0
- data/lib/rubycritic/generators/html/assets/fonts/FontAwesome.otf +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/Roboto-Medium.ttf +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/Roboto-Regular.ttf +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.eot +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.svg +2671 -0
- data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.woff +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.svg +288 -0
- data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/rubycritic/generators/html/assets/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/lib/rubycritic/generators/html/assets/images/logo.png +0 -0
- data/lib/rubycritic/generators/html/assets/javascripts/application.js +281 -0
- data/lib/rubycritic/generators/html/assets/javascripts/bootstrap.min.js +7 -0
- data/lib/rubycritic/generators/html/assets/javascripts/highcharts.src-4.0.1.js +17672 -0
- data/lib/rubycritic/generators/html/assets/javascripts/jquery.filtertable.min.js +13 -0
- data/lib/rubycritic/generators/html/assets/javascripts/jquery.min.js +4 -0
- data/lib/rubycritic/generators/html/assets/javascripts/jquery.scrollTo.min.js +7 -0
- data/lib/rubycritic/generators/html/assets/javascripts/jquery.tablesorter.js +1031 -0
- data/lib/rubycritic/generators/html/assets/javascripts/jquery.tablesorter.min.js +4 -0
- data/lib/rubycritic/generators/html/assets/javascripts/jquery.timeago.js +231 -0
- data/lib/rubycritic/generators/html/assets/javascripts/prettify.js +46 -0
- data/lib/rubycritic/generators/html/assets/stylesheets/application.css +570 -0
- data/lib/rubycritic/generators/html/assets/stylesheets/bootstrap.min.css +6 -0
- data/lib/rubycritic/generators/html/assets/stylesheets/font-awesome.min.css +4 -0
- data/lib/rubycritic/generators/html/assets/stylesheets/prettify.css +1 -0
- data/lib/rubycritic/generators/html/assets/stylesheets/prettify.custom_theme.css +69 -0
- data/lib/rubycritic/generators/html/base.rb +54 -0
- data/lib/rubycritic/generators/html/code_file.rb +51 -0
- data/lib/rubycritic/generators/html/code_index.rb +33 -0
- data/lib/rubycritic/generators/html/line.rb +37 -0
- data/lib/rubycritic/generators/html/overview.rb +38 -0
- data/lib/rubycritic/generators/html/simple_cov_index.rb +44 -0
- data/lib/rubycritic/generators/html/smells_index.rb +45 -0
- data/lib/rubycritic/generators/html/templates/code_file.html.erb +61 -0
- data/lib/rubycritic/generators/html/templates/code_index.html.erb +55 -0
- data/lib/rubycritic/generators/html/templates/layouts/application.html.erb +66 -0
- data/lib/rubycritic/generators/html/templates/line.html.erb +1 -0
- data/lib/rubycritic/generators/html/templates/overview.html.erb +68 -0
- data/lib/rubycritic/generators/html/templates/simple_cov_index.html.erb +44 -0
- data/lib/rubycritic/generators/html/templates/smells_index.html.erb +47 -0
- data/lib/rubycritic/generators/html/templates/smelly_line.html.erb +23 -0
- data/lib/rubycritic/generators/html/turbulence.rb +17 -0
- data/lib/rubycritic/generators/html/view_helpers.rb +58 -0
- data/lib/rubycritic/generators/html_report.rb +77 -0
- data/lib/rubycritic/generators/json/simple.rb +43 -0
- data/lib/rubycritic/generators/json_report.rb +26 -0
- data/lib/rubycritic/generators/lint_report.rb +30 -0
- data/lib/rubycritic/generators/text/lint.rb +41 -0
- data/lib/rubycritic/generators/text/list.rb +45 -0
- data/lib/rubycritic/generators/text/templates/lint.erb +3 -0
- data/lib/rubycritic/generators/text/templates/list.erb +12 -0
- data/lib/rubycritic/rake_task.rb +71 -0
- data/lib/rubycritic/reporter.rb +39 -0
- data/lib/rubycritic/revision_comparator.rb +45 -0
- data/lib/rubycritic/serializer.rb +32 -0
- data/lib/rubycritic/smells_status_setter.rb +18 -0
- data/lib/rubycritic/source_control_systems/base.rb +41 -0
- data/lib/rubycritic/source_control_systems/double.rb +19 -0
- data/lib/rubycritic/source_control_systems/git.rb +95 -0
- data/lib/rubycritic/source_control_systems/mercurial.rb +29 -0
- data/lib/rubycritic/source_control_systems/perforce.rb +116 -0
- data/lib/rubycritic/source_locator.rb +52 -0
- data/lib/rubycritic/version.rb +5 -0
- data/lib/rubycritic.rb +6 -0
- metadata +528 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'cgi'
|
|
4
|
+
require 'rubycritic/generators/html/base'
|
|
5
|
+
|
|
6
|
+
module RubyCritic
|
|
7
|
+
module Generator
|
|
8
|
+
module Html
|
|
9
|
+
class Line < Base
|
|
10
|
+
NORMAL_TEMPLATE = erb_template('line.html.erb')
|
|
11
|
+
SMELLY_TEMPLATE = erb_template('smelly_line.html.erb')
|
|
12
|
+
|
|
13
|
+
attr_reader :file_directory
|
|
14
|
+
|
|
15
|
+
def initialize(file_directory, text, smells)
|
|
16
|
+
@file_directory = file_directory
|
|
17
|
+
@text = CGI.escapeHTML(text.chomp)
|
|
18
|
+
@smells = smells
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def render
|
|
22
|
+
template.result(binding).delete("\n") + "\n"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def template
|
|
28
|
+
if @smells.empty?
|
|
29
|
+
NORMAL_TEMPLATE
|
|
30
|
+
else
|
|
31
|
+
SMELLY_TEMPLATE
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rubycritic/generators/html/base'
|
|
4
|
+
require 'rubycritic/generators/html/turbulence'
|
|
5
|
+
require 'rubycritic/analysis_summary'
|
|
6
|
+
|
|
7
|
+
module RubyCritic
|
|
8
|
+
module Generator
|
|
9
|
+
module Html
|
|
10
|
+
class Overview < Base
|
|
11
|
+
TEMPLATE = erb_template('overview.html.erb')
|
|
12
|
+
|
|
13
|
+
def initialize(analysed_modules)
|
|
14
|
+
@turbulence_data = Turbulence.data(analysed_modules)
|
|
15
|
+
@score = analysed_modules.score
|
|
16
|
+
@max_score = AnalysedModulesCollection::MAX_SCORE
|
|
17
|
+
@summary = analysed_modules.summary
|
|
18
|
+
set_header_links if Config.compare_branches_mode?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def set_header_links
|
|
22
|
+
@base_path = code_index_path(Config.base_root_directory, file_name)
|
|
23
|
+
@feature_path = code_index_path(Config.feature_root_directory, file_name)
|
|
24
|
+
@build_path = code_index_path(Config.compare_root_directory, file_name)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def file_name
|
|
28
|
+
'overview.html'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def render
|
|
32
|
+
index_body = TEMPLATE.result(base_binding)
|
|
33
|
+
LAYOUT_TEMPLATE.result(base_binding { index_body })
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rubycritic/generators/html/base'
|
|
4
|
+
|
|
5
|
+
module RubyCritic
|
|
6
|
+
module Generator
|
|
7
|
+
module Html
|
|
8
|
+
class SimpleCovIndex < Base
|
|
9
|
+
TEMPLATE = erb_template('simple_cov_index.html.erb')
|
|
10
|
+
|
|
11
|
+
def initialize(analysed_modules)
|
|
12
|
+
@analysed_modules = sorted(filtered(analysed_modules))
|
|
13
|
+
set_header_links if Config.compare_branches_mode?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def set_header_links
|
|
17
|
+
@base_path = code_index_path(Config.base_root_directory, file_name)
|
|
18
|
+
@feature_path = code_index_path(Config.feature_root_directory, file_name)
|
|
19
|
+
@build_path = code_index_path(Config.compare_root_directory, file_name)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def file_name
|
|
23
|
+
'simple_cov_index.html'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def render
|
|
27
|
+
index_body = TEMPLATE.result(base_binding)
|
|
28
|
+
LAYOUT_TEMPLATE.result(base_binding { index_body })
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def sorted(mods)
|
|
32
|
+
mods.sort_by(&:coverage)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def filtered(mods)
|
|
36
|
+
mods.reject do |a_module|
|
|
37
|
+
path = a_module.pathname.to_s
|
|
38
|
+
path.start_with?('spec', 'test')
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rubycritic/generators/html/base'
|
|
4
|
+
|
|
5
|
+
module RubyCritic
|
|
6
|
+
module Generator
|
|
7
|
+
module Html
|
|
8
|
+
class SmellsIndex < Base
|
|
9
|
+
TEMPLATE = erb_template('smells_index.html.erb')
|
|
10
|
+
|
|
11
|
+
def initialize(analysed_modules)
|
|
12
|
+
@smells = analysed_modules.flat_map(&:smells).uniq
|
|
13
|
+
@analysed_module_names = analysed_module_names(analysed_modules)
|
|
14
|
+
@show_status = (Config.mode == :default)
|
|
15
|
+
set_header_links if Config.compare_branches_mode?
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def set_header_links
|
|
19
|
+
@base_path = code_index_path(Config.base_root_directory, file_name)
|
|
20
|
+
@feature_path = code_index_path(Config.feature_root_directory, file_name)
|
|
21
|
+
@build_path = code_index_path(Config.compare_root_directory, file_name)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def file_name
|
|
25
|
+
'smells_index.html'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def render
|
|
29
|
+
index_body = TEMPLATE.result(base_binding)
|
|
30
|
+
LAYOUT_TEMPLATE.result(base_binding { index_body })
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def analysed_module_names(analysed_modules)
|
|
36
|
+
names = {}
|
|
37
|
+
analysed_modules.each do |analysed_module|
|
|
38
|
+
names[analysed_module.pathname] = analysed_module.name
|
|
39
|
+
end
|
|
40
|
+
names
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<div class="row">
|
|
2
|
+
<!--Page Title -->
|
|
3
|
+
<div class="Page_Title">
|
|
4
|
+
<div class="file-time">
|
|
5
|
+
<span class="committed-at">
|
|
6
|
+
<% if @analysed_module.committed_at %>
|
|
7
|
+
Updated <%= timeago_tag(@analysed_module.committed_at) %>
|
|
8
|
+
<% else %>
|
|
9
|
+
Never committed
|
|
10
|
+
<% end %>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
<div>
|
|
14
|
+
<h3><small><%= @analysed_module.file_location %> /</small> <%= @analysed_module.file_name %></h3>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<!--End Page Title -->
|
|
18
|
+
<div class="Content_Wrapper">
|
|
19
|
+
<!-- code detail -->
|
|
20
|
+
<div class="code-top-detail clearfix row">
|
|
21
|
+
<div class="col-md-8">
|
|
22
|
+
<div class="row">
|
|
23
|
+
<div class="col-md-1">
|
|
24
|
+
<div class="rating <%= @analysed_module.rating.to_s.downcase %> big">
|
|
25
|
+
<%= @analysed_module.rating %>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="code-statistics col-md-11">
|
|
29
|
+
<div class="col-md-3">
|
|
30
|
+
<div><span class="metric"><%= @analysed_module.line_count %></span><small> lines of codes</small></div>
|
|
31
|
+
<div><span class="metric"><%= @analysed_module.methods_count %></span><small> methods</small></div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="col-md-3">
|
|
34
|
+
<div><span class="metric"><%= @analysed_module.complexity_per_method %></span><small> complexity/method</small></div>
|
|
35
|
+
<div><span class="metric"><%= @analysed_module.churn %></span><small> churn</small></div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="col-md-3">
|
|
38
|
+
<div><span class="metric"><%= @analysed_module.complexity %></span><small> complexity</small></div>
|
|
39
|
+
<div><span class="metric"><%= @analysed_module.duplication %></span><small> duplications</small></div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="col-md-4">
|
|
45
|
+
<div class="code-tabs">
|
|
46
|
+
<ul class="nav nav-pills right-to-left">
|
|
47
|
+
<li><a href="#" id="toggle-code" class="toggle-button button">code</a></li>
|
|
48
|
+
<li class="active">
|
|
49
|
+
<a href="#" id="toggle-smells" class="toggle-button button">
|
|
50
|
+
<%= @analysed_module.smells_count %>
|
|
51
|
+
<%= @analysed_module.smells_count <= 1 ? 'smell' : 'smells' %>
|
|
52
|
+
</a>
|
|
53
|
+
</li>
|
|
54
|
+
</ul>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<code class="prettyprint linenums lang-ruby file-code js-file-code"><%= yield %></code>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<div class="row">
|
|
2
|
+
<!--Page Title -->
|
|
3
|
+
<div class="Page_Title">
|
|
4
|
+
<h3>Code</h3>
|
|
5
|
+
</div>
|
|
6
|
+
<!--End Page Title -->
|
|
7
|
+
<div class="Content_Wrapper">
|
|
8
|
+
<table id="codeTable" class="table code sortable-table tablesorter">
|
|
9
|
+
<thead>
|
|
10
|
+
<tr>
|
|
11
|
+
<% unless Config.suppress_ratings %>
|
|
12
|
+
<th width="10%" class="table-header">Rating<span class="sort-type"></span></th>
|
|
13
|
+
<% end %>
|
|
14
|
+
<th width="50%" class="table-header">Name<span class="sort-type"></span></th>
|
|
15
|
+
<th width="10%" class="table-header">Churn<span class="sort-type"></span></th>
|
|
16
|
+
<th width="10%" class="table-header">Complexity<span class="sort-type"></span></th>
|
|
17
|
+
<th width="10%" class="table-header">Duplication<span class="sort-type"></span></th>
|
|
18
|
+
<th width="10%" class="table-header">Smells<span class="sort-type"></span></th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<% @analysed_modules.each do |analysed_module| %>
|
|
23
|
+
<tr>
|
|
24
|
+
<% unless Config.suppress_ratings %>
|
|
25
|
+
<td>
|
|
26
|
+
<% if Config.build_mode? %>
|
|
27
|
+
<% master_analysed_module = Config.base_branch_collection.find(analysed_module.pathname) %>
|
|
28
|
+
<% if master_analysed_module.cost > analysed_module.cost %>
|
|
29
|
+
<span class="glyphicon glyphicon-arrow-up green-color"></span>
|
|
30
|
+
<% elsif master_analysed_module.cost < analysed_module.cost %>
|
|
31
|
+
<span class="glyphicon glyphicon-arrow-down red-color"></span>
|
|
32
|
+
<% else %>
|
|
33
|
+
<span class="empty-span glyphicon"></span>
|
|
34
|
+
<% end %>
|
|
35
|
+
<% end %>
|
|
36
|
+
<div class="rating <%= analysed_module.rating.to_s.downcase %>"><%= analysed_module.rating %></div>
|
|
37
|
+
</td>
|
|
38
|
+
<% end %>
|
|
39
|
+
<td>
|
|
40
|
+
<ul class="nav nav-pills">
|
|
41
|
+
<li role="presentation" >
|
|
42
|
+
<a href="<%= file_path(analysed_module.pathname.sub_ext('.html')) %>"><%= analysed_module.name %></a>
|
|
43
|
+
</li>
|
|
44
|
+
</ul>
|
|
45
|
+
</td>
|
|
46
|
+
<td><%= analysed_module.churn %></td>
|
|
47
|
+
<td><%= analysed_module.complexity %></td>
|
|
48
|
+
<td><%= analysed_module.duplication %></td>
|
|
49
|
+
<td><%= analysed_module.smells_count %></td>
|
|
50
|
+
</tr>
|
|
51
|
+
<% end %>
|
|
52
|
+
</tbody>
|
|
53
|
+
</table>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<title>Ruby Critic - Home</title>
|
|
7
|
+
<meta name="description" content="">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
|
|
10
|
+
<!-- StyleSheets -->
|
|
11
|
+
<link href="<%= stylesheet_path(:'bootstrap.min') %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
12
|
+
<link href="<%= stylesheet_path(:'font-awesome.min') %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
13
|
+
<link href="<%= stylesheet_path(:'prettify.custom_theme') %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
14
|
+
<link href="<%= stylesheet_path(:application) %>" media="screen, projection, print" rel="stylesheet" type="text/css">
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<header class="navbar navbar-default navbar-fixed-top">
|
|
19
|
+
<a href="#menu-toggle" class="btn btn-default hidden-lg visible-sm-* hidden-md visible-xs-* pull-left" id="menu-toggle"><i class="fa fa-bars" aria-hidden="true"></i></a>
|
|
20
|
+
<a href="<%= file_path('overview.html') %>"><img src="<%= image_path('logo.png') %>" alt="Ruby Critic Logo" title="Ruby Critic Logo" width="55"><span class="logo">RUBYCRITIC</span></a>
|
|
21
|
+
<% if Config.compare_branches_mode? %>
|
|
22
|
+
<ul class="nav navbar-nav navbar-right">
|
|
23
|
+
<a href="<%= @base_path %>"><span class="branch"><%= Config.base_branch %></span></a>
|
|
24
|
+
<a href="<%= @feature_path %>"><span class="branch"><%= Config.feature_branch %></span></a>
|
|
25
|
+
<a href="<%= @build_path %>"><span class="branch">Build</span></a>
|
|
26
|
+
</ul>
|
|
27
|
+
<% end %>
|
|
28
|
+
</header>
|
|
29
|
+
<div id="wrapper">
|
|
30
|
+
<!-- Sidebar -->
|
|
31
|
+
<aside id="sidebar-wrapper">
|
|
32
|
+
<ul class="sidebar-nav">
|
|
33
|
+
<li class="sidebar-item">
|
|
34
|
+
<a href="<%= file_path('overview.html') %>" class="project-nav-item overview-nav"><i class="fa fa-dashboard"></i>Overview</a>
|
|
35
|
+
</li>
|
|
36
|
+
<li class="sidebar-item">
|
|
37
|
+
<a href="<%= file_path('code_index.html') %>" class="project-nav-item code-index-nav"><i class="fa fa-code"></i>Code</a>
|
|
38
|
+
</li>
|
|
39
|
+
<li class="sidebar-item">
|
|
40
|
+
<a href="<%= file_path('smells_index.html') %>" class="project-nav-item smells-index-nav"><i class="fa fa-warning"></i>Smells</a>
|
|
41
|
+
</li>
|
|
42
|
+
<li class="sidebar-item">
|
|
43
|
+
<a href="<%= file_path('simple_cov_index.html') %>" class="project-nav-item coverage-index-nav"><i class="fa fa-umbrella"></i>Coverage</a>
|
|
44
|
+
</li>
|
|
45
|
+
</ul>
|
|
46
|
+
</aside>
|
|
47
|
+
<!-- /#sidebar-wrapper -->
|
|
48
|
+
<div id="page-content-wrapper">
|
|
49
|
+
<div class="container-fluid">
|
|
50
|
+
<%= yield %>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<!-- JavaScripts -->
|
|
56
|
+
<%= javascript_tag(:'jquery.min') %>
|
|
57
|
+
<%= javascript_tag(:'jquery.tablesorter.min') %>
|
|
58
|
+
<%= javascript_tag(:'jquery.scrollTo.min') %>
|
|
59
|
+
<%= javascript_tag(:'jquery.timeago') %>
|
|
60
|
+
<%= javascript_tag(:'highcharts.src-4.0.1') %>
|
|
61
|
+
<%= javascript_tag(:'prettify') %>
|
|
62
|
+
<%= javascript_tag(:'bootstrap.min') %>
|
|
63
|
+
<%= javascript_tag(:application) %>
|
|
64
|
+
<%= javascript_tag(:'jquery.filtertable.min') %>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= @text %>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!-- Page Content -->
|
|
2
|
+
<div id="page-content-wrapper">
|
|
3
|
+
<div class="container-fluid">
|
|
4
|
+
<div class="row">
|
|
5
|
+
<!--Page Title -->
|
|
6
|
+
<div class="Page_Title">
|
|
7
|
+
<h3>Overview</h3>
|
|
8
|
+
</div>
|
|
9
|
+
<!--End Page Title -->
|
|
10
|
+
<div class="Content_Wrapper">
|
|
11
|
+
<!--Grade Wrapper-->
|
|
12
|
+
<div class="col-xs-12 col-sm-4 col-md-6 col-lg-4">
|
|
13
|
+
<div class="Graph_Cards fadeIn">
|
|
14
|
+
<div id="gpa-chart" class="chart-container"></div>
|
|
15
|
+
<div id="addText" ></div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<!--End Grade Wrapper-->
|
|
19
|
+
|
|
20
|
+
<!--Churn vs Complexity graph-->
|
|
21
|
+
<div class="col-xs-7 col-sm-7 col-md-6 col-lg-8">
|
|
22
|
+
<div class="Graph_Cards fadeIn">
|
|
23
|
+
<% if Config.source_control_present? %>
|
|
24
|
+
<div id="churn-vs-complexity-graph-container" class="chart-container"></div>
|
|
25
|
+
<% else %>
|
|
26
|
+
<div id="churn-error">We can't show you Churn-vs-Complexity graph because this project does not seem to be under a source code management system like git or perforce at the moment. This doesn't mean that anything is wrong, it just means certain features like this one are not available.</div>
|
|
27
|
+
<% end %>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
var turbulenceData = <%= @turbulence_data %>;
|
|
31
|
+
var score = <%= @score %>;
|
|
32
|
+
</script>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<!--End Churn vs Complexity graph-->
|
|
36
|
+
|
|
37
|
+
<!--Summary Wrapper-->
|
|
38
|
+
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
|
|
39
|
+
<div class="Graph_Cards Summary_Wrapper_Main fadeIn-3">
|
|
40
|
+
<h4>Summary</h4>
|
|
41
|
+
<% ratings = { 'A' => 'Green_DR', 'B' => 'Green_Light', 'C' => 'Yellow_Color',
|
|
42
|
+
'D' => 'Orange_Color', 'F' => 'Red_Color' } %>
|
|
43
|
+
<div class="Summary_Wrapper">
|
|
44
|
+
<% ratings.each do |rating, color| %>
|
|
45
|
+
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4">
|
|
46
|
+
<div class="summary_wrap <%= color %>">
|
|
47
|
+
<div class="pull-left Summary_Title col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
|
48
|
+
<h3><%= rating %></h3>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="pull-right Summary_Content col-xs-9 col-sm-9 col-md-9 col-lg-9">
|
|
51
|
+
<ul class="list-inline">
|
|
52
|
+
<li><h4 id="ratingAfileCount"><%= @summary[rating][:files] %></h4><span>files</span></li>
|
|
53
|
+
<li><h4 id="ratingAfileCount"><%= @summary[rating][:churns] %></h4><span>churns</span></li>
|
|
54
|
+
<li><h4 id="ratingAfileCount"><%= @summary[rating][:smells] %></h4><span>smells</span></li>
|
|
55
|
+
</ul>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
<% end %>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<!--End Summary Wrapper-->
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
<!-- /#page-content-wrapper -->
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!-- Page Content -->
|
|
2
|
+
<div id="page-content-wrapper">
|
|
3
|
+
<div class="container-fluid">
|
|
4
|
+
<div class="row">
|
|
5
|
+
<!--Page Title -->
|
|
6
|
+
<div class="Page_Title">
|
|
7
|
+
<h3>Coverage</h3>
|
|
8
|
+
</div>
|
|
9
|
+
<!--End Page Title -->
|
|
10
|
+
<div class="Content_Wrapper">
|
|
11
|
+
<table id="js-index-table" class="table coverage-index-table index-table sortable-table">
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<% unless Config.suppress_ratings %>
|
|
15
|
+
<th width="10%" class="table-header">Rating<span class="sort-type"></span></th>
|
|
16
|
+
<% end %>
|
|
17
|
+
<th width="80%" class="table-header">Name<span class="sort-type"></span></th>
|
|
18
|
+
<th width="10%" class="table-header">Coverage<span class="sort-type"></span></th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<% @analysed_modules.each do |analysed_module| %>
|
|
22
|
+
<tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<% unless Config.suppress_ratings %>
|
|
25
|
+
<td>
|
|
26
|
+
<div class="rating <%= analysed_module.rating.to_s.downcase %>"><%= analysed_module.coverage_rating %></div>
|
|
27
|
+
</td>
|
|
28
|
+
<% end %>
|
|
29
|
+
<td>
|
|
30
|
+
<ul class="nav nav-pills">
|
|
31
|
+
<li role="presentation" >
|
|
32
|
+
<a href="<%= file_path(analysed_module.pathname.sub_ext('.html')) %>"><%= analysed_module.name %></a>
|
|
33
|
+
</li>
|
|
34
|
+
</ul>
|
|
35
|
+
</td>
|
|
36
|
+
<td><%= '%g' % analysed_module.coverage %>%</td>
|
|
37
|
+
</tr>
|
|
38
|
+
<% end %>
|
|
39
|
+
</table>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<!-- /#page-content-wrapper -->
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<!-- Page Content -->
|
|
2
|
+
<div id="page-content-wrapper">
|
|
3
|
+
<div class="container-fluid">
|
|
4
|
+
<div class="row">
|
|
5
|
+
<!--Page Title -->
|
|
6
|
+
<div class="Page_Title">
|
|
7
|
+
<h3>Smells</h3>
|
|
8
|
+
</div>
|
|
9
|
+
<!--End Page Title -->
|
|
10
|
+
<div class="Content_Wrapper">
|
|
11
|
+
<table id="js-index-table" class="table smells-index-table index-table sortable-table">
|
|
12
|
+
<thead>
|
|
13
|
+
<tr>
|
|
14
|
+
<th width="30%" class="table-header">Smell<span class="sort-type"></span></th>
|
|
15
|
+
<th width="65%" class="table-header">Locations<span class="sort-type"></span></th>
|
|
16
|
+
<th width="5%" class="table-header">Status<span class="sort-type"></span></th>
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
<% @smells.each do |smell| %>
|
|
20
|
+
<tr>
|
|
21
|
+
<td><%= smell.type %></td>
|
|
22
|
+
<td>
|
|
23
|
+
<ul class="nav nav-pills">
|
|
24
|
+
<% smell.locations.each do |location| %>
|
|
25
|
+
<li role="presentation">
|
|
26
|
+
<a href="<%= smell_location_path(location) %>"><%= @analysed_module_names[location.pathname] %></a>
|
|
27
|
+
</li>
|
|
28
|
+
<% end %>
|
|
29
|
+
</ul>
|
|
30
|
+
</td>
|
|
31
|
+
<td>
|
|
32
|
+
<% if @show_status %>
|
|
33
|
+
<ul class="nav nav-pills">
|
|
34
|
+
<li role="presentation">
|
|
35
|
+
<td class="centered-cell"><span class="status-<%= smell.status %> circled-text circle"><%= smell.status %></span></td>
|
|
36
|
+
</li>
|
|
37
|
+
</ul>
|
|
38
|
+
<% end %>
|
|
39
|
+
</td>
|
|
40
|
+
</tr>
|
|
41
|
+
<% end %>
|
|
42
|
+
</table>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
<!-- /#page-content-wrapper -->
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<%= @text %>
|
|
2
|
+
|
|
3
|
+
<ol class="nocode errors smells">
|
|
4
|
+
<% @smells.each do |smell| %>
|
|
5
|
+
<li>
|
|
6
|
+
<div class="description">
|
|
7
|
+
<div class="heading">
|
|
8
|
+
<span>
|
|
9
|
+
<i class="fa fa-warning" aria-hidden="true"></i>
|
|
10
|
+
<a href="<%= smell.doc_url %>" target="_blank"><b><%= smell.type %></b></a>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
<span><%= "#{smell.context} #{smell.message}" %></span>
|
|
14
|
+
<% if smell.multiple_locations? %>
|
|
15
|
+
<span>Locations:</span>
|
|
16
|
+
<% smell.locations.each_with_index do |location, index| %>
|
|
17
|
+
<a href="<%= smell_location_path(location) %>" class="js-smell-location"><%= index %></a>
|
|
18
|
+
<% end %>
|
|
19
|
+
<% end %>
|
|
20
|
+
</div>
|
|
21
|
+
</li>
|
|
22
|
+
<% end %>
|
|
23
|
+
</ol>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
module RubyCritic
|
|
5
|
+
module Turbulence
|
|
6
|
+
def self.data(analysed_modules)
|
|
7
|
+
analysed_modules.map do |analysed_module|
|
|
8
|
+
{
|
|
9
|
+
name: analysed_module.name,
|
|
10
|
+
x: analysed_module.churn,
|
|
11
|
+
y: analysed_module.complexity,
|
|
12
|
+
rating: analysed_module.rating.to_s
|
|
13
|
+
}
|
|
14
|
+
end.to_json
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RubyCritic
|
|
4
|
+
module ViewHelpers
|
|
5
|
+
def timeago_tag(time)
|
|
6
|
+
"<time class='js-timeago' datetime='#{time}'>#{time}</time>"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def javascript_tag(file)
|
|
10
|
+
"<script src='" + asset_path("javascripts/#{file}.js").to_s + "'></script>"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def stylesheet_path(file)
|
|
14
|
+
asset_path("stylesheets/#{file}.css")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def asset_path(file)
|
|
18
|
+
relative_path("assets/#{file}")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def image_path(file)
|
|
22
|
+
asset_path("images/#{file}")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def file_path(file)
|
|
26
|
+
relative_path(file)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def smell_location_path(location)
|
|
30
|
+
smell_location = "#{location.pathname.sub_ext('.html')}#L#{location.line}"
|
|
31
|
+
if Config.compare_branches_mode?
|
|
32
|
+
file_path("#{File.expand_path(Config.feature_root_directory)}/#{smell_location}")
|
|
33
|
+
else
|
|
34
|
+
file_path(smell_location)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def code_index_path(root_directory, file_name)
|
|
39
|
+
file_path("#{File.expand_path(root_directory)}/#{file_name}")
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def relative_path(file)
|
|
45
|
+
(root_directory + file).relative_path_from(file_directory)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def file_directory
|
|
49
|
+
raise NotImplementedError,
|
|
50
|
+
"The #{self.class} class must implement the #{__method__} method."
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def root_directory
|
|
54
|
+
raise NotImplementedError,
|
|
55
|
+
"The #{self.class} class must implement the #{__method__} method."
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|