DEV: Introduce syntax_tree for ruby formatting (#408)
This commit is contained in:
parent
4902ba6993
commit
46dd26963c
|
@ -55,3 +55,12 @@ jobs:
|
|||
- name: Rubocop
|
||||
if: ${{ !cancelled() }}
|
||||
run: bundle exec rubocop .
|
||||
|
||||
- name: Syntax Tree
|
||||
if: ${{ !cancelled() }}
|
||||
run: |
|
||||
if test -f .streerc; then
|
||||
bundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake')
|
||||
else
|
||||
echo "Stree config not detected for this repository. Skipping."
|
||||
fi
|
||||
|
|
|
@ -80,7 +80,7 @@ jobs:
|
|||
|
||||
- name: Get yarn cache directory
|
||||
id: yarn-cache-dir
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Yarn cache
|
||||
uses: actions/cache@v3
|
||||
|
@ -130,7 +130,7 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
if [ 0 -lt $(find plugins/${{ github.event.repository.name }}/spec -type f -name "*.rb" 2> /dev/null | wc -l) ]; then
|
||||
echo "::set-output name=files_exist::true"
|
||||
echo "files_exist=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Plugin RSpec
|
||||
|
@ -142,7 +142,7 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
if [ 0 -lt $(find plugins/${{ github.event.repository.name }}/test/javascripts -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
|
||||
echo "::set-output name=files_exist::true"
|
||||
echo "files_exist=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Plugin QUnit
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
inherit_gem:
|
||||
rubocop-discourse: default.yml
|
||||
rubocop-discourse: stree-compat.yml
|
||||
|
|
|
@ -6,7 +6,7 @@ GEM
|
|||
parallel (1.22.1)
|
||||
parser (3.1.3.0)
|
||||
ast (~> 2.4.1)
|
||||
prettier_print (0.1.0)
|
||||
prettier_print (1.1.0)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.6.1)
|
||||
rexml (3.2.5)
|
||||
|
@ -28,8 +28,8 @@ GEM
|
|||
rubocop-rspec (2.16.0)
|
||||
rubocop (~> 1.33)
|
||||
ruby-progressbar (1.11.0)
|
||||
syntax_tree (3.2.1)
|
||||
prettier_print
|
||||
syntax_tree (5.0.1)
|
||||
prettier_print (>= 1.1.0)
|
||||
unicode-display_width (2.3.0)
|
||||
|
||||
PLATFORMS
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
module DiscourseAssign
|
||||
module DiscourseCalendar
|
||||
HOLIDAY_CUSTOM_FIELD ||= 'on_holiday'
|
||||
HOLIDAY_CUSTOM_FIELD ||= "on_holiday"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,9 +23,9 @@ class RandomAssignUtils
|
|||
min_hours = fields.dig("minimum_time_between_assignments", "value").presence
|
||||
if min_hours &&
|
||||
TopicCustomField
|
||||
.where(name: "assigned_to_id", topic_id: topic_id)
|
||||
.where("created_at < ?", min_hours.to_i.hours.ago)
|
||||
.exists?
|
||||
.where(name: "assigned_to_id", topic_id: topic_id)
|
||||
.where("created_at < ?", min_hours.to_i.hours.ago)
|
||||
.exists?
|
||||
log_info(automation, "Topic(#{topic_id}) has already been assigned recently")
|
||||
return
|
||||
end
|
||||
|
|
|
@ -46,14 +46,13 @@ RSpec.describe Assigner do
|
|||
it "deletes notification for original assignee when reassigning" do
|
||||
Jobs.run_immediately!
|
||||
|
||||
expect {
|
||||
described_class.new(topic, admin).assign(moderator)
|
||||
}.to change { moderator.notifications.count }.by(1)
|
||||
expect { described_class.new(topic, admin).assign(moderator) }.to change {
|
||||
moderator.notifications.count
|
||||
}.by(1)
|
||||
|
||||
expect {
|
||||
described_class.new(topic, admin).assign(moderator_2)
|
||||
}.to change { moderator.notifications.count }.by(-1)
|
||||
.and change { moderator_2.notifications.count }.by(1)
|
||||
expect { described_class.new(topic, admin).assign(moderator_2) }.to change {
|
||||
moderator.notifications.count
|
||||
}.by(-1).and change { moderator_2.notifications.count }.by(1)
|
||||
end
|
||||
|
||||
it "can assign with note" do
|
||||
|
|
|
@ -10,7 +10,12 @@ RSpec.describe DiscourseAssign::AssignController do
|
|||
let(:user) { Fabricate(:admin, name: "Robin Ward", username: "eviltrout") }
|
||||
fab!(:post) { Fabricate(:post) }
|
||||
fab!(:user2) do
|
||||
Fabricate(:active_user, name: "David Taylor", username: "david", groups: [default_allowed_group])
|
||||
Fabricate(
|
||||
:active_user,
|
||||
name: "David Taylor",
|
||||
username: "david",
|
||||
groups: [default_allowed_group],
|
||||
)
|
||||
end
|
||||
let(:non_admin) { Fabricate(:user, groups: [default_allowed_group]) }
|
||||
fab!(:normal_user) { Fabricate(:user) }
|
||||
|
@ -91,9 +96,7 @@ RSpec.describe DiscourseAssign::AssignController do
|
|||
end
|
||||
|
||||
describe "#suggestions" do
|
||||
before do
|
||||
sign_in(user)
|
||||
end
|
||||
before { sign_in(user) }
|
||||
|
||||
it "suggests the current user + the last 6 previously assigned users" do
|
||||
assignees = 10.times.map { |_| assign_user_to_post.username }
|
||||
|
@ -106,7 +109,9 @@ RSpec.describe DiscourseAssign::AssignController do
|
|||
|
||||
it "doesn't suggest users on holiday" do
|
||||
user_on_vacation = assign_user_to_post
|
||||
user_on_vacation.upsert_custom_fields(DiscourseAssign::DiscourseCalendar::HOLIDAY_CUSTOM_FIELD => "t")
|
||||
user_on_vacation.upsert_custom_fields(
|
||||
DiscourseAssign::DiscourseCalendar::HOLIDAY_CUSTOM_FIELD => "t",
|
||||
)
|
||||
|
||||
get "/assign/suggestions.json"
|
||||
|
||||
|
|
Loading…
Reference in New Issue