From a2c27c1ab3156fe401597561b26481d07b43083b Mon Sep 17 00:00:00 2001 From: peterrobert Date: Wed, 24 Jun 2020 13:53:08 +0300 Subject: [PATCH] finished app --- Gemfile | 5 +- app/.rubocop.yml | 63 +++++++++++ app/.stickler.yml | 23 ++++ app/views/groups/_form.html.erb | 28 ++--- app/views/groups/edit.html.erb | 6 +- app/views/groups/index.html.erb | 92 ++++++---------- app/views/groups/new.html.erb | 6 +- app/views/groups/show.html.erb | 100 +++++++---------- app/views/static_pages/external.html.erb | 104 ++++++++---------- app/views/static_pages/friends.html.erb | 31 ++---- app/views/static_pages/home.html.erb | 68 +++++------- app/views/transactions/_form.html.erb | 39 +++---- app/views/transactions/edit.html.erb | 6 +- app/views/transactions/index.html.erb | 104 ++++++++---------- app/views/transactions/new.html.erb | 6 +- bin/rails | 2 + bin/rake | 2 + bin/setup | 2 + bin/spring | 1 + config/environments/development.rb | 14 +-- ...541_add_column_group_id_to_transactions.rb | 2 + spec/models/group_spec.rb | 38 ++++--- spec/models/transaction_spec.rb | 48 ++++---- spec/models/user_spec.rb | 36 +++--- spec/rails_helper.rb | 4 +- spec/spec_helper.rb | 96 ++++++++-------- spec/support/database_cleaner.rb | 36 +++--- test/application_system_test_case.rb | 2 + .../application_cable/connection_test.rb | 2 + test/controllers/groups_controller_test.rb | 2 + .../static_pages_controller_test.rb | 2 + .../transactions_controller_test.rb | 2 + test/models/group_test.rb | 2 + test/models/transaction_test.rb | 2 + test/models/user_test.rb | 2 + test/test_helper.rb | 2 + 36 files changed, 502 insertions(+), 478 deletions(-) create mode 100644 app/.rubocop.yml create mode 100644 app/.stickler.yml diff --git a/Gemfile b/Gemfile index 587ab06..c0db420 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# rubocop:disable Style/FrozenStringLiteralComment source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } @@ -43,9 +44,9 @@ group :development do gem 'listen', '~> 3.2' gem 'web-console', '>= 3.3.0' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'bullet' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' - gem "bullet" end group :test do @@ -58,3 +59,5 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] + +# rubocop: enable Style/FrozenStringLiteralComment diff --git a/app/.rubocop.yml b/app/.rubocop.yml new file mode 100644 index 0000000..dc0b5a4 --- /dev/null +++ b/app/.rubocop.yml @@ -0,0 +1,63 @@ +AllCops: + Exclude: + - "db/**/*" + - "bin/*" + - "test/*" + - "config/**/*" + - "Guardfile" + - "Rakefile" + - "README.md" + - "node_modules/**/*" + + DisplayCopNames: true + +Layout/LineLength: + Max: 120 +Metrics/MethodLength: + Include: + - "app/controllers/*" + - "app/models/*" + Max: 20 +Metrics/AbcSize: + Include: + - "app/controllers/*" + - "app/models/*" + Max: 50 +Metrics/ClassLength: + Max: 150 +Metrics/BlockLength: + ExcludedMethods: ['describe'] + Max: 30 + +Style/Documentation: + Enabled: false +Style/ClassAndModuleChildren: + Enabled: false +Style/EachForSimpleLoop: + Enabled: false +Style/AndOr: + Enabled: false +Style/DefWithParentheses: + Enabled: false +Style/FrozenStringLiteralComment: + EnforcedStyle: never +Style/HashEachMethods: + Enabled: false +Style/HashTransformKeys: + Enabled: false +Style/HashTransformValues: + Enabled: false + + +Layout/HashAlignment: + EnforcedColonStyle: key +Layout/ExtraSpacing: + AllowForAlignment: false +Layout/MultilineMethodCallIndentation: + Enabled: true + EnforcedStyle: indented + +Lint/RaiseException: + Enabled: false +Lint/StructNewOverride: + Enabled: false \ No newline at end of file diff --git a/app/.stickler.yml b/app/.stickler.yml new file mode 100644 index 0000000..37e97a4 --- /dev/null +++ b/app/.stickler.yml @@ -0,0 +1,23 @@ +# add the linters you want stickler to use for this project +linters: + rubocop: + display_cop_names: true + # indicate where is the config file for stylelint + config: './rubocop.yml' + +# add the files here you want to be ignored by stylelint +files: + ignore: + - "bin/*" + - "test/*" + - "db/*" + - "config/*" + - "Guardfile" + - "Rakefile" + - "README.md" + - "node_modules/**/*" + +# PLEASE DO NOT enable auto fixing options +# if you need extra support from you linter - do it in your local env as described in README for this config + +# find full documentation here: https://stickler-ci.com/docs \ No newline at end of file diff --git a/app/views/groups/_form.html.erb b/app/views/groups/_form.html.erb index 8240a20..49f5f36 100644 --- a/app/views/groups/_form.html.erb +++ b/app/views/groups/_form.html.erb @@ -1,22 +1,18 @@ <%= form_for @group do |f| %> - - <% if @group.errors.any? %> -