jt_tools 0.0.2 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +35 -7
  3. data/.github/FUNDING.yml +4 -0
  4. data/.standard.yml +10 -0
  5. data/Gemfile +3 -1
  6. data/README.md +21 -11
  7. data/Rakefile +5 -5
  8. data/_config.yml +2 -1
  9. data/bin/test +22 -9
  10. data/jt_tools.gemspec +14 -14
  11. data/lib/install/.circleci/{config.yml.sample → config.yml} +72 -30
  12. data/lib/install/.dependabot/config.yml +3 -3
  13. data/lib/install/.editorconfig +70 -0
  14. data/lib/install/.erb-lint.yml +7 -7
  15. data/lib/install/.eslintrc.js +8 -11
  16. data/lib/install/.pronto.yml +3 -5
  17. data/lib/install/.reek.yml +8 -16
  18. data/lib/install/.rubocop.yml +59 -20
  19. data/lib/install/.simplecov +17 -0
  20. data/lib/install/{.yamllint → .yamllint.yml} +2 -1
  21. data/lib/install/Brewfile +15 -10
  22. data/lib/install/Gemfile.tools +4 -2
  23. data/lib/install/app.json +19 -41
  24. data/lib/install/bin/circleci-auto_upgrade_tools +3 -3
  25. data/lib/install/bin/git-hooks/{post-merge.sample → post-merge} +5 -10
  26. data/lib/install/bin/git-hooks/{pre-push.sample → pre-push} +1 -1
  27. data/lib/install/bin/heroku-postdeploy +1 -7
  28. data/lib/install/bin/heroku-release +4 -1
  29. data/lib/install/bin/{lint-github-pr → lint-pr} +0 -0
  30. data/lib/install/bin/tools-setup +1 -1
  31. data/lib/install/bin/tools-upgrade +2 -0
  32. data/lib/install/codecov.yml +5 -4
  33. data/lib/install/config/rails_best_practices.yml +43 -0
  34. data/lib/jt_tools.rb +3 -1
  35. data/lib/jt_tools/railtie.rb +4 -2
  36. data/lib/{version.rb → jt_tools/version.rb} +1 -1
  37. data/lib/tasks/install.rake +6 -4
  38. data/rejuvenation.rb +4 -5
  39. data/template.rb +139 -69
  40. metadata +14 -14
  41. data/_sample/test_erb.html.erb +0 -2
  42. data/_sample/test_eslint.js +0 -1
  43. data/_sample/test_yamlint.yml +0 -1
  44. data/lib/install/.prettierrc.js +0 -4
  45. data/lib/install/lib/test/coverage.rb +0 -14
@@ -1,3 +1,4 @@
1
+ ---
1
2
  version: 1
2
3
  update_configs:
3
4
  # Keep package.json (& lockfiles) up to date as soon as
@@ -12,8 +13,7 @@ update_configs:
12
13
  - match:
13
14
  dependency_type: production
14
15
  update_type: security
15
- version_requirement_updates: off
16
- -
16
+ version_requirement_updates: 'off'
17
17
  - package_manager: ruby:bundler
18
18
  directory: /
19
19
  update_schedule: weekly
@@ -29,4 +29,4 @@ update_configs:
29
29
  dependency_name: rspec*
30
30
  - match:
31
31
  dependency_name: capybara*
32
- version_requirement_updates: off
32
+ version_requirement_updates: 'off'
@@ -0,0 +1,70 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_size = 2
7
+ indent_style = space
8
+ insert_final_newline = true
9
+ max_line_length = 113
10
+ tab_width = 2
11
+ trim_trailing_whitespace = true
12
+
13
+ [*.css]
14
+ ij_continuation_indent_size = 2
15
+ ij_css_align_closing_brace_with_properties = false
16
+ ij_css_blank_lines_around_nested_selector = 1
17
+ ij_css_blank_lines_between_blocks = 1
18
+ ij_css_keep_blank_lines_in_code = 2
19
+ ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
20
+
21
+ [*.haml]
22
+ tab_width = 2
23
+ ij_haml_keep_indents_on_empty_lines = false
24
+
25
+ [*.properties]
26
+
27
+ [*.scss]
28
+ ij_continuation_indent_size = 2
29
+ ij_scss_align_closing_brace_with_properties = false
30
+ ij_scss_blank_lines_around_nested_selector = 1
31
+ ij_scss_blank_lines_between_blocks = 1
32
+
33
+ [.editorconfig]
34
+
35
+ [{*.js,*.cjs}]
36
+ ij_continuation_indent_size = 2
37
+
38
+ [{*.sht,*.html,*.shtm,*.shtml,*.htm}]
39
+ ij_continuation_indent_size = 2
40
+
41
+ [{*.xslt,*.rng,*.ant,*.xsl,*.xsd,*.xul,*.jhm,*.xml,*.tld,*.fxml,*.wsdl,*.jrxml,*.jnlp}]
42
+ tab_width = 2
43
+
44
+ [{*.yml,*.yaml}]
45
+ tab_width = 2
46
+
47
+ [{.babelrc,.stylelintrc,.eslintrc,jest.config,.resultset.json.lock,bowerrc,*.json,*.jsb3,*.jsb2}]
48
+ tab_width = 2
49
+
50
+ [{Podfile,Brewfile,cucumber,yarn,spork,Gemfile.tools,rake,.simplecov,rcov,rails,spec,capfile,gemfile,rakefile,guardfile,isolate,vagrantfile,*.gemspec,*.jbuilder,*.thor,*.rbw,*.ru,*.rb,*.rake}]
51
+ ij_ruby_align_group_field_declarations = false
52
+ ij_ruby_align_multiline_parameters = false
53
+ ij_ruby_blank_lines_around_method = 1
54
+ ij_ruby_chain_calls_alignment = 0
55
+ ij_ruby_convert_brace_block_by_enter = true
56
+ ij_ruby_force_newlines_around_visibility_mods = true
57
+ ij_ruby_indent_private_methods = false
58
+ ij_ruby_indent_protected_methods = false
59
+ ij_ruby_indent_public_methods = false
60
+ ij_ruby_indent_when_cases = false
61
+ ij_ruby_keep_blank_lines_in_declarations = 2
62
+ ij_ruby_keep_line_breaks = true
63
+ ij_ruby_parentheses_around_method_arguments = true
64
+ ij_ruby_spaces_around_assignment_operators = true
65
+ ij_ruby_spaces_around_hashrocket = true
66
+ ij_ruby_spaces_around_other_operators = true
67
+ ij_ruby_spaces_around_range_operators = false
68
+ ij_ruby_spaces_around_relational_operators = true
69
+ ij_ruby_spaces_within_array_initializer_braces = true
70
+ ij_ruby_spaces_within_braces = true
@@ -10,17 +10,17 @@ linters:
10
10
  - .rubocop.yml
11
11
  Layout/InitialIndentation:
12
12
  Enabled: false
13
- Layout/TrailingBlankLines:
13
+ Layout/LineLength:
14
14
  Enabled: false
15
- Layout/TrailingWhitespace:
16
- Enabled: false
17
- Naming/FileName:
18
- Enabled: false
19
- Style/FrozenStringLiteralComment:
15
+ Layout/TrailingEmptyLines:
20
16
  Enabled: false
21
- Metrics/LineLength:
17
+ Layout/TrailingWhitespace:
22
18
  Enabled: false
23
19
  Lint/UselessAssignment:
24
20
  Enabled: false
21
+ Naming/FileName:
22
+ Enabled: false
25
23
  Rails/OutputSafety:
26
24
  Enabled: false
25
+ Style/FrozenStringLiteralComment:
26
+ Enabled: false
@@ -1,16 +1,13 @@
1
1
  // Documentation on http://eslint.org/docs/rules/
2
2
 
3
3
  module.exports = {
4
- "extends": ["airbnb-base", "prettier"],
5
- "plugins": ["prettier"],
6
- "env": {
7
- "browser": true,
8
- "node": true,
9
- "jquery": true
4
+ 'env': {
5
+ 'browser': true,
6
+ 'node': true,
7
+ 'jquery': true
10
8
  },
11
- "rules": {
12
- "no-unused-expressions": ["error", { "allowShortCircuit": true }],
13
- "max-len": ["error", { "code": 113, "tabWidth": 2 }],
14
- "prettier/prettier": ["error"]
9
+ 'rules': {
10
+ 'no-unused-expressions': ['error', { 'allowShortCircuit': true }],
11
+ 'max-len': ['error', { 'code': 113 }]
15
12
  },
16
- };
13
+ }
@@ -3,10 +3,10 @@ all:
3
3
  exclude:
4
4
  - .*
5
5
  - .**/*
6
- - bin/*
7
- - db/schema.rb
8
- - db/migrate/**/*
6
+ - bin/**/*
9
7
  - config/**/*
8
+ - db/migrate/**/*
9
+ - db/schema.rb
10
10
  - docs/**/*
11
11
  - node_modules/**/*
12
12
  - public/**/*
@@ -21,8 +21,6 @@ flay:
21
21
  exclude:
22
22
  - test/**/*
23
23
 
24
- format: "%{runner} %{level} %{msg}"
25
-
26
24
  max_warnings: 10
27
25
  verbose: true
28
26
  warnings_per_review: 5
@@ -2,29 +2,21 @@
2
2
  detectors:
3
3
  IrresponsibleModule:
4
4
  enabled: false
5
+ DuplicateMethodCall:
6
+ max_calls: 4
7
+ FeatureEnvy:
8
+ enabled: false
5
9
  UncommunicativeVariableName:
6
10
  accept:
7
11
  - e
8
- NestedIterators:
9
- exclude:
10
- - "ActiveJob::TestHelper#enqueued_jobs_for"
12
+ - i
13
+ - v
11
14
  UnusedPrivateMethod:
12
15
  enabled: false
13
- DuplicateMethodCall:
14
- max_calls: 4
16
+ UtilityFunction:
17
+ enabled: false
15
18
 
16
19
  directories:
17
20
  "**/app/controllers/**":
18
21
  InstanceVariableAssumption:
19
22
  enabled: false
20
- UtilityFunction:
21
- enabled: false
22
- "**/app/jobs":
23
- UtilityFunction:
24
- enabled: false
25
- "**/app/helpers":
26
- UtilityFunction:
27
- enabled: false
28
- "**/spec":
29
- UtilityFunction:
30
- enabled: false
@@ -4,45 +4,66 @@ require:
4
4
  - rubocop-rails
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 2.6
7
+ TargetRubyVersion: 2.7
8
8
  Exclude:
9
- - 'db/schema.rb'
10
9
  - 'db/migrate/**/*'
10
+ - 'db/schema.rb'
11
+
12
+ Layout/DotPosition:
13
+ Enabled: true
14
+ EnforcedStyle: leading
15
+
16
+ Layout/EmptyLinesAroundAttributeAccessor:
17
+ Enabled: true
11
18
 
12
19
  Layout/EmptyLinesAroundBlockBody:
13
20
  Exclude:
14
21
  - 'db/schema.rb'
15
22
 
23
+ Layout/FirstHashElementIndentation:
24
+ EnforcedStyle: consistent
25
+
16
26
  Layout/HashAlignment:
17
- EnforcedHashRocketStyle: key
18
- EnforcedColonStyle: key
27
+ EnforcedHashRocketStyle: table
28
+ EnforcedColonStyle: table
19
29
  EnforcedLastArgumentHashStyle: always_inspect
20
30
 
21
- Layout/MultilineOperationIndentation:
22
- EnforcedStyle: indented
31
+ Layout/LineLength:
32
+ Max: 113
23
33
 
24
- Layout/MultilineMethodCallIndentation:
25
- EnforcedStyle: indented
34
+ Layout/MultilineMethodArgumentLineBreaks:
35
+ Enabled: true
26
36
 
27
37
  Layout/MultilineMethodCallBraceLayout:
28
38
  EnforcedStyle: symmetrical
29
39
 
30
- Layout/SpaceInLambdaLiteral:
31
- EnforcedStyle: require_space
40
+ Layout/MultilineMethodCallIndentation:
41
+ EnforcedStyle: indented
42
+
43
+ Layout/MultilineOperationIndentation:
44
+ EnforcedStyle: indented
32
45
 
33
46
  Layout/ParameterAlignment:
34
47
  EnforcedStyle: with_fixed_indentation
35
48
 
36
- Naming/PredicateName:
37
- Exclude:
38
- - 'app/helpers/application_helper.rb'
49
+ Layout/SpaceAroundMethodCallOperator:
50
+ Enabled: true
51
+
52
+ Layout/SpaceInLambdaLiteral:
53
+ EnforcedStyle: require_space
54
+
55
+ Lint/DeprecatedOpenSSLConstant:
56
+ Enabled: true
57
+
58
+ Lint/RaiseException:
59
+ Enabled: true
60
+
61
+ Lint/StructNewOverride:
62
+ Enabled: true
39
63
 
40
64
  Metrics/AbcSize:
41
65
  Exclude:
42
- - test/**/*.rb
43
-
44
- Metrics/LineLength:
45
- Max: 113
66
+ - 'test/**/*.rb'
46
67
 
47
68
  Metrics/ClassLength:
48
69
  CountComments: false
@@ -62,6 +83,10 @@ Metrics/ModuleLength:
62
83
  Naming/MemoizedInstanceVariableName:
63
84
  EnforcedStyleForLeadingUnderscores: required
64
85
 
86
+ Naming/PredicateName:
87
+ Exclude:
88
+ - 'app/helpers/application_helper.rb'
89
+
65
90
  Style/ClassAndModuleChildren:
66
91
  Exclude:
67
92
  - 'test/**/*.rb'
@@ -69,16 +94,33 @@ Style/ClassAndModuleChildren:
69
94
  Style/Documentation:
70
95
  Enabled: false
71
96
 
97
+ Style/ExponentialNotation:
98
+ Enabled: true
99
+
72
100
  Style/FrozenStringLiteralComment:
73
101
  Enabled: true
74
102
 
103
+ Style/HashEachMethods:
104
+ Enabled: true
105
+
106
+ Style/HashTransformKeys:
107
+ Enabled: true
108
+
109
+ Style/HashTransformValues:
110
+ Enabled: true
111
+
75
112
  Style/SafeNavigation:
76
113
  Enabled: false
77
114
 
115
+ Style/SlicingWithRange:
116
+ Enabled: true
117
+
78
118
  Style/StabbyLambdaParentheses:
79
119
  EnforcedStyle: require_no_parentheses
80
120
 
81
121
  Style/StringLiterals:
122
+ Enabled: true
123
+ EnforcedStyle: double_quotes
82
124
  Exclude:
83
125
  - 'db/schema.rb'
84
126
 
@@ -90,9 +132,6 @@ Style/TrailingCommaInHashLiteral:
90
132
  Rails:
91
133
  Enabled: true
92
134
 
93
- Rails/HasAndBelongsToMany:
94
- Enabled: false
95
-
96
135
  Rails/SkipsModelValidations:
97
136
  Blacklist: []
98
137
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ if defined?(Spring) && ENV["DISABLE_SPRING"].nil?
4
+ puts "**** NO COVERAGE FOR YOU! ****"
5
+ puts "Please disable Spring to get COVERAGE by `DISABLE_SPRING=1 COVERAGE=1 bin/rspec`"
6
+ else
7
+ SimpleCov.start "rails" do
8
+ add_filter %w[app/views bin spec test]
9
+
10
+ maximum_coverage_drop 0.5
11
+ end
12
+
13
+ if ENV["CODECOV_TOKEN"]
14
+ require "codecov"
15
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
16
+ end
17
+ end
@@ -3,6 +3,7 @@
3
3
  extends: default
4
4
 
5
5
  rules:
6
+ braces:
7
+ max-spaces-inside: 1
6
8
  line-length:
7
9
  max: 113
8
-
@@ -1,12 +1,17 @@
1
- tap 'caskroom/cask'
2
- cask_args appdir: '/Applications'
1
+ # frozen_string_literal: true
3
2
 
4
- tap 'heroku/brew'
3
+ tap "caskroom/cask"
4
+ cask_args appdir: "/Applications"
5
5
 
6
- brew 'heroku'
7
- brew 'hub'
8
- # brew 'circleci'
9
- brew 'rbenv'
10
- brew 'ruby-build'
11
- brew 'ruby'
12
- brew 'yarn'
6
+ tap "heroku/brew"
7
+
8
+ brew "circleci"
9
+ brew "graphicsmagick" # For ActiveStorage
10
+ brew "heroku"
11
+ brew "hub" # For creating Pull Request from CLI
12
+ brew "postgresql"
13
+ brew "rbenv"
14
+ brew "ruby-build"
15
+ brew "vips" # For ActiveStorage
16
+ brew "yamllint" # For Linters
17
+ brew "yarn"
@@ -7,7 +7,7 @@ git_source(:github) do |repo_name|
7
7
  "https://github.com/#{repo_name}.git"
8
8
  end
9
9
 
10
- gem 'oj', require: false
10
+ gem 'oj'
11
11
 
12
12
  group :tools do
13
13
  gem 'pronto'
@@ -20,6 +20,8 @@ group :tools do
20
20
  gem 'pronto-rubocop', require: false
21
21
  gem 'pronto-yamllint', require: false
22
22
 
23
- gem 'rubocop-rails', require: false
23
+ # gem 'rubocop-minitest', require: false
24
24
  gem 'rubocop-performance', require: false
25
+ gem 'rubocop-rails', require: false
26
+ # gem 'rubocop-rspec', require: false
25
27
  end
@@ -4,68 +4,46 @@
4
4
  "postdeploy": "bin/heroku-postdeploy"
5
5
  },
6
6
  "env": {
7
- "HEROKU_APP_NAME": {
8
- "required": true
9
- },
10
- "HEROKU_PARENT_APP_NAME": {
11
- "required": true
12
- },
13
- "DB_SEED_ON_DEPLOY": "true",
14
7
  "BUNDLE_WITHOUT": "development:test:production",
15
- "MAILTRAP_ADDRESS": {
16
- "required": true
17
- },
18
- "MAILTRAP_API_TOKEN": {
19
- "required": true
20
- },
21
- "MAILTRAP_CATCH_MAIL": {
22
- "required": true
23
- },
24
- "MAILTRAP_DOMAIN": {
25
- "required": true
26
- },
27
- "MAILTRAP_PASSWORD": {
28
- "required": true
29
- },
30
- "MAILTRAP_PORT": {
31
- "required": true
32
- },
33
- "MAILTRAP_USER_NAME": {
34
- "required": true
35
- },
36
- "RACK_ENV": {
37
- "required": true
38
- },
39
- "RAILS_ENV": {
40
- "required": true
41
- },
8
+ "DISABLE_DATABASE_ENVIRONMENT_CHECK": "1",
9
+ "JEMALLOC_ENABLED": "true",
10
+ "LANG": "en_US.UTF-8",
11
+ "MALLOC_ARENA_MAX": "2",
12
+ "NODE_ENV": "production",
13
+ "RACK_ENV": "staging",
14
+ "RAILS_ENV": "staging",
42
15
  "RAILS_LOG_TO_STDOUT": "enabled",
43
16
  "RAILS_MASTER_KEY": {
44
17
  "required": true
45
18
  },
19
+ "RAILS_MAX_THREADS": "5",
46
20
  "RAILS_SERVE_STATIC_FILES": "enabled",
47
21
  "REDIS_PROVIDER": "REDISTOGO_URL",
48
- "SECRET_KEY_BASE": {
49
- "generator": "secret"
50
- },
51
22
  "ROLLBAR_ACCESS_TOKEN": {
52
23
  "required": true
53
24
  },
54
25
  "ROLLBAR_ENDPOINT": {
55
26
  "required": true
56
27
  },
57
- "ROLLBAR_ENV": "development"
28
+ "ROLLBAR_ENV": "staging",
29
+ "SECRET_KEY_BASE": {
30
+ "generator": "secret"
31
+ },
32
+ "SIDEKIQ_CONCURRENCY": "5",
33
+ "WEB_CONCURRENCY": "2"
58
34
  },
59
35
  "addons": [
60
- "mailtrap:unpaid",
61
36
  "memcachier:dev",
62
- "papertrail:choklad",
37
+ "logentries:le_tryit",
63
38
  "heroku-postgresql:hobby-dev",
64
39
  "redistogo:nano"
65
40
  ],
66
41
  "buildpacks": [
67
42
  {
68
- "url": "https://github.com/heroku/heroku-buildpack-activestorage-preview"
43
+ "url": "https://github.com/gaffneyc/heroku-buildpack-jemalloc.git"
44
+ },
45
+ {
46
+ "url": "heroku/nodejs"
69
47
  },
70
48
  {
71
49
  "url": "heroku/ruby"