Commit Graph

26 Commits

Author SHA1 Message Date
Javi Martín
a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00
Javi Martín
1a098dfcab Add and apply MultilineMethodCallBraceLayout rule
In order for this rule to work effectively when running `--autocorrect`,
we also need to enable the `ClosingParenthesisIndentation` rule.
2023-08-18 14:56:16 +02:00
Javi Martín
65c9786db7 Apply Layout/RedundantLineBreak rule to short lines
We're not adding the rule because it would apply the current line length
rule of 110 characters per line. We still haven't decided whether we'll
keep that rule or make lines shorter so they're easier to read,
particularly when vertically splitting the editor window.

So, for now, I'm applying the rule to lines which are about 90
characters long.
2021-09-03 11:49:53 +02:00
Javi Martín
e3bfcbcd25 Apply Style/ClassVars rubocop rule
Class variables in Ruby are not the same as instance variables of a
class. They're particularly tricky when it comes to inheritance and
modules.

In the case of the Measurable module, for example, using a class
variable will make all classes including the Measurable module share
the same value. However, that's not what we want; we want the variable
to be different for every class. And that's accomplished using a class
instance variable.

Although in this case it would probably be better to remove the caching
variable. I don't think these methods are called more than once during a
request, and even if they did it's highly unlikely the would become a
bottleneck.
2019-10-26 13:03:49 +02:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Juanjo Bazán
b7d9ef6377 models inherits from ApplicationRecord 2019-04-17 17:40:56 +02:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
Bertocq
69f4e1c683 Fix all rubocop Metrics/LineLength issues (140+) 2017-07-10 13:22:49 +02:00
Bertocq
2888c20489 Fix all Style/RedundantSelf rubocop issues 2017-07-05 11:55:52 +02:00
Bertocq
80bcf38dc5 Fix all Layout/TrailingWhitespace rubocop issues and remove from rubocop_todo list 2017-06-26 17:57:53 +02:00
Alberto Miedes Garcés
e8fc387574 Add Organization to API 2017-01-26 10:57:02 +01:00
kikito
f0b8cfd4a2 Time.now -> Time.current 2016-11-23 19:19:19 +01:00
Juanjo Bazán
6b0edac6fc adds responsible_name to organizations 2015-09-12 18:16:14 +02:00
kikito
c399ddf18d Adds default values to limits when the db does not have them
This prevents errors when doing rake db:setup (the db has still not
been created but the rails models are loaded)
2015-09-11 11:32:29 +02:00
David Gil
8ed434cc8b uses more rails-like syntax in scopes 2015-09-10 18:44:33 +02:00
kikito
95fc7ea949 remove constants / replace by class methods 2015-09-10 18:07:30 +02:00
kikito
2d3015703d replaces constants by class methods + private functions. Fixes broken tests 2015-09-10 13:02:21 +02:00
kikito
5e7a5b57de Adds max lengths and validations in models 2015-09-09 18:32:36 +02:00
rgarcia
cba83e6dd2 touches comments and debates after changes 2015-09-05 22:02:51 +02:00
rgarcia
4897d5df4e makes spaces consistent 2015-09-03 01:29:46 +02:00
Juanjo Bazán
59c2fdb596 adds search method to Organization 2015-08-29 16:29:55 +02:00
rgarcia
974d004bc4 fixes ambiguous db query 2015-08-28 00:01:26 +02:00
kikito
c1a6a37651 Removes user_id validation from Organisations 2015-08-17 17:11:17 +02:00
kikito
1c435eacbe adds filters to admin/organizations 2015-08-17 14:25:43 +02:00
kikito
9343952d52 Adds User.organization_attributes 2015-08-17 01:16:07 +02:00
kikito
bdf462c16b Adds new Organization model 2015-08-13 20:04:21 +02:00