-
Notifications
You must be signed in to change notification settings - Fork 0
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
Trying out reviewdog #19
Conversation
app/models/work.rb
Outdated
@@ -50,7 +50,7 @@ class Work < ApplicationRecord | |||
belongs_to :work_skin | |||
validate :work_skin_allowed, on: :save | |||
def work_skin_allowed | |||
unless self.users.include?(self.work_skin.author) || (self.work_skin.public? && self.work_skin.official?) | |||
unless self.users.include?(self.work_skin.author)||(self.work_skin.public?&&self.work_skin.official?) |
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.
Style/GuardClause: Use a guard clause (return if self.users.include?(self.work_skin.author)||(self.work_skin.public?&&self.work_skin.official?)) instead of wrapping the code inside a conditional expression.
[Correctable] Style/IfUnlessModifier: Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
[Correctable] Layout/SpaceAroundOperators: Surrounding space missing for operator ||.
[Correctable] Layout/SpaceAroundOperators: Surrounding space missing for operator &&.
app/views/works/_work_blurb.html.erb
Outdated
@@ -1,6 +1,6 @@ | |||
<% # expects "work" %> | |||
<li id="work_<%= work.id %>" class="<% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> | |||
<%= render "works/work_module", work: work %> | |||
<li id="work_<%= work.id %>" class="works <% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> |
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.
reported by reviewdog 🐶
Deprecated class works
detected matching the pattern works
. Avoid the plural form of these classes.
app/views/works/_work_blurb.html.erb
Outdated
<li id="work_<%= work.id %>" class="<% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> | ||
<%= render "works/work_module", work: work %> | ||
<li id="work_<%= work.id %>" class="works <% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> | ||
<%=render "works/work_module", :work => work%> |
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.
reported by reviewdog 🐶
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
app/views/works/_work_blurb.html.erb
Outdated
<li id="work_<%= work.id %>" class="<% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> | ||
<%= render "works/work_module", work: work %> | ||
<li id="work_<%= work.id %>" class="works <% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> | ||
<%=render "works/work_module", :work => work%> |
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.
reported by reviewdog 🐶
Use 1 space after <%=
instead of 0 space.
app/views/works/_work_blurb.html.erb
Outdated
<li id="work_<%= work.id %>" class="<% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> | ||
<%= render "works/work_module", work: work %> | ||
<li id="work_<%= work.id %>" class="works <% if is_author_of?(work) %>own <% end %><% if work.unrevealed? %>mystery <% end %>work <%= css_classes_for_creation_blurb(work) %>" role="article"> | ||
<%=render "works/work_module", :work => work%> |
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.
reported by reviewdog 🐶
Use 1 space before %>
instead of 0 space.
app/models/work.rb
Outdated
@@ -50,7 +50,7 @@ class Work < ApplicationRecord | |||
belongs_to :work_skin | |||
validate :work_skin_allowed, on: :save | |||
def work_skin_allowed | |||
unless self.users.include?(self.work_skin.author) || (self.work_skin.public? && self.work_skin.official?) | |||
unless self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?) |
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.
Style/GuardClause: Use a guard clause (return if self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?)) instead of wrapping the code inside a conditional expression.
[Correctable] Style/IfUnlessModifier: Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
[Correctable] Layout/SpaceAroundOperators: Surrounding space missing for operator ||.
app/models/work.rb
Outdated
@@ -50,7 +50,7 @@ class Work < ApplicationRecord | |||
belongs_to :work_skin | |||
validate :work_skin_allowed, on: :save | |||
def work_skin_allowed | |||
unless self.users.include?(self.work_skin.author) || (self.work_skin.public? && self.work_skin.official?) | |||
unless self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?) |
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.
📝 [rubocop] <Style/GuardClause> reported by reviewdog 🐶
Use a guard clause (return if self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?)
) instead of wrapping the code inside a conditional expression.
app/models/work.rb
Outdated
unless self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?) | ||
errors.add(:base, ts("You do not have permission to use that custom work stylesheet.")) | ||
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.
📝 [rubocop] <Style/IfUnlessModifier> reported by reviewdog 🐶
Favor modifier unless
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
.
unless self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?) | |
errors.add(:base, ts("You do not have permission to use that custom work stylesheet.")) | |
end | |
errors.add(:base, ts("You do not have permission to use that custom work stylesheet.")) unless self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?) |
app/models/work.rb
Outdated
@@ -50,7 +50,7 @@ | |||
belongs_to :work_skin | |||
validate :work_skin_allowed, on: :save | |||
def work_skin_allowed | |||
unless self.users.include?(self.work_skin.author) || (self.work_skin.public? && self.work_skin.official?) | |||
unless self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?) |
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.
📝 [rubocop] <Layout/SpaceAroundOperators> reported by reviewdog 🐶
Surrounding space missing for operator ||
.
unless self.users.include?(self.work_skin.author)||(self.work_skin.public? && self.work_skin.official?) | |
unless self.users.include?(self.work_skin.author) || (self.work_skin.public? && self.work_skin.official?) |
6553564
to
9e0bd11
Compare
No description provided.