Skip to content
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

Merged
merged 11 commits into from
Aug 2, 2023
Merged

Trying out reviewdog #19

merged 11 commits into from
Aug 2, 2023

Conversation

tickinginstant
Copy link
Owner

No description provided.

@@ -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?)
Copy link

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/models/work.rb Outdated Show resolved Hide resolved
app/models/work.rb Outdated Show resolved Hide resolved
app/models/work.rb Outdated Show resolved Hide resolved
app/models/work.rb Outdated Show resolved Hide resolved
@@ -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">
Copy link

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.

<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%>
Copy link

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.

<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%>
Copy link

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.

<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%>
Copy link

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.

@@ -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?)
Copy link

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 ||.

@@ -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?)
Copy link

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.

Comment on lines 53 to 55
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
Copy link

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 &&/||.

Suggested change
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?)

@@ -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?)
Copy link

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 ||.

Suggested change
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?)

@tickinginstant tickinginstant merged commit c010e0b into main Aug 2, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant