diff --git a/.hound.yml b/.hound.yml new file mode 100644 index 000000000..d62d2897a --- /dev/null +++ b/.hound.yml @@ -0,0 +1,10 @@ +--- +fail_on_violations: true +ruby: + config_file: .rubocop.yml +haml: + config_file: .haml-lint.yml +scss: + config_file: .scss-lint.yml +eslint: + config_file: .eslintrc diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1e5e3c9d0..50da3b32b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -28,7 +28,6 @@ Lint/UnusedBlockArgument: Exclude: - 'app/controllers/sessions_controller.rb' - 'config/unicorn.rb' - - 'lib/haml/filters/growstuff_markdown.rb' # Cop supports --auto-correct. # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. @@ -121,7 +120,6 @@ Style/ClassAndModuleChildren: - 'app/controllers/admin/orders_controller.rb' - 'lib/actions/oauth_signup_action.rb' - 'lib/haml/filters/escaped_markdown.rb' - - 'lib/haml/filters/growstuff_markdown.rb' # Cop supports --auto-correct. Style/ColonMethodCall: @@ -226,11 +224,6 @@ Style/PercentLiteralDelimiters: - 'spec/features/signin_spec.rb' - 'spec/features/signout_spec.rb' -# Cop supports --auto-correct. -Style/PerlBackrefs: - Exclude: - - 'lib/haml/filters/growstuff_markdown.rb' - # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. # SupportedStyles: slashes, percent_r, mixed @@ -256,11 +249,6 @@ Style/SymbolProc: Exclude: - 'lib/tasks/growstuff.rake' -# Cop supports --auto-correct. -Style/UnlessElse: - Exclude: - - 'app/controllers/omniauth_callbacks_controller.rb' - # Cop supports --auto-correct. # Configuration parameters: SupportedStyles, WordRegex. # SupportedStyles: percent, brackets diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 11bb634b7..afb56d3db 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -29,15 +29,15 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController member = action.find_or_create_from_authorization(auth) @authentication = action.establish_authentication(auth, member) - unless action.member_created? - sign_in_and_redirect member, event: :authentication # this will throw if @user is not activated - set_flash_message(:notice, :success, kind: auth['provider']) if is_navigational_format? - else + if action.member_created? raise "Invalid provider" unless ['facebook', 'twitter', 'flickr'].index(auth['provider'].to_s) session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"] sign_in member redirect_to finish_signup_url(member) + else + sign_in_and_redirect member, event: :authentication # this will throw if @user is not activated + set_flash_message(:notice, :success, kind: auth['provider']) if is_navigational_format? end end diff --git a/lib/haml/filters/growstuff_markdown.rb b/lib/haml/filters/growstuff_markdown.rb index e03e8c306..b7b257b53 100644 --- a/lib/haml/filters/growstuff_markdown.rb +++ b/lib/haml/filters/growstuff_markdown.rb @@ -1,56 +1,70 @@ require 'bluecloth' -module Haml::Filters +module Haml::Filters # rubocop:disable Style/ClassAndModuleChildren module GrowstuffMarkdown + include Haml::Filters::Base + + def render(text) + @expanded = text + expand_crops! + expand_members! + BlueCloth.new(@expanded).to_html + end + + private + CROP_REGEX = /(?