Skip to content

Commit 3d95c11

Browse files
authored
Get CI to pass (#505)
* fix linting errors for CI * fix rubocop errors * ignore vendor/bundle in CI * bootstrap-loader isn't resolving relative paths correctly * remove security audit gems & tasks
1 parent c56f052 commit 3d95c11

32 files changed

Lines changed: 168 additions & 192 deletions

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ coverage/
66
spec/support/
77
client/app/libs/i18n/translations.js
88
client/app/libs/i18n/default.js
9+
vendor/bundle

.rubocop.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Metrics/BlockLength:
7070
- 'lib/tasks/linters.rake'
7171
- 'spec/rails_helper.rb'
7272
- 'spec/system/add_new_comment_spec.rb'
73-
- 'spec/system/shared/examples.rb'
73+
- 'spec/system/react_router_demo_spec.rb'
7474

7575
Metrics/ParameterLists:
7676
Max: 5
@@ -105,4 +105,3 @@ RSpec/MultipleExpectations:
105105

106106
RSpec/MultipleMemoizedHelpers:
107107
Max: 12
108-

Gemfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,10 @@ group :development, :test do
6868
################################################################################
6969
# Linters and Security
7070
gem "rubocop", "1.24.1", require: false
71-
gem "rubocop-rspec", "~> 2.7"
72-
gem 'rubocop-rails'
7371
gem "rubocop-performance", "~> 1.13"
72+
gem "rubocop-rails"
73+
gem "rubocop-rspec", "~> 2.7"
7474
# Critical that require: false be set! https://github.com/brigade/scss-lint/issues/278
75-
gem "brakeman", require: false
76-
gem "bundler-audit", require: false
7775
gem "scss_lint", require: false
7876

7977
################################################################################
@@ -93,7 +91,7 @@ end
9391
group :test do
9492
gem "capybara"
9593
gem "capybara-screenshot"
96-
gem 'coveralls_reborn', '~> 0.25.0', require: false
94+
gem "coveralls_reborn", "~> 0.25.0", require: false
9795
gem "database_cleaner"
9896
gem "generator_spec"
9997
gem "launchy"

Gemfile.lock

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ GEM
6969
bindex (0.8.1)
7070
binding_of_caller (1.0.0)
7171
debug_inspector (>= 0.0.1)
72-
brakeman (5.2.0)
7372
builder (3.2.4)
74-
bundler-audit (0.9.0.1)
75-
bundler (>= 1.2.0, < 3)
76-
thor (~> 1.0)
7773
byebug (11.1.3)
7874
capybara (3.36.0)
7975
addressable
@@ -364,8 +360,6 @@ PLATFORMS
364360
DEPENDENCIES
365361
autoprefixer-rails
366362
awesome_print
367-
brakeman
368-
bundler-audit
369363
capybara
370364
capybara-screenshot
371365
coffee-rails

app/models/application_record.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# frozen_string_literal: true
2+
3+
class ApplicationRecord < ActiveRecord::Base
4+
self.abstract_class = true
5+
end

app/models/comment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
class Comment < ActiveRecord::Base
3+
class Comment < ApplicationRecord
44
validates :author, :text, presence: true
55
after_commit { CommentRelayJob.perform_later(self) }
66
end

client/app/assets/styles/bootstrap-pre-customizations.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// These variables get loaded BEFORE Bootstrap thus overriding them in Bootstrap.
22
@import './app-variables';
33

4-
// This path is relative to this file!
5-
$fonts-url-path: '../fonts';
4+
// This path is relative to node_modules/bootstrap-loader
5+
$fonts-url-path: '../../client/app/assets/fonts';
66

77
@font-face {
88
font-family: 'OpenSans-Light';

client/app/bundles/comments/startup/NavigationBarApp.jsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import * as paths from '../constants/paths';
1414
* This is used for the client rendering hook after the page html is rendered.
1515
* React will see that the state is the same and not do anything.
1616
*/
17-
function NavigationBarApp(_props, railsContext) {
17+
function NavigationBarAppFactory(_props, railsContext) {
1818
// This is where we get the existing store.
1919
const { pathname } = railsContext;
2020
let store;
@@ -23,16 +23,20 @@ function NavigationBarApp(_props, railsContext) {
2323
} else if (pathname === paths.NO_ROUTER_PATH) {
2424
store = ReactOnRails.getStore('commentsStore', false);
2525
} else {
26-
return () => <NavigationBar {...{ pathname }} />;
26+
return function NavigationBarApp() {
27+
return <NavigationBar {...{ pathname }} />;
28+
};
2729
}
2830

2931
// eslint interprets the return as a new component definition, which is not the case
3032
// eslint-disable-next-line react/display-name, react/no-unstable-nested-components
31-
return () => (
32-
<Provider store={store}>
33-
<NavigationBarContainer />
34-
</Provider>
35-
);
33+
return function NavigationBarApp() {
34+
return (
35+
<Provider store={store}>
36+
<NavigationBarContainer />
37+
</Provider>
38+
);
39+
};
3640
}
3741

38-
export default NavigationBarApp;
42+
export default NavigationBarAppFactory;

client/app/bundles/comments/startup/ServerRouterApp.jsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ function ServerRouterApp(_props, railsContext) {
2525

2626
// Important that you don't do this if you are redirecting or have an error.
2727
// eslint-disable-next-line react/display-name
28-
return () => (
29-
<Provider store={store}>
30-
<StaticRouter location={location} context={context}>
31-
{routes}
32-
</StaticRouter>
33-
</Provider>
34-
);
28+
return function ServerRouter() {
29+
return (
30+
<Provider store={store}>
31+
<StaticRouter location={location} context={context}>
32+
{routes}
33+
</StaticRouter>
34+
</Provider>
35+
);
36+
};
3537
}
3638

3739
export default ServerRouterApp;

client/app/packs/client-bundle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ReactOnRails from 'react-on-rails';
22
import 'bootstrap-loader';
3+
// eslint-disable-next-line import/no-webpack-loader-syntax
34
import 'expose-loader?exposes=$,jQuery!jquery';
45
import 'jquery-ujs';
56

0 commit comments

Comments
 (0)