Commit Graph

76 Commits

Author SHA1 Message Date
John Bampton
6e85b6b86e Add spell checking with codespell as a GitHub Action
`codespell` works with a small custom dictionary and seems to find perhaps more spelling mistakes than `misspell` which really only fixes commonly misspelled English words.

Not all spell checkers can check all file types and most spell checkers can't find all the errors.

https://github.com/codespell-project/codespell
https://pypi.org/project/codespell/
2021-05-04 14:46:21 +10:00
Rafael Mendonça França
7d2d00a334
Fix handling of ParseError in controllers
It regressed in #34894, which moved the rescue to the wrong method.
`_wrapper_enabled?` can access the parameters and the exception will
raise there before even entering `_perfomr_parameter_wrapping`.

Closes #38285.
2021-03-24 22:53:27 +00:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
yuuji.yaginuma
f9a5fd5254 Remove unused methods
These were unused since 11af089cee0a0e744e267d32becfe2c66a586d31 and e35b98e6f5c54330245645f2ed40d56c74538902.
2018-12-23 21:33:29 +09:00
Gannon McGibbon
6b3faf8e50 Allow rescue from parameter parse errors
[Gannon McGibbon + Josh Cheek]
2018-11-13 18:05:05 -05:00
Yauheni Dakuka
56ac13e8e4 fix type fully qualified [ci skip] 2017-09-06 15:49:04 +03:00
Kir Shatrov
dfcc766163 Use frozen string literal in actionpack/ 2017-07-29 14:02:40 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Akira Matsuda
f2dfd5c6fd Privatize unneededly protected methods in Action Pack tests 2016-12-23 23:49:11 +09:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
5b6eb1d58b modernizes hash syntax in actionpack 2016-08-06 19:35:13 +02:00
Xavier Noria
35b3de8021 applies new string literal convention in actionpack/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:54:50 +02:00
Jeremy Daer
e35b98e6f5
Action Mailer: Declarative exception handling with rescue_from.
Follows the same pattern as controllers and jobs. Exceptions raised in
delivery jobs (enqueued by `#deliver_later`) are also delegated to the
mailer's rescue_from handlers, so you can handle the DeserializationError
raised by delivery jobs:

```ruby
class MyMailer < ApplicationMailer
  rescue_from ActiveJob::DeserializationError do
    …
  end
```

ActiveSupport::Rescuable polish:
* Add the `rescue_with_handler` class method so exceptions may be
  handled at the class level without requiring an instance.
* Rationalize `exception.cause` handling. If no handler matches the
  exception, fall back to the handler that matches its cause.
* Handle exceptions raised elsewhere. Pass `object: …` to execute
  the `rescue_from` handler (e.g. a method call or a block to
  instance_exec) against a different object. Defaults to `self`.
2016-05-15 18:44:16 -07:00
Sean Griffin
b76b817629 Use the most highest priority exception handler when cause is set
There was some subtle breakage caused by #18774, when we removed
`#original_exception` in favor of `#cause`. However, `#cause` is
automatically set by Ruby when raising an exception from a rescue block.
With this change, we will use whichever handler has the highest priority
(whichever call to `rescue_from` came last). In cases where the outer
has lower precidence than the cause, but the outer is what should be
handled, cause will need to be explicitly unset.

Fixes #23925
2016-03-11 10:53:01 -07:00
Yuki Nishijima
266455cf25 Deprecate exception#original_exception in favor of exception#cause 2015-11-03 06:54:34 -08:00
Marcin Olichwirowicz
81bc771e7c Remove mocha from ActionPack tests 2015-09-05 16:58:40 +02:00
Prem Sichanugrist
8cb8ce98d9 Stop using deprecated render :text in test
This will silence deprecation warnings.

Most of the test can be changed from `render :text` to render `:plain`
or `render :body` right away. However, there are some tests that needed
to be fixed by hand as they actually assert the default Content-Type
returned from `render :body`.
2015-07-17 22:27:33 -04:00
Mehmet Emin İNAÇ
cf81a3bae0 Deprecate passing hash as first parameter into ActionController::Head 2015-06-15 23:53:45 +03:00
Francesco Rodriguez
5fb94ec044 use _action instead of _filter callbacks 2012-12-07 15:24:56 -05:00
Francesco Rodriguez
a53a7bea80 update documentation and code to use _action callbacks 2012-12-07 14:46:06 -05:00
Jose and Yehuda
56cdc81c08 Remove default match without specified method
In the current router DSL, using the +match+ DSL
method will match all verbs for the path to the
specified endpoint.

In the vast majority of cases, people are
currently using +match+ when they actually mean
+get+. This introduces security implications.

This commit disallows calling +match+ without
an HTTP verb constraint by default. To explicitly
match all verbs, this commit also adds a
:via => :all option to +match+.

Closes #5964
2012-04-24 22:52:26 -05:00
Rafael Mendonça França
4b85acba43 Remove unused test code.
ActionController::RoutingError are raised in router execution time and can not be
rescued in a controller.
2012-04-16 23:38:31 -03:00
brainopia
73709f7ffa Removed unused assigns from ActionView::Template::Error
They existed since initial rails commit by DHH but lost use a long time
ago
2012-01-20 20:13:29 +04:00
José Valim
58f69ba085 Remove Rescue middleware that was never used by Rails. 2011-12-24 11:28:05 +01:00
Aaron Patterson
ffbcb84c21 removing more duplicate code 2010-10-01 18:05:59 -07:00
Emilio Tagua
d5bb640eb0 Remove methods to avoid warnings. 2010-09-28 18:40:38 -03:00
Carlos Antonio da Silva
7fc1edd790 Remove deprecated stuff in ActionController
This removes all deprecated classes in ActionController related to
Routing, Abstract Request/Response and Integration/IntegrationTest.
All tests and docs were changed to ActionDispatch instead of ActionController.
2010-09-26 02:13:45 +08:00
Piotr Sarnacki
b3eb26a161 Removed deprecated RouteSet API, still many tests fail 2010-09-05 13:44:36 +02:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d0b414564e919f67d339fac067a56e6.
2010-09-02 21:11:03 +02:00
Łukasz Strzałkowski
38a421b34d Setup explicit requires for files with exceptions. Removed them from autoloading.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 11:54:04 +02:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Neeraj Singh
33c5689e2d Exceptions from views should be rescued based on the original exception. If a handler for original exception is missing then apply ActiveView::TemplateError
[#2034 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-19 14:50:38 +02:00
Carl Lerche
6c280f3398 RouteSet does not raise ActionController::RoutingError when no routes match anymore. Instead, it follows the X-Cascade convention. ShowExceptions checks for X-Cascade so that the routing error page can still be displayed. 2010-04-30 16:40:42 -07:00
Carlhuda
226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
Martin Schürrer
6bc24d40d5 Use ActionDispatch::Routing everywhere 2010-02-21 13:43:51 -08:00
Jeremy Kemper
425a02cece Ruby 1.9: resolve constant lookup issues 2009-11-04 15:41:50 -08:00
Joshua Peek
a5c82a9dfb Start rewriting some internal tests to use the new routing dsl 2009-10-20 16:03:55 -05:00
Yehuda Katz
c44d560145 Rack responses need to wrap Strings in 1.9 2009-10-15 16:37:27 -07:00
Joshua Peek
84e94551f6 Add custom "with_routing" to internal tests to fix reseting session after using
with_routing. This only affects our internal AP tests.
2009-10-03 20:45:49 -05:00
Joshua Peek
acfeec5151 Allow integration test rack app to be set with "@app" ivar instead of using open_session 2009-09-26 20:51:05 -05:00
Joshua Peek
52aeb8d2e7 Beef up AD::Rescue to replace global exception handling lost in ApplicationController 2009-09-15 16:33:15 -05:00
Joshua Peek
90d7ae23c6 Remove global exception catching from ApplicationController.
It was severely broken since it was ported to NewBase and is causing problems with normal exception catching. A replacement is coming soon.
2009-09-15 10:05:46 -05:00
Joshua Peek
a3fcfd819b Need to reset session for AP rescue tests after altering the route set 2009-09-13 17:52:33 -05:00
Joshua Peek
8118fca9be Merge Failsafe middleware into ShowExceptions 2009-05-17 12:24:59 -05:00
Joshua Peek
11af089cee Extract ActionController rescue templates into Rescue and ShowExceptions middleware.
This commit breaks all exception catching plugins like ExceptionNotifier. These plugins should be rewritten as middleware instead overriding Controller#rescue_action_in_public.
2009-05-02 23:02:22 -05:00
Joshua Peek
380431e4ed Fix test_rescue_routing_exceptions when running with rake 2009-04-21 21:11:23 -05:00
Joshua Peek
0b92bb97c1 refactor some coupled rescue tests 2009-04-21 20:41:31 -05:00
Carl Lerche & Yehuda Katz
906aebceed Bring abstract_controller up to date with rails/master
Resolved all the conflicts since 2.3.0 -> HEAD. Following is a list
of commits that could not be applied cleanly or are obviated with the
abstract_controller refactor. They all need to be revisited to ensure
that fixes made in 2.3 do not reappear in 3.0:

2259ecf368e6a6715966f69216e3ee86bf1a82a7
AR not available
  * This will be reimplemented with ActionORM or equivalent

06182ea02e92afad579998aa80144588e8865ac3
implicitly rendering a js response should not use the default layout
[#1844 state:resolved]
  * This will be handled generically

893e9eb99504705419ad6edac14d00e71cef5f12
Improve view rendering performance in development mode and reinstate
template recompiling in production [#1909 state:resolved]
  * We will need to reimplement rails-dev-boost on top of the refactor;
    the changes here are very implementation specific and cannot be
    cleanly applied. The following commits are implicated:

      199e750d46c04970b5e7684998d09405648ecbd4
      3942cb406e1d5db0ac00e03153809cc8dc4cc4db
      f8ea9f85d4f1e3e6f3b5d895bef6b013aa4b0690
      e3b166aab37ddc2fbab030b146eb61713b91bf55
      ae9f258e03c9fd5088da12c1c6cd216cc89a01f7
      44423126c6f6133a1d9cf1d0832b527e8711d40f

0cb020b4d6d838025859bd60fb8151c8e21b8e84
workaround for picking layouts based on wrong view_paths
[#1974 state:resolved]
  * The specifics of this commit no longer apply. Since it is a two-line
    commit, we will reimplement this change.

8c5cc66a831aadb159f3daaffa4208064c30af0e
make action_controller/layouts pick templates from the current instance's
view_paths instead of the class view_paths [#1974 state:resolved]
  * This does not apply at all. It should be trivial to apply the feature
    to the reimplemented ActionController::Base.

87e8b162463f13bd50d27398f020769460a770e3
fix HTML fallback for explicit templates [#2052 state:resolved]
  * There were a number of patches related to this that simply compounded
    each other. Basically none of them apply cleanly, and the underlying
    issue needs to be revisited. After discussing the underlying problem
    with Koz, we will defer these fixes for further discussion.
2009-04-13 15:18:45 -07:00
Yehuda Katz and Carl Lerche
6c05b5e938 Temporarily modifies setup to call super directly. This can support more T::U runners. 2009-04-08 17:33:41 -07:00