Commit graph

142 commits

Author SHA1 Message Date
simon lehericey
972cb865c7 update rubocop 2022-06-17 14:54:21 +02:00
François Vantomme
bebc78b587
chore(rubocop): replace deprecated rspec-focused by rubocop-rspec
WARNING: We are no longer maintaining this gem, and will eventually
archive this repo. We recommend you use rubocop-rspec instead.

https://github.com/CarooDev/rubocop-rspec-focused
2022-02-08 12:50:18 +01:00
François Vantomme
f3bf0499b6 chore(rubocop): cleanup dependencies
Using rubocop-rails_config is a nonsense because:
  - it relies on rubocop-minitest which is useless here (we use RSpec)
  - it relies on rubocop-packaging but disables all its cops
  - it targets ruby version 2.7, but we use 3.0
2022-02-08 12:35:08 +01:00
François Vantomme
370664bae7
style(rubocop): reorder cops alphabetically 2022-02-04 17:44:02 +01:00
Pierre de La Morinerie
9fd38cae5e specs: migrate from features to system specs
System specs have been available since Rails 5.1, and are better
integrated with the Rails framework.

- Rename `spec/features` to `spec/system`
- Rename `feature do` to `describe do`
- Configure Capybara for system specs

Steps mostly taken from https://medium.com/table-xi/a-quick-guide-to-rails-system-tests-in-rspec-b6e9e8a8b5f6
2021-10-26 12:24:46 +02:00
Pierre de La Morinerie
888e33ba4d lint: ensure all unique columns have a unique constraint 2021-07-22 18:00:39 +02:00
François Vantomme
c9b1095d1e Refactor (Rubocop): replace map{ … }.compact by filter_map
In Ruby 2.7, Enumerable#filter_map has been added.
This cop identifies places where map { … }.compact can be replaced by filter_map.

See: https://docs.rubocop.org/rubocop-performance/cops_performance.html#performancemapcompact
2021-06-11 15:38:09 +02:00
Pierre de La Morinerie
872f6b0153 lib: add migration helpers for making a column unique 2021-04-13 18:09:59 +02:00
Pierre de La Morinerie
fb305e31c4 config: move application_name to an initializer
It seems cleaner not to require a file before the Rails configuration
runs.
2021-02-24 15:06:55 +01:00
Paul Chavard
a03d812d19 Add github actions CI 2021-02-23 10:35:30 +01:00
Pierre de La Morinerie
98be7e2076 Fix new Rubocop warnings 2021-02-16 16:31:30 +00:00
clemkeirua
5db826bc8d enable the rules that are already passing 2020-09-25 12:53:11 +00:00
clemkeirua
4053198e78 add disabled new rules to rubocop.yml 2020-09-25 12:53:11 +00:00
clemkeirua
19294a93e4 replace deprecate rubocop rules as suggested 2020-09-25 12:53:10 +00:00
clemkeirua
03864f60cf added a custom rubocop linter in order to avoid hardcoding application name 2020-07-23 16:17:15 +02:00
Christophe Robillard
a072d35211 use traitement model
when a dossier is terminated (accepte, refuse or classe_sans_suite),
we store now `processed_at` and `motivation` in a traitement instance
2020-07-08 18:15:15 +02:00
Pierre de La Morinerie
35240e2219 lint: fix Rubocop warnings
The Rails/UniqueValidationWithoutIndex rule is disabled for now, but
we'll need to re-enable it (and fix the underlying issues) after the
migration to Rails 6.
2020-07-07 18:03:56 +02:00
Paul Chavard
3cd4597006 Update rubocop roules 2020-03-17 11:25:21 +01:00
Pierre de La Morinerie
cf101d64d8 lint: add a Rubocop rule to forbid the use of unscoped
`unscoped` often has an effect broader than intended. For instance:

```
user.dossiers.unscoped.destroy_all
```

will not destroy all the user's dossier, including the hidden ones,
but **all the dossiers of all users**.

Instead, narrower unscoping should be used:

```
user.dossiers.unscope(where: :hidden).destroy_all
```

(Or even better, use the new `Dossier.with_hidden` scope).
2020-01-28 17:32:38 +01:00
Nicolas Bouilleaud
661b80777d Replace old migrations with a single “recreate_structure”
* copy-paste the description from schema.rb,
 * without the `force: :cascade` options (that drops the tables before recreating them).
* create a new migration with it
* give it the same timestamp as the last deleted migration, so that it exists in the schema_migration table and it is not run in production.
* (Also got rid of some stray changes in schema.rb for mon_avis and unconfirmed_email)
* Run rake db:migrate and make sure nothing moves
2019-09-16 14:44:37 +02:00
Paul Chavard
3b8d3b7967 Add Style/CollectionMethods to rubocop 2019-09-12 14:48:18 +02:00
Nicolas Bouilleaud
7e80b8a4dc Enable the Rails/InverseOf cop and add missing inverse_of 2019-06-17 13:44:07 +02:00
Mathieu Magnin
dd27167c5d Enforce Timezone rule in Rubocop 2019-02-18 16:19:42 +01:00
gregoirenovel
c51280c40c Enable the Bundler/OrderedGems cop 2019-01-07 10:34:55 +01:00
gregoirenovel
0c8b228fbf Enable the Lint/UselessAssignment cop 2019-01-03 10:53:50 +01:00
gregoirenovel
0596d53ac2 Enable the Lint/UnusedBlockArgument cop 2019-01-03 10:53:50 +01:00
gregoirenovel
ddc71cbacf Enable the Lint/UnderscorePrefixedVariableName cop 2019-01-03 10:53:50 +01:00
gregoirenovel
baf7977786 Enable the Lint/StringConversionInInterpolation cop 2019-01-03 10:53:50 +01:00
gregoirenovel
d473119f9d Enable the Lint/ParenthesesAsGroupedExpression cop 2019-01-03 10:53:50 +01:00
gregoirenovel
186e362701 Enable the Layout/SpaceInsideArrayLiteralBrackets 2019-01-03 10:53:50 +01:00
gregoirenovel
386fbce776 Enable the Layout/SpaceBeforeBlockBraces cop 2019-01-03 10:53:50 +01:00
gregoirenovel
8b0b8162f0 Enable the Layout/SpaceAfterComma cop 2019-01-03 10:53:50 +01:00
gregoirenovel
cc32516c21 Enable more cops 2019-01-03 10:53:50 +01:00
gregoirenovel
abce867fb4 Enable the Rails/CreateTableWithTimestamps cop 2018-12-19 14:40:10 +01:00
gregoirenovel
4b0e632abb Enable the Style/ColonMethodCall cop 2018-12-19 13:56:10 +01:00
gregoirenovel
616e9305e9 Enable the Style/ClassCheck cop 2018-12-19 13:56:10 +01:00
gregoirenovel
fba8d97256 Enable the Stlye/BlockDelimiters cop 2018-12-19 13:56:10 +01:00
gregoirenovel
a8f700b572 Enable the Style/FormatString cop 2018-12-19 13:56:10 +01:00
gregoirenovel
621154fde4 Enable more cops 2018-12-19 13:56:10 +01:00
gregoirenovel
6479de1f6c Bump development gems
- rubocop (0.59.2 → 0.60.0)
2018-11-16 12:05:22 +01:00
simon lehericey
4f1cc8a2f0 Rubocop: add TimeZone rule 2018-10-26 10:10:20 +00:00
gregoirenovel
c91a1cf474 Enable Style/SymbolArray 2018-10-03 12:15:48 +02:00
gregoirenovel
2004b9a864 Enable Style/SymbolLiteral 2018-10-03 12:15:48 +02:00
gregoirenovel
d9d4f6fe20 Enable Style/SymbolProc 2018-10-03 12:15:48 +02:00
gregoirenovel
7e4268db67 Enable Style/TrailingCommaInArguments 2018-10-03 12:03:21 +02:00
gregoirenovel
275bb64c1f Enable Style/TrailingCommaInArrayLiteral 2018-10-03 12:03:21 +02:00
gregoirenovel
a171186dd8 Enable Style/TrailingCommaInHashLiteral 2018-10-03 12:03:21 +02:00
gregoirenovel
2ede598f77 Enable Style/UnneededCapitalW 2018-10-03 12:03:21 +02:00
gregoirenovel
ed240cb4d3 Enable Style/UnneededInterpolation 2018-10-03 12:03:21 +02:00
gregoirenovel
82f0df089d Enable Style/UnneededPercentQ 2018-10-03 12:03:21 +02:00