Page MenuHomeDevCentral

RuboCop analysis for Tommy

Authored By
dereckson
Jul 10 2016, 16:28
Size
29 KB
Referenced Files
None
Subscribers
None

RuboCop analysis for Tommy

>>> Lint for tommy.rb:
Warning (Style/Documentation) RuboCop
Missing top-level class documentation comment.
7
8 HUDSON_URL = ENV['HUDSON_URL'] || 'http://username:password@my.hudsonurl.com'
9
>>> 10 class Project < Hashie::Dash
11 property :name
12 property :build_score
13 property :last_build_number
Warning (Style/TrailingWhitespace) RuboCop
Trailing whitespace detected.
17 property :last_complete_url
18 property :last_failed_url
19 property :colour
>>> 20
21 def self.parse_incoming_json(json)
22 returned_projects = []
23 projects = json['jobs']
Warning (Metrics/MethodLength) RuboCop
Method has too many lines. [15/10]
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) RuboCop
Use the new Ruby 1.9 hash syntax.
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 (Metrics/LineLength) RuboCop
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 == 100
Warning (Metrics/MethodLength) RuboCop
Method has too many lines. [18/10]
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 (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
60 score = project.build_score
61 if project.is_green?
62 if score == 100
>>> 63 "best"
64 elsif score >= 80
65 "better"
66 elsif score >= 60
Warning (Style/StringLiterals) RuboCop
Prefer single-quoted strings when you don't need string interpolation or
special symbols.
62 if score == 100
63 "best"
64 elsif score >= 80
>>> 65 "better"
66 elsif score >= 60
67 "good"
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"
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

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39861
Default Alt Text
RuboCop analysis for Tommy (29 KB)

Event Timeline