Skip to content

Commit

Permalink
inertia - add maryland svg, fix census query, add unique index to bil…
Browse files Browse the repository at this point in the history
…l.external_id
  • Loading branch information
dcordz committed Aug 26, 2024
1 parent 4d80b4c commit 7dbaaab
Show file tree
Hide file tree
Showing 141 changed files with 1,337 additions and 1,074 deletions.
21 changes: 21 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env zsh

set -eu

changed_files=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')

echo "Running prettier on changed files"
npx prettier $changed_files --write --ignore-unknown

echo "Run ESLint on changed files"
npx eslint -c eslint.config.js --no-warn-ignored $changed_files

echo "Run tsc on project"
npx tsc --project tsconfig.json

echo "Run rubocop on changed files, autofix any fixable offenses"
bundle exec rubocop --autocorrect --only-recognized-file-types $changed_files

bundle exec annotate --models

git update-index --again
22 changes: 22 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
inherit_mode:
merge:
- Exclude

require:
- standard
- rubocop-performance

inherit_gem:
standard: config/base.yml
standard-performance: config/base.yml
standard-custom: config/base.yml

inherit_from:
- .rubocop/rails.yml
- .rubocop/rspec.yml
- .rubocop/strict.yml

AllCops:
NewCops: disable
SuggestExtensions: false
TargetRubyVersion: 3.2
198 changes: 198 additions & 0 deletions .rubocop/rails.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Based on removed standard configuration:
# https://github.com/testdouble/standard/commit/94d133f477a5694084ac974d5ee01e8a66ce777e#diff-65478e10d5b2ef41c7293a110c0e6b7c

require:
- rubocop-rails

Rails/ActionFilter:
Enabled: true
EnforcedStyle: action
Include:
- app/controllers/**/*.rb

Rails/ActiveRecordAliases:
Enabled: true

Rails/ActiveSupportAliases:
Enabled: true

Rails/ApplicationJob:
Enabled: true

Rails/ApplicationRecord:
Enabled: true

Rails/AssertNot:
Enabled: true
Include:
- "**/test/**/*"

Rails/Blank:
Enabled: true
# Convert usages of `nil? || empty?` to `blank?`
NilOrEmpty: true
# Convert usages of `!present?` to `blank?`
NotPresent: true
# Convert usages of `unless present?` to `if blank?`
UnlessPresent: true

Rails/BulkChangeTable:
Enabled: true
Database: null
Include:
- db/migrate/*.rb

Rails/CreateTableWithTimestamps:
Enabled: true
Include:
- db/migrate/*.rb

Rails/Date:
Enabled: true
EnforcedStyle: flexible

Rails/Delegate:
Enabled: true
EnforceForPrefixed: true

Rails/DelegateAllowBlank:
Enabled: true

Rails/DynamicFindBy:
Enabled: true
Whitelist:
- find_by_sql

Rails/EnumUniqueness:
Enabled: true
Include:
- app/models/**/*.rb

Rails/EnvironmentComparison:
Enabled: true

Rails/Exit:
Enabled: true
Include:
- app/**/*.rb
- config/**/*.rb
- lib/**/*.rb
Exclude:
- lib/**/*.rake

Rails/FilePath:
Enabled: true
EnforcedStyle: arguments

Rails/FindBy:
Enabled: true
Include:
- app/models/**/*.rb

Rails/FindEach:
Enabled: true
Include:
- app/models/**/*.rb

Rails/HasAndBelongsToMany:
Enabled: true
Include:
- app/models/**/*.rb

Rails/HttpPositionalArguments:
Enabled: true
Include:
- "spec/**/*"
- "test/**/*"

Rails/HttpStatus:
Enabled: true
EnforcedStyle: symbolic

Rails/InverseOf:
Enabled: true
Include:
- app/models/**/*.rb

Rails/LexicallyScopedActionFilter:
Enabled: true
Safe: false
Include:
- app/controllers/**/*.rb

Rails/NotNullColumn:
Enabled: true
Include:
- db/migrate/*.rb

Rails/Output:
Enabled: true
Include:
- app/**/*.rb
- config/**/*.rb
- db/**/*.rb
- lib/**/*.rb

Rails/OutputSafety:
Enabled: true

Rails/PluralizationGrammar:
Enabled: true

Rails/Presence:
Enabled: true

Rails/Present:
Enabled: true
NotNilAndNotEmpty: true
NotBlank: true
UnlessBlank: true

Rails/ReadWriteAttribute:
Enabled: true
Include:
- app/models/**/*.rb

Rails/RedundantReceiverInWithOptions:
Enabled: true

Rails/RefuteMethods:
Enabled: true
Include:
- "**/test/**/*"

Rails/RelativeDateConstant:
Enabled: true
AutoCorrect: false

Rails/RequestReferer:
Enabled: true
EnforcedStyle: referer

Rails/ReversibleMigration:
Enabled: true
Include:
- db/migrate/*.rb

Rails/SafeNavigation:
Enabled: true
ConvertTry: false

Rails/ScopeArgs:
Enabled: true
Include:
- app/models/**/*.rb

Rails/TimeZone:
Enabled: true
EnforcedStyle: flexible

Rails/UniqBeforePluck:
Enabled: true
EnforcedStyle: conservative
AutoCorrect: false

Rails/Validation:
Enabled: true
Include:
- app/models/**/*.rb
56 changes: 56 additions & 0 deletions .rubocop/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
require:
- rubocop-rspec

# Disable all cops by default,
# only enable those defined explcitly in this configuration file
RSpec:
Enabled: false

RSpec/Focus:
Enabled: true

RSpec/EmptyExampleGroup:
Enabled: true

RSpec/EmptyLineAfterExampleGroup:
Enabled: true

RSpec/EmptyLineAfterFinalLet:
Enabled: true

RSpec/EmptyLineAfterHook:
Enabled: true

RSpec/EmptyLineAfterSubject:
Enabled: true

RSpec/HookArgument:
Enabled: true

RSpec/HooksBeforeExamples:
Enabled: true

RSpec/ImplicitExpect:
Enabled: true

RSpec/IteratedExpectation:
Enabled: true

RSpec/LetBeforeExamples:
Enabled: true

RSpec/MissingExampleGroupArgument:
Enabled: true

RSpec/ReceiveCounts:
Enabled: true
# The below create errors in ruby lsp

# Capybara/CurrentPathExpectation:
# Enabled: true

# RSpec/FactoryBot/AttributeDefinedStatically:
# Enabled: true

# RSpec/FactoryBot/CreateList:
# Enabled: true
19 changes: 19 additions & 0 deletions .rubocop/strict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Lint/Debugger: # don't leave binding.pry
Enabled: true
Exclude: []

RSpec/Focus: # run ALL tests on CI
Enabled: true
Exclude: []

Rails/Output: # Don't leave puts-debugging
Enabled: true
Exclude: []

Rails/FindEach: # each could badly affect the performance, use find_each
Enabled: true
Exclude: []

Rails/UniqBeforePluck: # uniq.pluck and not pluck.uniq
Enabled: true
Exclude: []
Loading

0 comments on commit 7dbaaab

Please sign in to comment.