Skip to content

Commit

Permalink
Use 'table' alignment for hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
veganstraightedge committed Jun 28, 2019
1 parent e413522 commit fdd9c29
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 66 deletions.
5 changes: 2 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ AllCops:
Exclude:
- 'db/**/*'

# TEMP: Rubocop is wrongly marking hashes as not aligned that are in fact aligned
# https://gist.github.com/veganstraightedge/2bfcd5e5eaacda9f0d9120fb2d285878
Layout/AlignHash:
Enabled: false
EnforcedHashRocketStyle: table
EnforcedColonStyle: table

# TEMP: private and def foo() are at the same indentation level
# This should NOT cause an offense but it does. ¯\_(ツ)_/¯
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/admin_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def admin_articles_table_row_classes article
def category_check_box form:, category:
form.check_box :category_ids,
{
id: "article_category_ids_#{category.id}",
name: 'article[category_ids][]',
id: "article_category_ids_#{category.id}",
name: 'article[category_ids][]',
class: 'form-check-input'
},
category.id,
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/markdown_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def render_markdown text

Kramdown::Document.new(
MarkdownMedia.parse(text, include_media: media_mode?),
input: :kramdown,
remove_block_html_tags: false,
input: :kramdown,
remove_block_html_tags: false,
transliterated_header_ids: true
).to_html.html_safe
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/tools_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module ToolsHelper
def link_to_tool tool:, type:
link_to text_for_tool_link(type: type, tool: tool),
[tool],
class: classes_for_tool_link(type: type),
class: classes_for_tool_link(type: type),
target: link_target_for_tool(tool: tool)
end

Expand Down
4 changes: 2 additions & 2 deletions app/middlewares/rack/pic_twitter_redirect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def call env
encoding_options = {
invalid: :replace, # Replace invalid byte sequences
undef: :replace, # Replace anything not defined in ASCII
replace: '', # Use a blank for those replacements
universal_newline: true # Always break lines with \n
replace: '', # Use a blank for those replacements
universal_newline: true # Always break lines with \n
}

ascii_location = location.encode(Encoding.find('ASCII'), encoding_options)
Expand Down
6 changes: 3 additions & 3 deletions app/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def in_collection?
def content_rendered include_media: true
Kramdown::Document.new(
MarkdownMedia.parse(content, include_media: include_media),
input: content_format.to_sym,
remove_block_html_tags: false,
input: content_format.to_sym,
remove_block_html_tags: false,
transliterated_header_ids: true,
html_to_native: true
html_to_native: true
).to_html.html_safe
end

Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/meta_description.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def meta_description
if summary.blank?
html = Kramdown::Document.new(
content,
input: :kramdown,
remove_block_html_tags: false,
input: :kramdown,
remove_block_html_tags: false,
transliterated_header_ids: true
).to_html.to_s

Expand Down
8 changes: 4 additions & 4 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class User < ApplicationRecord
validates :username, presence: true, uniqueness: true, on: %i[create update]

validates :password,
presence: true,
on: :create,
length: { minimum: PASSWORD_MINIMUM_LENGTH },
presence: true,
on: :create,
length: { minimum: PASSWORD_MINIMUM_LENGTH },
exclusion: {
in: [
in: [
'mickey fickie fire cracker soap on a rope',
'a long passphrase to meet the minimum length'
],
Expand Down
12 changes: 6 additions & 6 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
Rails.application.initialize!

ActionMailer::Base.smtp_settings = {
user_name: ENV['SENDGRID_USERNAME'],
password: ENV['SENDGRID_PASSWORD'],
domain: 'crimethinc.com',
address: 'smtp.sendgrid.net',
port: 587,
authentication: :plain,
user_name: ENV['SENDGRID_USERNAME'],
password: ENV['SENDGRID_PASSWORD'],
domain: 'crimethinc.com',
address: 'smtp.sendgrid.net',
port: 587,
authentication: :plain,
enable_starttls_auto: true
}
12 changes: 6 additions & 6 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

# To Change Everything (TCE)
get 'tce(/:lang)',
to: 'to_change_everything#show',
to: 'to_change_everything#show',
defaults: { lang: 'english' },
as: :to_change_everything
as: :to_change_everything

# Steal Something from Work Day (SSfWD)
get 'steal-something-from-work-day(/:locale)',
to: 'steal_something_from_work_day#show',
to: 'steal_something_from_work_day#show',
defaults: { locale: 'english' },
as: :steal_something_from_work_day
as: :steal_something_from_work_day

# Articles
# Article listings by year, optional month, optional day
Expand All @@ -39,8 +39,8 @@

# Article edit convenience route
get ':year/:month/:day/:slug/edit',
controller: 'admin/articles',
action: 'edit',
controller: 'admin/articles',
action: 'edit',
constraints: { year: /\d{4}/, month: /\d{2}/, day: /\d{2}/ }

# Draft Articles and Pages
Expand Down
8 changes: 4 additions & 4 deletions spec/mailers/previews/support_mailer_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ class SupportMailerPreview < ActionMailer::Preview
def edit
support_session = SupportSession.new(
stripe_customer_id: 'stripe-customore-id-123',
token: SecureRandom.urlsafe_base64(nil, false),
expires_at: 1.hour.from_now
token: SecureRandom.urlsafe_base64(nil, false),
expires_at: 1.hour.from_now
)

SupportMailer.with(
email: '[email protected]',
email: '[email protected]',
support_session: support_session,
host: 'localhost:3333'
host: 'localhost:3333'
).edit_subscription
end
end
2 changes: 1 addition & 1 deletion spec/models/article_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
new_article = build(
:article,
tweet: "ab\r\ncd" * 50,
summary: "a\r\nbc" * 50
summary: "a\r\nbc" * 50
)

expect(new_article).to be_valid
Expand Down
10 changes: 5 additions & 5 deletions spec/system/special_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def create_page_with(slug)
end

create(:page,
title: "title for #{slug}",
content: "content for #{slug}",
title: "title for #{slug}",
content: "content for #{slug}",
publication_status: 'published',
published_at: Time.zone.parse('2017-01-01'),
slug: slug.to_s,
image: 'https://cloudfront.crimethinc.com/assets/pages/start/start-header.jpg')
published_at: Time.zone.parse('2017-01-01'),
slug: slug.to_s,
image: 'https://cloudfront.crimethinc.com/assets/pages/start/start-header.jpg')
end
end
50 changes: 25 additions & 25 deletions spec/system/tools_index_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
describe 'Tools Pages' do
it 'Renders published logos calling /logos' do
FactoryBot.create(:logo,
title: 'published',
published_at: 1.day.ago,
title: 'published',
published_at: 1.day.ago,
publication_status: 'published')

FactoryBot.create(:logo,
title: 'not live',
published_at: 1.day.from_now,
title: 'not live',
published_at: 1.day.from_now,
publication_status: 'published')

FactoryBot.create(:logo,
title: 'draft',
title: 'draft',
publication_status: 'draft')

visit '/logos'
Expand All @@ -25,17 +25,17 @@

it 'Renders published stickers calling /stickers' do
FactoryBot.create(:sticker,
title: 'published',
published_at: 1.day.ago,
title: 'published',
published_at: 1.day.ago,
publication_status: 'published')

FactoryBot.create(:sticker,
title: 'not live',
published_at: 1.day.from_now,
title: 'not live',
published_at: 1.day.from_now,
publication_status: 'published')

FactoryBot.create(:sticker,
title: 'draft',
title: 'draft',
publication_status: 'draft')

visit '/stickers'
Expand All @@ -47,17 +47,17 @@

it 'Renders published zines calling /zines' do
FactoryBot.create(:zine,
title: 'published',
published_at: 1.day.ago,
title: 'published',
published_at: 1.day.ago,
publication_status: 'published')

FactoryBot.create(:zine,
title: 'not live',
published_at: 1.day.from_now,
title: 'not live',
published_at: 1.day.from_now,
publication_status: 'published')

FactoryBot.create(:zine,
title: 'draft',
title: 'draft',
publication_status: 'draft')

visit '/zines'
Expand All @@ -69,17 +69,17 @@

it 'Renders published posters calling /posters' do
FactoryBot.create(:poster,
title: 'published',
published_at: 1.day.ago,
title: 'published',
published_at: 1.day.ago,
publication_status: 'published')

FactoryBot.create(:poster,
title: 'not live',
published_at: 1.day.from_now,
title: 'not live',
published_at: 1.day.from_now,
publication_status: 'published')

FactoryBot.create(:poster,
title: 'draft',
title: 'draft',
publication_status: 'draft')

visit '/posters'
Expand All @@ -91,17 +91,17 @@

it 'Renders published videos calling /videos' do
FactoryBot.create(:video,
title: 'published',
published_at: 1.day.ago,
title: 'published',
published_at: 1.day.ago,
publication_status: 'published')

FactoryBot.create(:video,
title: 'not live',
published_at: 1.day.from_now,
title: 'not live',
published_at: 1.day.from_now,
publication_status: 'published')

FactoryBot.create(:video,
title: 'draft',
title: 'draft',
publication_status: 'draft')

visit '/videos'
Expand Down

0 comments on commit fdd9c29

Please sign in to comment.