Skip to content

Commit 989edeb

Browse files
committed
Make CI lint checks block on errors
Fix existing rubocop and eslint violations so that lint steps in the GitHub Actions workflow can run without continue-on-error. Lint failures now fail the PR check instead of being silently downgraded to warnings. REDMINE-21261
1 parent a23d6d8 commit 989edeb

File tree

12 files changed

+21
-29
lines changed

12 files changed

+21
-29
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,10 @@ jobs:
6262
# Lint
6363

6464
- name: Run RuboCop
65-
shell: bash
66-
continue-on-error: true
67-
run: |
68-
bundle exec rubocop --format github | sed 's/::error/::warning/g'
65+
run: bundle exec rubocop --format github
6966

7067
- name: Run ESLint in pageflow package
71-
shell: bash
72-
continue-on-error: true
73-
run: |
74-
yarn --cwd package lint . --format @jamesacarr/github-actions
68+
run: yarn --cwd package lint . --format @jamesacarr/github-actions
7569

7670
- name: Run ESLint in pageflow-scrolled
77-
shell: bash
78-
continue-on-error: true
79-
run: |
80-
yarn --cwd entry_types/scrolled/package lint . --format @jamesacarr/github-actions
71+
run: yarn --cwd entry_types/scrolled/package lint . --format @jamesacarr/github-actions

admins/pageflow/entry.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def site_policy_scope
318318
end
319319

320320
# rubocop:todo Metrics/PerceivedComplexity
321-
def permitted_attributes # rubocop:todo Metrics/AbcSize
321+
def permitted_attributes # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity
322322
result = [:title, :type_name, {permalink_attributes: [:slug, :directory_id]}]
323323
target = if !params[:id] && current_user.admin?
324324
Account.first
@@ -331,7 +331,7 @@ def permitted_attributes # rubocop:todo Metrics/AbcSize
331331
result += permitted_account_attributes
332332

333333
result << :folder_id if create_or_new_action? ||
334-
(params[:id] && authorized?(:configure_folder_for, resource))
334+
(params[:id] && authorized?(:configure_folder_for, resource))
335335

336336
accounts = if params[:id]
337337
resource.account

entry_types/scrolled/lib/pageflow_scrolled/plugin.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module PageflowScrolled
22
# @api private
3-
class Plugin < Pageflow::Plugin
3+
class Plugin < Pageflow::Plugin # rubocop:disable Metrics/ClassLength
44
def configure(config)
55
config.features.register('scrolled_entry_type') do |feature_config|
66
feature_config.entry_types.register(PageflowScrolled.entry_type)
@@ -71,7 +71,8 @@ def configure(config)
7171
'section_default_padding_top' => 'max(10em, 20svh)',
7272
'section_default_padding_bottom' => 'max(10em, 20svh)',
7373
'content_element_margin_style_default' => '2em',
74-
'content_element_box_shadow_style_default' => '0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.15)',
74+
'content_element_box_shadow_style_default' =>
75+
'0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.15)',
7576
'box_shadow_clip_margin_bottom' => '3rem',
7677
'outline_color' => '#a0a0a080'
7778
},

entry_types/scrolled/package/spec/frontend/inlineEditing/LinkTooltip-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('LinkTooltip', () => {
247247
<MainStorylineActivity activeExcursion={activeExcursion}>
248248
<LinkTooltipProvider>
249249
<LinkPreview href="https://example.com" openInNewTab={false}>
250-
<a>Test Link</a>
250+
<a href="https://example.com">Test Link</a>
251251
</LinkPreview>
252252
</LinkTooltipProvider>
253253
</MainStorylineActivity>

entry_types/scrolled/package/spec/frontend/usePrivacyLink-spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ describe('usePrivacyLink', () => {
127127

128128
it('returns props with onClick for javascript: privacy settings url', () => {
129129
const {result} = renderHookInEntry(
130-
// eslint-disable-next-line no-script-url
131130
() => usePrivacyLink(), {
132131
seed: {
133132
legalInfo: {
133+
// eslint-disable-next-line no-script-url
134134
privacy: {url: 'javascript:pageflowDisplayPrivacySettings()'}
135135
}
136136
}
@@ -144,10 +144,10 @@ describe('usePrivacyLink', () => {
144144

145145
it('does not append vendors to javascript: privacy settings url', () => {
146146
const {result} = renderHookInEntry(
147-
// eslint-disable-next-line no-script-url
148147
() => usePrivacyLink({vendors: 'spotify'}), {
149148
seed: {
150149
legalInfo: {
150+
// eslint-disable-next-line no-script-url
151151
privacy: {url: 'javascript:pageflowDisplayPrivacySettings()'}
152152
}
153153
}

entry_types/scrolled/package/src/frontend/useScrollPositionLifecycle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useRef, useEffect, useContext, useMemo, createContext, useState} from 'react';
1+
import React, {useRef, useEffect, useContext, useMemo, createContext} from 'react';
22
import classNames from 'classnames';
33
import {useOnScreen} from './useOnScreen';
44
import {useDelayedBoolean} from './useDelayedBoolean';

entry_types/scrolled/spec/helpers/pageflow_scrolled/editor/entry_json_seed_helper_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def render(helper, entry)
119119
pageflow_configure do |config|
120120
config.for_entry_type(PageflowScrolled.entry_type) do |entry_type_config|
121121
entry_type_config.consent_vendor_url_matchers = {
122-
/\.some-vendor\.com\// => 'someVendor'
122+
%r{\.some-vendor\.com/} => 'someVendor'
123123
}
124124
end
125125
end

entry_types/scrolled/spec/pageflow_scrolled/plugin_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def request(uri = 'https://example.com/some-entry')
4242
pageflow_configure do |config|
4343
config.for_entry_type(PageflowScrolled.entry_type) do |entry_type_config|
4444
entry_type_config.consent_vendor_url_matchers = {
45-
/\.typeform\.com\// => 'typeform'
45+
%r{\.typeform\.com/} => 'typeform'
4646
}
4747
end
4848
end
@@ -62,7 +62,7 @@ def request(uri = 'https://example.com/some-entry')
6262
pageflow_configure do |config|
6363
config.for_entry_type(PageflowScrolled.entry_type) do |entry_type_config|
6464
entry_type_config.consent_vendor_url_matchers = {
65-
/\.typeform\.com\// => 'typeform'
65+
%r{\.typeform\.com/} => 'typeform'
6666
}
6767
end
6868
end
@@ -82,7 +82,7 @@ def request(uri = 'https://example.com/some-entry')
8282
pageflow_configure do |config|
8383
config.for_entry_type(PageflowScrolled.entry_type) do |entry_type_config|
8484
entry_type_config.consent_vendor_url_matchers = {
85-
/google\.com\/maps\/embed/ => 'googleMaps'
85+
%r{google\.com/maps/embed} => 'googleMaps'
8686
}
8787
end
8888
end

lib/pageflow/file_types.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def find_by_model!(model)
3535

3636
def with_thumbnail_support
3737
select do |file_type|
38-
file_type.model.instance_methods.include?(:thumbnail_url)
38+
file_type.model.method_defined?(:thumbnail_url)
3939
end
4040
end
4141

package/spec/ui/views/TabsView-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Backbone from 'backbone';
2-
import {fireEvent, within} from '@testing-library/dom';
2+
import {fireEvent} from '@testing-library/dom';
33

44
import {TabsView} from 'pageflow/ui';
55

0 commit comments

Comments
 (0)