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
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# modified from:
# https://github.com/reviewdog/action-rubocop#example-usage
# https://github.com/tk0miya/action-erblint#example-usage

name: reviewdog
on: [pull_request]
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
reporter: github-pr-review # Default is github-pr-check

erb-lint:
name: runner / erb-lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: erb-lint
uses: reviewdog/action-erblint@v1
with:
reporter: github-pr-review # This is the default
2 changes: 1 addition & 1 deletion app/models/work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&.

tickinginstant marked this conversation as resolved.
Show resolved Hide resolved
tickinginstant marked this conversation as resolved.
Show resolved Hide resolved
tickinginstant marked this conversation as resolved.
Show resolved Hide resolved
errors.add(:base, ts("You do not have permission to use that custom work stylesheet."))
end
tickinginstant marked this conversation as resolved.
Show resolved Hide resolved
end
Expand Down
4 changes: 2 additions & 2 deletions app/views/works/_work_blurb.html.erb
Original file line number Diff line number Diff line change
@@ -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.

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

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.

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.

<% if is_author_of?(work) %>
<h6 class="landmark heading"><%= ts("Author Actions") %></h6>
<ul class="actions" role="navigation">
Expand Down
Loading