Skip to content

Commit

Permalink
Fix prettier issues
Browse files Browse the repository at this point in the history
  • Loading branch information
misaka committed Jan 16, 2023
1 parent 84d9ee9 commit e8d1bb8
Show file tree
Hide file tree
Showing 47 changed files with 338 additions and 336 deletions.
14 changes: 7 additions & 7 deletions .solargraph.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
include:
- "**/*.rb"
- "**/*.rb"
exclude:
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
- spec/**/*
- test/**/*
- vendor/**/*
- ".bundle/**/*"
require: []
domains: []
reporters:
- rubocop
- require_not_found
- rubocop
- require_not_found
formatter:
rubocop:
cops: safe
Expand Down
24 changes: 12 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gem "jbuilder"
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
Expand All @@ -55,23 +55,23 @@ gem "seedbank"
gem "awesome_print"

# Add support to Rails for serviceworker
gem 'serviceworker-rails'
gem "serviceworker-rails"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
gem "debug", platforms: %i[mri mingw x64_mingw]
end

group :development do
gem 'annotate', require: false
gem 'prettier_print', require: false
gem 'rladr'
gem 'rubocop-govuk', require: false
gem 'solargraph', require: false
gem 'solargraph-rails', require: false
gem 'syntax_tree', require: false
gem 'syntax_tree-haml', require: false
gem 'syntax_tree-rbs', require: false
gem "annotate", require: false
gem "prettier_print", require: false
gem "rladr"
gem "rubocop-govuk", require: false
gem "solargraph", require: false
gem "solargraph-rails", require: false
gem "syntax_tree", require: false
gem "syntax_tree-haml", require: false
gem "syntax_tree-rbs", require: false
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"

Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ is a prototype used for testing service designs and implementation technology.

This project depends on:

- [Ruby](https://www.ruby-lang.org/)
- [Ruby on Rails](https://rubyonrails.org/)
- [NodeJS](https://nodejs.org/)
- [Yarn](https://yarnpkg.com/)
- [Postgres](https://www.postgresql.org/)
- [Ruby](https://www.ruby-lang.org/)
- [Ruby on Rails](https://rubyonrails.org/)
- [NodeJS](https://nodejs.org/)
- [Yarn](https://yarnpkg.com/)
- [Postgres](https://www.postgresql.org/)

The instructions below assume you are using `asdf` to manage the necessary
versions of the above.
Expand Down Expand Up @@ -75,6 +75,7 @@ To run the linters:
```bash
bin/lint
```

### Intellisense

[solargraph](https://github.com/castwide/solargraph) is bundled as part of the
Expand All @@ -93,6 +94,7 @@ You'll also need to configure your editor's `solargraph` plugin to
```diff
+ "solargraph.useBundler": true,
```

### PostgreSQL

The script `bin/db` is included to start up PostgreSQL for setups that don't use
Expand All @@ -118,7 +120,7 @@ determine postgres's installation directory and setting up logging accordingly.

Setup the DB the standard way for a Rails app:

``` bash
```bash
rails db:setup
rails db:migrate
```
Expand All @@ -128,7 +130,7 @@ rails db:migrate
This application comes with a `Procfile.dev` for use with `foreman` in
development environments. Use the script `bin/dev` to run it:

``` bash
```bash
$ bin/dev
13:07:31 web.1 | started with pid 73965
13:07:31 css.1 | started with pid 73966
Expand All @@ -140,13 +142,12 @@ $ bin/dev

This application comes with Cypress BDD tests. To run the tests use:

``` bash
```bash
yarn cypress run
```

Or open the Cypress app to interactively run the tests:

``` bash
```bash
yarn cypress open
```

2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.sass.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ $govuk-assets-path: "/";

.app-u-frutiger,
.app-u-frutiger * {
font-family: "Frutiger W01", Arial, sans-serif !important
font-family: "Frutiger W01", Arial, sans-serif !important;
}
19 changes: 10 additions & 9 deletions app/controllers/children_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ChildrenController < ApplicationController
before_action :set_child, only: %i[ show edit update destroy ]
before_action :set_child, only: %i[show edit update destroy]

# GET /children
def index
Expand Down Expand Up @@ -46,13 +46,14 @@ def destroy
end

private
# Use callbacks to share common setup or constraints between actions.
def set_child
@child = Child.find(params[:id])
end

# Only allow a list of trusted parameters through.
def child_params
params.fetch(:child, {})
end
# Use callbacks to share common setup or constraints between actions.
def set_child
@child = Child.find(params[:id])
end

# Only allow a list of trusted parameters through.
def child_params
params.fetch(:child, {})
end
end
8 changes: 4 additions & 4 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ class ErrorsController < ApplicationController
skip_before_action :verify_authenticity_token

def not_found
render 'not_found', status: :not_found
render "not_found", status: :not_found
end

def unprocessable_entity
render 'unprocessable_entity', status: :unprocessable_entity
render "unprocessable_entity", status: :unprocessable_entity
end

def too_many_requests
render 'too_many_requests', status: :too_many_requests
render "too_many_requests", status: :too_many_requests
end

def internal_server_error
render 'internal_server_error', status: :internal_server_error
render "internal_server_error", status: :internal_server_error
end
end
1 change: 0 additions & 1 deletion app/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ import { initAll } from "govuk-frontend";
import { initServiceWorker } from "./serviceworker-companion";
import "./controllers";


initAll();
initServiceWorker();
10 changes: 5 additions & 5 deletions app/javascript/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Application } from "@hotwired/stimulus"
import { Application } from "@hotwired/stimulus";

const application = Application.start()
const application = Application.start();

// Configure Stimulus development experience
application.debug = false
window.Stimulus = application
application.debug = false;
window.Stimulus = application;

export { application }
export { application };
8 changes: 5 additions & 3 deletions app/javascript/controllers/connectivity_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { wb } from "../serviceworker-companion.js";

// Connects to data-controller="offline"
export default class extends Controller {
static targets = [ "status", "button" ];
static targets = ["status", "button"];

async connect() {
this.connectionStatus = await wb.messageSW({type: 'GET_CONNECTION_STATUS'});
this.connectionStatus = await wb.messageSW({
type: "GET_CONNECTION_STATUS",
});
}

get status() {
Expand All @@ -29,6 +31,6 @@ export default class extends Controller {
}

async toggleConnection() {
this.connectionStatus = await wb.messageSW({type: 'TOGGLE_CONNECTION'});
this.connectionStatus = await wb.messageSW({ type: "TOGGLE_CONNECTION" });
}
}
6 changes: 3 additions & 3 deletions app/javascript/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Run that command whenever you add a new controller or create them with
// ./bin/rails generate stimulus controllerName

import { application } from "./application"
import { application } from "./application";

import ConnectivityController from "./connectivity_controller"
application.register("connectivity", ConnectivityController)
import ConnectivityController from "./connectivity_controller";
application.register("connectivity", ConnectivityController);
7 changes: 3 additions & 4 deletions app/javascript/serviceworker-companion.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

import { Workbox } from 'workbox-window';
import { Workbox } from "workbox-window";

export let wb;

export function initServiceWorker() {
if ('serviceWorker' in navigator) {
wb = new Workbox('/serviceworker.js');
if ("serviceWorker" in navigator) {
wb = new Workbox("/serviceworker.js");

wb.register();
}
Expand Down
24 changes: 15 additions & 9 deletions app/javascript/serviceworker/serviceworker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CacheOnly, NetworkFirst } from 'workbox-strategies';
import { setDefaultHandler } from 'workbox-routing';
import { CacheOnly, NetworkFirst } from "workbox-strategies";
import { setDefaultHandler } from "workbox-routing";

let connectionStatus = true;

Expand All @@ -14,8 +14,11 @@ function setOnlineMode() {
}

let messageHandlers = {
'TOGGLE_CONNECTION': (event) => {
console.debug("[Service Worker] TOGGLE_CONNECTION set connection status to:", connectionStatus);
TOGGLE_CONNECTION: (event) => {
console.debug(
"[Service Worker] TOGGLE_CONNECTION set connection status to:",
connectionStatus
);
connectionStatus = !connectionStatus;

if (connectionStatus) {
Expand All @@ -27,13 +30,16 @@ let messageHandlers = {
event.ports[0].postMessage(connectionStatus);
},

'GET_CONNECTION_STATUS': (event) => {
console.debug("[Service Worker] GET_CONNECTION_STATUS Returning status:", connectionStatus);
GET_CONNECTION_STATUS: (event) => {
console.debug(
"[Service Worker] GET_CONNECTION_STATUS Returning status:",
connectionStatus
);
event.ports[0].postMessage(connectionStatus);
}
}
},
};

self.addEventListener('message', (event) => {
self.addEventListener("message", (event) => {
if (event.data && event.data.type) {
messageHandlers[event.data.type](event);
}
Expand Down
6 changes: 3 additions & 3 deletions app/models/campaign.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# location_id :integer
#
class Campaign < ApplicationRecord
self.inheritance_column = '__type'
self.inheritance_column = "__type"

belongs_to :location, class_name: 'School'
belongs_to :location, class_name: "School"
has_and_belongs_to_many :children

enum :type, ['HPV']
enum :type, ["HPV"]
end
8 changes: 4 additions & 4 deletions app/models/child.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# updated_at :datetime not null
#
class Child < ApplicationRecord
enum :gp, ['Local GP']
enum :screening, ['Approved for vaccination']
enum :consent, ['Parental consent (digital)']
enum :seen, ['Not yet']
enum :gp, ["Local GP"]
enum :screening, ["Approved for vaccination"]
enum :consent, ["Parental consent (digital)"]
enum :seen, ["Not yet"]

has_and_belongs_to_many :campaigns

Expand Down
4 changes: 2 additions & 2 deletions app/models/school.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
# updated_at :datetime not null
#
class School < ApplicationRecord
self.inheritance_column = '__type'
self.inheritance_column = "__type"

has_one :campaign

enum :phase, ['Primary']
enum :phase, ["Primary"]
end
Loading

0 comments on commit e8d1bb8

Please sign in to comment.