-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Circular dependencies #4
Conversation
- Remove test duplication
- Move definitions and relations parsing into parse method - Test app from Data class rather than File class - Add example circular file to test
@@ -0,0 +1,3 @@ | |||
class ClassWithOneIncludedMixin | |||
include ModuleWithNoRelations | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final newline missing.
@@ -0,0 +1,3 @@ | |||
class ClassWithOneIncludedMixin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
spec/spec_helper.rb
Outdated
|
||
# The settings below are suggested to provide a good initial experience | ||
# with RSpec, but feel free to customize to your heart's content. | ||
=begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use block comments.
spec/spec_helper.rb
Outdated
@@ -0,0 +1,100 @@ | |||
# This file was generated by the `rspec --init` command. Conventionally, all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
@@ -0,0 +1,2 @@ | |||
module ModuleWithNoRelations | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final newline missing.
@@ -0,0 +1,17 @@ | |||
class A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
@@ -0,0 +1,3 @@ | |||
class ClassWithOneExtendedMixin | |||
extend ModuleWithNoRelations | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final newline missing.
@@ -0,0 +1,3 @@ | |||
class ClassWithOneExtendedMixin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final newline missing.
spec/parser/data_spec.rb
Outdated
|
||
context 'Circular dependency' do | ||
context 'across classes' do | ||
let(:file_path) {'spec/parser/fixtures/classes_circular_dependency.rb'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing inside {.
Space missing inside }.
@@ -0,0 +1,5 @@ | |||
class ClassWithOneClassDependency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
@@ -0,0 +1,2 @@ | |||
class ClassWithNoRelations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
spec/parser/data_spec.rb
Outdated
context 'Class depends on another class' do | ||
let(:file_namespace) {:ClassWithOneClassDependency} | ||
let(:dependency_namespace) {:ClassWithNoRelations} | ||
let(:file_path) { 'spec/parser/fixtures/class_with_one_class_dependency.rb' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [81/80]
spec/parser/data_spec.rb
Outdated
|
||
context 'Class depends on another class' do | ||
let(:file_namespace) {:ClassWithOneClassDependency} | ||
let(:dependency_namespace) {:ClassWithNoRelations} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing inside {.
Space missing inside }.
spec/parser/data_spec.rb
Outdated
end | ||
|
||
context 'Class depends on another class' do | ||
let(:file_namespace) {:ClassWithOneClassDependency} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing inside {.
Space missing inside }.
spec/parser/data_spec.rb
Outdated
context 'extended' do | ||
let(:file_namespace) {:ClassWithOneExtendedMixin} | ||
let(:dependency_namespace) {:ModuleWithNoRelations} | ||
let(:file_path) { 'spec/parser/fixtures/class_with_one_extended_mixin.rb' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [81/80]
spec/parser/data_spec.rb
Outdated
|
||
context 'extended' do | ||
let(:file_namespace) {:ClassWithOneExtendedMixin} | ||
let(:dependency_namespace) {:ModuleWithNoRelations} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space missing inside {.
Space missing inside }.
spec/spec_helper.rb
Outdated
@@ -0,0 +1,101 @@ | |||
# frozen_string_literal: false | |||
# This file was generated by the `rspec --init` command. Conventionally, all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an empty line after magic comments.
Is there a way to run these checks locally? I don't want to have a million tiny commits. |
@steven-solomon Yup, try rubocop locally I think houndci is just running that command |
@@ -0,0 +1,116 @@ | |||
require 'rubrowser/data' | |||
|
|||
describe Rubrowser::Data do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Block has too many lines. [90/25]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make an exception to this rule for spec files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
@@ -0,0 +1,116 @@ | |||
require 'rubrowser/data' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing magic comment # frozen_string_literal: true.
public/javascript/application.js
Outdated
@@ -4,6 +4,10 @@ d3.json("/data.json", function(error, data) { | |||
$('.toolbox').show(); | |||
}); | |||
|
|||
var classForCircular = function(d) { | |||
return d.circular ? 'circular' : '' | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
public/javascript/application.js
Outdated
@@ -4,6 +4,10 @@ d3.json("/data.json", function(error, data) { | |||
$('.toolbox').show(); | |||
}); | |||
|
|||
var classForCircular = function(d) { | |||
return d.circular ? 'circular' : '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
end | ||
|
||
private | ||
|
||
class Graph < Hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing top-level class documentation comment.
lib/rubrowser/data.rb
Outdated
end | ||
|
||
@relations.each do |relation| | ||
if components.include?(relation.namespace.to_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I feel that using &&/|| for control flow would make the code unclear. How do you feel?
def self.do; end | ||
end | ||
|
||
class C |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing top-level class documentation comment.
def self.do; end | ||
end | ||
|
||
class B |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing top-level class documentation comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to find another way to test the app's circular functionality without including a file that does nothing
@@ -0,0 +1,23 @@ | |||
class A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing top-level class documentation comment.
Missing magic comment # frozen_string_literal: true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly there. I would like to propose an exception to the block rule on test files and comments for classes as no other class in the system has comments like this.
That's a good idea, lets add these exceptions to rubocop config file |
4394a53
to
a77a93e
Compare
@@ -0,0 +1,3 @@ | |||
module ModuleWithNoRelations | |||
end | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 trailing blank lines detected.
class ClassWithOneIncludedMixin | ||
include ModuleWithNoRelations | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 trailing blank lines detected.
|
||
def self.do; end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 trailing blank lines detected.
class ClassWithOneExtendedMixin | ||
extend ModuleWithNoRelations | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 trailing blank lines detected.
ClassWithNoRelations.new | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 trailing blank lines detected.
@@ -0,0 +1,6 @@ | |||
class ModuleWithOneClassDependency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Carriage return character detected.
Missing magic comment # frozen_string_literal: true.
ClassWithNoRelations.new | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 trailing blank lines detected.
@@ -0,0 +1,3 @@ | |||
class ClassWithNoRelations | |||
end | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 trailing blank lines detected.
cb3b94e
to
a77a93e
Compare
Seems like houndci is ignoring the changes to .rubocop.yml. I'm going to close and reopen this pull request. |
In this branch I have done the following:
I am happy to discuss switching to another testing framework if you prefer, I simply chose what I am most comfortable with. Also, I am hoping for a better way to test the app then pollute it with the test classes.
Fixes #3