>>> Lint for tommy.rb:
Warning (Style/DocumentationFrozenStringLiteralComment) RuboCop
Missing top-level class documentation comment.
7
8 HUDSON_URL = ENV['HUDSON_URL'] || 'http://username:password@my.hudsonurl.com'Style/FrozenStringLiteralComment: Missing magic comment `#
9
>>> 10 class Project < Hashie::Dash
11 property :name
12 property :build_score
13 property :last_build_number
Warning (Style/TrailingWhitespace) RuboCopfrozen_string_literal: true`.
Trailing whitespace detected.
17 property :last_complete_url
18 property :last_failed_url
19 property :colour>>> 1 # -------------------------------------------------------------
^
>>> 20
21 def self.parse_incoming_json(json)
22 returned_projects = []
23 projects = json['jobs']
Warning (Metrics/MethodLength) RuboCop 2 # Tommy - Visualisation dashboard for Jenkins
Method has too many lines. [15/10] 3 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4 # Author: Arfon Smitn (Zooniverse)
18 property :last_failed_url
19 property :colour
20
>>> 21 def self.parse_incoming_json(json)
22 returned_projects = []
23 projects = json['jobs']
24
Warning (Metrics/AbcSize) RuboCop
Assignment Branch Condition size for parse_incoming_json is too high.
[35.41/15]
18 property :last_failed_url
19 property :colour
20
>>> 21 def self.parse_incoming_json(json)
22 returned_projects = []
23 projects = json['jobs']
24
Warning (Style/TrailingWhitespace) RuboCop
Trailing whitespace detected.
21 def self.parse_incoming_json(json)
22 returned_projects = []
23 projects = json['jobs']
>>> 24
25 projects.each do |project|
26 next if !project['buildable']
27
Warning (Style/NegatedIf) RuboCop
Favor `unless` over `if` for negative conditions.
23 projects = json['jobs']
24
25 projects.each do |project|
>>> 26 next if !project['buildable']
27
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
Warning (Style/SpaceInsideParens) RuboCop
Space inside parentheses detected.
25 projects.each do |project|
26 next if !project['buildable']
27
>>> 28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
25 projects.each do |project|
26 next if !project['buildable']
27
>>> 28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
Warning (Performance/StringReplacement) RuboCop
Use `tr` instead of `gsub`.
25 projects.each do |project|
26 next if !project['buildable']
27
>>> 28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
Warning (Metrics/LineLength) RuboCop
Line is too long. [87/80]
25 projects.each do |project|
26 next if !project['buildable']
27
>>> 28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
26 next if !project['buildable']
27
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
>>> 29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
Warning (Metrics/LineLength) RuboCop
Line is too long. [100/80]
26 next if !project['buildable']
27
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
>>> 29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
27
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
>>> 30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
Warning (Metrics/LineLength) RuboCop
Line is too long. [96/80]
27
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
>>> 30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
>>> 31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
Warning (Metrics/LineLength) RuboCop
Line is too long. [124/80]
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
>>> 31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
28 returned_projects << Project.new( :name => project['displayName'].gsub('-', ' '),
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
>>> 31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
>>> 32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
Warning (Metrics/LineLength) RuboCop
Line is too long. [142/80]
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
>>> 32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
29 :build_score => project['healthReport'].first['score'].to_i,
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
>>> 32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
>>> 33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
Warning (Metrics/LineLength) RuboCop
Line is too long. [103/80]
30 :last_build_number => project['builds'].first['number'],
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
>>> 33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
Warning (Style/HashSyntax) RuboCopMetrics/AbcSize: Assignment Branch Condition size for parse_project is
Use the new Ruby 1.9 hash syntax.too high. [25.81/15]
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),52 ##
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),53 # Parses a job element of the Jenkins API.
33 :health_report => p54 # Returns a Project['healthReport'].first['description'],t instance.
>>> 34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),55 def self.parse_project(data)
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ), ^
36 56 :colour => pproject = Project['color']).new(
37 57 end
Warning (Metrics/LineLength) RuboCop name: data['displayName'].tr('-', ' '),
Line is too long. [145/80]
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
>>> 34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
37 end
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
31 :last_build_url => (project['lastBuild'].blank? ? "" : project['lastBuild']['url']),
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
>>> 34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
37 end
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
>>> 35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
37 end
38
Warning (Metrics/LineLength) RuboCop
Line is too long. [138/80]
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
>>> 35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
37 end
38
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
>>> 35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
37 end
38
Warning (Style/SpaceInsideParens) RuboCop
Space inside parentheses detected.
32 :last_stable_build => (project['lastStableBuild'].blank? ? "" : project['lastStableBuild']['number']),
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
>>> 35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
37 end
38
Warning (Style/HashSyntax) RuboCop
Use the new Ruby 1.9 hash syntax.
33 :health_report => project['healthReport'].first['description'],
34 :last_complete_url => (project['lastCompletedBuild'].blank? ? "" : project['lastCompletedBuild']['url']),
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
>>> 36 :colour => project['color'])
37 end
38
39 return returned_projects
Warning (Style/TrailingWhitespace) RuboCop
Trailing whitespace detected.
35 :last_failed_url => (project['lastFailedBuild'].blank? ? "" : project['lastFailedBuild']['url'] ),
36 :colour => project['color'])
37 end
>>> 38
39 return returned_projects
40 end
41
Warning (Style/RedundantReturn) RuboCop
Redundant `return` detected.
36 :colour => project['color'])
37 end
38
>>> 39 return returned_projects
40 end
41
42 def is_green?
Warning (Style/TrailingWhitespace) RuboCop
Trailing whitespace detected.
38
39 return returned_projects
40 end
>>> 41
42 def is_green?
43 self.last_stable_build == self.last_build_number
44 end
Warning (Style/PredicateName) RuboCop
Rename `is_green?` to `green?`.
39 return returned_projects
40 end
41
>>> 42 def is_green?
43 self.last_stable_build == self.last_build_number
44 end
45
Warning (Style/RedundantSelf) RuboCop
Redundant `self` detected.
40 end
41
42 def is_green?
>>> 43 self.last_stable_build == self.last_build_number
44 end
45
46 def is_building?
Warning (Style/RedundantSelf) RuboCop
Redundant `self` detected.
40 end
41
42 def is_green?
>>> 43 self.last_stable_build == self.last_build_number
44 end
45
46 def is_building?
Warning (Style/PredicateName) RuboCop
Rename `is_building?` to `building?`.
43 self.last_stable_build == self.last_build_number
44 end
45
>>> 46 def is_building?
47 self.colour.include?('anime')
48 end
49 end
Warning (Style/RedundantSelf) RuboCop
Redundant `self` detected.
44 end
45
46 def is_building?
>>> 47 self.colour.include?('anime')
48 end
49 end
50
Warning (Style/TrailingWhitespace) RuboCop
Trailing whitespace detected.
51 get '/' do
52 json = RestClient::Resource.new("#{HUDSON_URL}/api/json?depth=1")
53 @projects = Project.parse_incoming_json(Crack::JSON.parse(json.get))
>>> 54
55 erb :index
56 end
57
Warning (Metrics/PerceivedComplexity) RuboCop
Perceived complexity for css_for_project is too high. [9/7]
56 end
57
58 helpers do
>>> 59 def css_for_project(project)
60 score = project.build_score
61 if project.is_green?
62 if score == 100
Warning (Metrics/CyclomaticComplexity) RuboCop
Cyclomatic complexity for css_for_project is too high. [7/6]
56 end
57
58 helpers do
>>> 59 def css_for_project(project)
60 score = project.build_score
61 if project.is_green?
62 if score == 10058 last_build_number: data['builds'].first['number'],
Warning (Metrics/MethodLength) RuboCop
Metrics/MethodLength: Method has too many lines. [18/1024/10]
56 end52 ##
57
58 helpers do
>>> 59 def css_for_project(project)53 # Parses a job element of the Jenkins API.
60 score = project.build_score
61 if project.is_green?
62 if score == 100
Warning (Style/StringLiterals) RuboCop54 # Returns a Project instance.
Prefer single-quoted strings when you don't need string interpolation or>>> 55 def self.parse_project(data)
special symbols.
60 score = project.build_score
61 if project.is_green?
62 if score == 100
>>> 63 "best" ^
6456 elsif score >= 80project = Project.new(
65 57 "better"name: data['displayName'].tr('-', ' '),
6658 elsif score >= 60last_build_number: data['builds'].first['number'],
Warning (Style/StringLiteralsLayout/EmptyLineAfterGuardClause) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbolsLayout/EmptyLineAfterGuardClause: Add empty line after guard clause.
6274 if score == 100'lastFailedBuild' => 'last_failed_url='
63 75 "best"}
6476 elsif score >= 80urls.each do |api_property, local_property|
>>> 6577 "better"next if data[api_property].blank?
66 elsif score >= 60 ^
6778 "good"project.send(local_property, data[api_property]['url'])
68 elsif score >= 40
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
64 elsif score >= 80
65 "better"
66 elsif score >= 60
>>> 67 "good"
68 elsif score >= 40
69 "bad"
70 else
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
66 elsif score >= 60
67 "good"
68 elsif score >= 40
>>> 69 "bad"
70 else
71 "worse"
72 end
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
68 elsif score >= 40
69 "bad"79 end
70 else
>>> 71 "worse"
72 end
73 elsif project.is_building?
74 "building"
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
71 "worse"
72 end
73 elsif project.is_building?
>>> 74 "building"
75 else
76 "worst"
77 end
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
73 elsif project.is_building?
74 "building"
75 else
>>> 76 "worst"
77 end
78 end
79 end
80