From 549ac48c63cd88b034fd4f0e3c4c3cfee932d9a6 Mon Sep 17 00:00:00 2001 From: Pauline Bessoles <52420208+paulinebessoles@users.noreply.github.com> Date: Thu, 19 May 2022 14:16:32 +0200 Subject: [PATCH] Bump module to 0.24.3 (#8) * remove circleci * add github actions workflows * bump ruby version to 2.6.6 * add package-lock.json * bump to 0.23.6 * update spec files * update authentication system specs * update authorizations spec * fix user manage authorizations spec * add tests for locales * bundle lock for x86_64-linux platform * bump to 0.23.1 * Bump to 0.23.6 * Bump to release 0.24 stable * Lint code * Removes explicit ruby version * Update rubocop * Update faker * Fix 18n spec * Fix offenses * Fix rubocop offenses Co-authored-by: quentinchampenois <26109239+Quentinchampenois@users.noreply.github.com> Co-authored-by: MoretS Co-authored-by: Armand Fardeau --- .github/workflows/lint_code.yml | 11 +- .rubocop.yml | 1259 +----------- .rubocop_rails.yml | 63 +- .rubocop_ruby.yml | 1761 +++++++++++++++++ .ruby-version | 2 +- Gemfile | 5 +- Gemfile.lock | 360 ++-- config/locales/fr.yml | 4 + ..._demographic_authorization_handler.gemspec | 2 +- .../confirmations_controller_extend.rb | 2 +- .../version.rb | 4 +- spec/i18n_spec.rb | 2 +- spec/system/authorizations_spec.rb | 2 +- 13 files changed, 2027 insertions(+), 1450 deletions(-) create mode 100644 .rubocop_ruby.yml diff --git a/.github/workflows/lint_code.yml b/.github/workflows/lint_code.yml index 84ee579..c0cbab9 100644 --- a/.github/workflows/lint_code.yml +++ b/.github/workflows/lint_code.yml @@ -1,18 +1,9 @@ name: "[CI] Lint" -on: - push: - branches: - - develop - - release/* - - "*-stable" - pull_request: - branches-ignore: - - "chore/l10n*" +on: [push] env: CI: "true" SIMPLECOV: "true" - RUBY_VERSION: 2.6.6 jobs: lint: diff --git a/.rubocop.yml b/.rubocop.yml index 5b53bd9..870c0b9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,1256 +1,3 @@ -require: rubocop-rspec - -# Common configuration. -AllCops: - Include: - - .simplecov - - "**/*.rb" - - "**/*.rake" - - "**/*.gemspec" - - "**/*.ru" - - "**/Gemfile" - - "**/Rakefile" - Exclude: - - "**/vendor/**/*" - - "development_app/**/*" - - "spec/decidim_dummy_app/**/*" - - "node_modules/**/*" - # Default formatter will be used if no -f/--format option is given. - DefaultFormatter: progress - # Cop names are not displayed in offense messages by default. Change behavior - # by overriding DisplayCopNames, or by giving the -D/--display-cop-names - # option. - DisplayCopNames: true - # Style guide URLs are not displayed in offense messages by default. Change - # behavior by overriding DisplayStyleGuide, or by giving the - # -S/--display-style-guide option. - DisplayStyleGuide: false - # Extra details are not displayed in offense messages by default. Change - # behavior by overriding ExtraDetails, or by giving the - # -E/--extra-details option. - ExtraDetails: false - # Additional cops that do not reference a style guide rule may be enabled by - # default. Change behavior by overriding StyleGuideCopsOnly, or by giving - # the --only-guide-cops option. - StyleGuideCopsOnly: false - # All cops except the ones in disabled.yml are enabled by default. Change - # this behavior by overriding DisabledByDefault. When DisabledByDefault is - # true, all cops in the default configuration are disabled, and and only cops - # in user configuration are enabled. This makes cops opt-in instead of - # opt-out. Note that when DisabledByDefault is true, cops in user - # configuration will be enabled even if they don't set the Enabled parameter. - DisabledByDefault: false - # Enables the result cache if true. Can be overridden by the --cache command - # line option. - UseCache: true - # Threshold for how many files can be stored in the result cache before some - # of the files are automatically removed. - MaxFilesInCache: 20000 - # The cache will be stored in "rubocop_cache" under this directory. The name - # "/tmp" is special and will be converted to the system temporary directory, - # which is "/tmp" on Unix-like systems, but could be something else on other - # systems. - CacheRootDirectory: /tmp - # The default cache root directory is /tmp, which on most systems is - # writable by any system user. This means that it is possible for a - # malicious user to anticipate the location of Rubocop's cache directory, - # and create a symlink in its place that could cause Rubocop to overwrite - # unintended files, or read malicious input. If you are certain that your - # cache location is secure from this kind of attack, and wish to use a - # symlinked cache location, set this value to "true". - AllowSymlinksInCacheRootDirectory: true - # What MRI version of the Ruby interpreter is the inspected code intended to - # run on? (If there is more than one, set this to the lowest version.) - # If a value is specified for TargetRubyVersion then it is used. - # Else if .ruby-version exists and it contains an MRI version it is used. - # Otherwise we fallback to the oldest officially supported Ruby version (2.0). - TargetRubyVersion: 2.6 - - RSpec: - Patterns: - - "(?:^|/)spec/" - - "(?:^|/)test/" - -# Indent private/protected/public as deep as method definitions -Layout/AccessModifierIndentation: - EnforcedStyle: indent - SupportedStyles: - - outdent - - indent - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/Alias: - EnforcedStyle: prefer_alias - SupportedStyles: - - prefer_alias - - prefer_alias_method - -# Align the elements of a hash literal if they span more than one line. -Layout/AlignHash: - # Alignment of entries using hash rocket as separator. Valid values are: - # - # key - left alignment of keys - # "a" => 2 - # "bb" => 3 - # separator - alignment of hash rockets, keys are right aligned - # "a" => 2 - # "bb" => 3 - # table - left alignment of keys, hash rockets, and values - # "a" => 2 - # "bb" => 3 - EnforcedHashRocketStyle: key - # Alignment of entries using colon as separator. Valid values are: - # - # key - left alignment of keys - # a: 0 - # bb: 1 - # separator - alignment of colons, keys are right aligned - # a: 0 - # bb: 1 - # table - left alignment of keys and values - # a: 0 - # bb: 1 - EnforcedColonStyle: key - # Select whether hashes that are the last argument in a method call should be - # inspected? Valid values are: - # - # always_inspect - Inspect both implicit and explicit hashes. - # Registers an offense for: - # function(a: 1, - # b: 2) - # Registers an offense for: - # function({a: 1, - # b: 2}) - # always_ignore - Ignore both implicit and explicit hashes. - # Accepts: - # function(a: 1, - # b: 2) - # Accepts: - # function({a: 1, - # b: 2}) - # ignore_implicit - Ignore only implicit hashes. - # Accepts: - # function(a: 1, - # b: 2) - # Registers an offense for: - # function({a: 1, - # b: 2}) - # ignore_explicit - Ignore only explicit hashes. - # Accepts: - # function({a: 1, - # b: 2}) - # Registers an offense for: - # function(a: 1, - # b: 2) - EnforcedLastArgumentHashStyle: always_inspect - SupportedLastArgumentHashStyles: - - always_inspect - - always_ignore - - ignore_implicit - - ignore_explicit - -Layout/AlignParameters: - # Alignment of parameters in multi-line method calls. - # - # The `with_first_parameter` style aligns the following lines along the same - # column as the first parameter. - # - # method_call(a, - # b) - # - # The `with_fixed_indentation` style aligns the following lines with one - # level of indentation relative to the start of the line with the method call. - # - # method_call(a, - # b) - EnforcedStyle: with_first_parameter - SupportedStyles: - - with_first_parameter - - with_fixed_indentation - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/AndOr: - # Whether `and` and `or` are banned only in conditionals (conditionals) - # or completely (always). - EnforcedStyle: always - SupportedStyles: - - always - - conditionals - -Style/AsciiComments: - Enabled: false - -# Checks if usage of %() or %Q() matches configuration. -Style/BarePercentLiterals: - EnforcedStyle: bare_percent - SupportedStyles: - - percent_q - - bare_percent - -Style/BlockDelimiters: - EnforcedStyle: line_count_based - SupportedStyles: - # The `line_count_based` style enforces braces around single line blocks and - # do..end around multi-line blocks. - - line_count_based - # The `semantic` style enforces braces around functional blocks, where the - # primary purpose of the block is to return a value and do..end for - # procedural blocks, where the primary purpose of the block is its - # side-effects. - # - # This looks at the usage of a block's method to determine its type (e.g. is - # the result of a `map` assigned to a variable or passed to another - # method) but exceptions are permitted in the `ProceduralMethods`, - # `FunctionalMethods` and `IgnoredMethods` sections below. - - semantic - # The `braces_for_chaining` style enforces braces around single line blocks - # and do..end around multi-line blocks, except for multi-line blocks whose - # return value is being chained with another method (in which case braces - # are enforced). - - braces_for_chaining - ProceduralMethods: - # Methods that are known to be procedural in nature but look functional from - # their usage, e.g. - # - # time = Benchmark.realtime do - # foo.bar - # end - # - # Here, the return value of the block is discarded but the return value of - # `Benchmark.realtime` is used. - - benchmark - - bm - - bmbm - - create - - each_with_object - - measure - - new - - realtime - - tap - - with_object - FunctionalMethods: - # Methods that are known to be functional in nature but look procedural from - # their usage, e.g. - # - # let(:foo) { Foo.new } - # - # Here, the return value of `Foo.new` is used to define a `foo` helper but - # doesn't appear to be used from the return value of `let`. - - let - - let! - - subject - - watch - IgnoredMethods: - # Methods that can be either procedural or functional and cannot be - # categorised from their usage alone, e.g. - # - # foo = lambda do |x| - # puts "Hello, #{x}" - # end - # - # foo = lambda do |x| - # x * 100 - # end - # - # Here, it is impossible to tell from the return value of `lambda` whether - # the inner block's return value is significant. - - lambda - - proc - - it - -Style/BracesAroundHashParameters: - EnforcedStyle: no_braces - SupportedStyles: - # The `braces` style enforces braces around all method parameters that are - # hashes. - - braces - # The `no_braces` style checks that the last parameter doesn't have braces - # around it. - - no_braces - # The `context_dependent` style checks that the last parameter doesn't have - # braces around it, but requires braces if the second to last parameter is - # also a hash literal. - - context_dependent - -# Indentation of `when`. -Layout/CaseIndentation: - EnforcedStyle: case - SupportedStyles: - - case - - end - IndentOneStep: false - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - # This only matters if IndentOneStep is true - IndentationWidth: ~ - -Style/ClassAndModuleChildren: - Enabled: false - # Checks the style of children definitions at classes and modules. - # - # Basically there are two different styles: - # - # `nested` - have each child on a separate line - # class Foo - # class Bar - # end - # end - # - # `compact` - combine definitions as much as possible - # class Foo::Bar - # end - # - # The compact style is only forced, for classes / modules with one child. - EnforcedStyle: nested - SupportedStyles: - - nested - - compact - -Style/ClassCheck: - EnforcedStyle: is_a? - SupportedStyles: - - is_a? - - kind_of? - -# Align with the style guide. -Style/CollectionMethods: - # Mapping from undesired method to desired_method - # e.g. to use `detect` over `find`: - # - # CollectionMethods: - # PreferredMethods: - # find: detect - PreferredMethods: - collect: "map" - collect!: "map!" - inject: "reduce" - detect: "find" - find_all: "select" - -# Use ` or %x around command literals. -Style/CommandLiteral: - EnforcedStyle: backticks - # backticks: Always use backticks. - # percent_x: Always use %x. - # mixed: Use backticks on single-line commands, and %x on multi-line commands. - SupportedStyles: - - backticks - - percent_x - - mixed - # If false, the cop will always recommend using %x if one or more backticks - # are found in the command string. - AllowInnerBackticks: false - -# Checks formatting of special comments -Style/CommentAnnotation: - Keywords: - - TODO - - FIXME - - OPTIMIZE - - HACK - - REVIEW - -Style/ConditionalAssignment: - EnforcedStyle: assign_to_condition - SupportedStyles: - - assign_to_condition - - assign_inside_condition - # When configured to `assign_to_condition`, `SingleLineConditionsOnly` - # will only register an offense when all branches of a condition are - # a single line. - # When configured to `assign_inside_condition`, `SingleLineConditionsOnly` - # will only register an offense for assignment to a condition that has - # at least one multiline branch. - SingleLineConditionsOnly: true - -# Checks that you have put a copyright in a comment before any code. -# -# You can override the default Notice in your .rubocop.yml file. -# -# In order to use autocorrect, you must supply a value for the -# AutocorrectNotice key that matches the regexp Notice. A blank -# AutocorrectNotice will cause an error during autocorrect. -# -# Autocorrect will add a copyright notice in a comment at the top -# of the file immediately after any shebang or encoding comments. -# -# Example rubocop.yml: -# -# Style/Copyright: -# Enabled: true -# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc' -# AutocorrectNotice: "# Copyright (c) 2015 Yahoo! Inc." -# -Style/Copyright: - Notice: '^Copyright (\(c\) )?2[0-9]{3} .+' - AutocorrectNotice: "" - -Style/DocumentationMethod: - RequireForNonPublicMethods: false - -# Multi-line method chaining should be done with leading dots. -Layout/DotPosition: - EnforcedStyle: leading - SupportedStyles: - - leading - - trailing - -# Warn on empty else statements -# empty - warn only on empty else -# nil - warn on else with nil in it -# both - warn on empty else and else with nil in it -Style/EmptyElse: - EnforcedStyle: both - SupportedStyles: - - empty - - nil - - both - -# Use empty lines between defs. -Layout/EmptyLineBetweenDefs: - # If true, this parameter means that single line method definitions don't - # need an empty line between them. - AllowAdjacentOneLineDefs: false - -Layout/EmptyLinesAroundBlockBody: - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines - -Layout/EmptyLinesAroundClassBody: - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines - -Layout/EmptyLinesAroundModuleBody: - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines - -# Checks whether the source file has a utf-8 encoding comment or not -# AutoCorrectEncodingComment must match the regex -# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/ -Style/Encoding: - Enabled: true - -Layout/ExtraSpacing: - # When true, allows most uses of extra spacing if the intent is to align - # things with the previous or next line, not counting empty lines or comment - # lines. - AllowForAlignment: false - # When true, forces the alignment of = in assignments on consecutive lines. - ForceEqualSignAlignment: false - -Naming/FileName: - Exclude: - - "**/Gemfile" - - "**/Rakefile" - - "**/*.gemspec" - # When true, requires that each source file should define a class or module - # with a name which matches the file name (converted to ... case). - # It further expects it to be nested inside modules which match the names - # of subdirectories in its path. - ExpectMatchingDefinition: false - # If non-nil, expect all source file names to match the following regex. - # Only the file name itself is matched, not the entire file path. - # Use anchors as necessary if you want to match the entire name rather than - # just a part of it. - Regex: ~ - # With `IgnoreExecutableScripts` set to `true`, this cop does not - # report offending filenames for executable scripts (i.e. source - # files with a shebang in the first line). - IgnoreExecutableScripts: true - -Layout/IndentFirstArgument: - EnforcedStyle: special_for_inner_method_call_in_parentheses - SupportedStyles: - # The first parameter should always be indented one step more than the - # preceding line. - - consistent - # The first parameter should normally be indented one step more than the - # preceding line, but if it's a parameter for a method call that is itself - # a parameter in a method call, then the inner parameter should be indented - # relative to the inner method. - - special_for_inner_method_call - # Same as special_for_inner_method_call except that the special rule only - # applies if the outer method call encloses its arguments in parentheses. - - special_for_inner_method_call_in_parentheses - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -# Checks use of for or each in multiline loops. -Style/For: - EnforcedStyle: each - SupportedStyles: - - for - - each - -# Enforce the method used for string formatting. -Style/FormatString: - EnforcedStyle: format - SupportedStyles: - - format - - sprintf - - percent - -Style/FormatStringToken: - EnforcedStyle: template - -Style/FrozenStringLiteralComment: - EnforcedStyle: always - SupportedStyles: - - never - # `always` will always add the frozen string literal comment to a file - # regardless of the Ruby version or if `freeze` or `<<` are called on a - # string literal. If you run code against multiple versions of Ruby, it is - # possible that this will create errors in Ruby 2.3.0+. - - always - -# Built-in global variables are allowed by default. -Style/GlobalVars: - AllowedVariables: [] - -# `MinBodyLength` defines the number of lines of the a body of an if / unless -# needs to have to trigger this cop -Style/GuardClause: - MinBodyLength: 6 - -Style/HashSyntax: - EnforcedStyle: ruby19 - SupportedStyles: - # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys - - ruby19 - # checks for hash rocket syntax for all hashes - - hash_rockets - # forbids mixed key syntaxes (e.g. {a: 1, :b => 2}) - - no_mixed_keys - # enforces both ruby19 and no_mixed_keys styles - - ruby19_no_mixed_keys - # Force hashes that have a symbol value to use hash rockets - UseHashRocketsWithSymbolValues: false - # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style - PreferHashRocketsForNonAlnumEndingSymbols: false - -Layout/IndentationConsistency: - # The difference between `rails` and `normal` is that the `rails` style - # prescribes that in classes and modules the `protected` and `private` - # modifier keywords shall be indented the same as public methods and that - # protected and private members shall be indented one step more than the - # modifiers. Other than that, both styles mean that entities on the same - # logical depth shall have the same indentation. - EnforcedStyle: normal - SupportedStyles: - - normal - - rails - -Layout/IndentationWidth: - # Number of spaces for each indentation level. - Width: 2 - -# Checks the indentation of the first element in an array literal. -Layout/IndentFirstArrayElement: - # The value `special_inside_parentheses` means that array literals with - # brackets that have their opening bracket on the same line as a surrounding - # opening round parenthesis, shall have their first element indented relative - # to the first position inside the parenthesis. - # - # The value `consistent` means that the indentation of the first element shall - # always be relative to the first position of the line where the opening - # bracket is. - # - # The value `align_brackets` means that the indentation of the first element - # shall always be relative to the position of the opening bracket. - EnforcedStyle: special_inside_parentheses - SupportedStyles: - - special_inside_parentheses - - consistent - - align_brackets - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -# Checks the indentation of assignment RHS, when on a different line from LHS -Layout/IndentAssignment: - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -# Checks the indentation of the first key in a hash literal. -Layout/IndentFirstHashElement: - # The value `special_inside_parentheses` means that hash literals with braces - # that have their opening brace on the same line as a surrounding opening - # round parenthesis, shall have their first key indented relative to the - # first position inside the parenthesis. - # - # The value `consistent` means that the indentation of the first key shall - # always be relative to the first position of the line where the opening - # brace is. - # - # The value `align_braces` means that the indentation of the first key shall - # always be relative to the position of the opening brace. - EnforcedStyle: special_inside_parentheses - SupportedStyles: - - special_inside_parentheses - - consistent - - align_braces - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/Lambda: - EnforcedStyle: line_count_dependent - SupportedStyles: - - line_count_dependent - - lambda - - literal - Exclude: - - "**/types/**/*" - - "**/*_interface.rb" - -Style/LambdaCall: - EnforcedStyle: call - SupportedStyles: - - call - - braces - -Style/Next: - # With `always` all conditions at the end of an iteration needs to be - # replaced by next - with `skip_modifier_ifs` the modifier if like this one - # are ignored: [1, 2].each { |a| return "yes" if a == 1 } - EnforcedStyle: skip_modifier_ifs - # `MinBodyLength` defines the number of lines of the a body of an if / unless - # needs to have to trigger this cop - MinBodyLength: 3 - SupportedStyles: - - skip_modifier_ifs - - always - -Style/NonNilCheck: - # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for - # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is - # **usually** OK, but might change behavior. - # - # With `IncludeSemanticChanges` set to `false`, this cop does not report - # offenses for `!x.nil?` and does no changes that might change behavior. - IncludeSemanticChanges: false - -Style/NumericPredicate: - EnforcedStyle: predicate - SupportedStyles: - - predicate - - comparison - -Style/MethodDefParentheses: - EnforcedStyle: require_parentheses - SupportedStyles: - - require_parentheses - - require_no_parentheses - - require_no_parentheses_except_multiline - -Naming/MethodName: - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase - -Style/ModuleFunction: - EnforcedStyle: module_function - SupportedStyles: - - module_function - - extend_self - -Layout/MultilineArrayBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on the same line as last element - - symmetrical - - new_line - - same_line - -Layout/MultilineAssignmentLayout: - # The types of assignments which are subject to this rule. - SupportedTypes: - - block - - case - - class - - if - - kwbegin - - module - EnforcedStyle: new_line - SupportedStyles: - # Ensures that the assignment operator and the rhs are on the same line for - # the set of supported types. - - same_line - # Ensures that the assignment operator and the rhs are on separate lines - # for the set of supported types. - - new_line - -Layout/MultilineHashBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on same line as last element - - symmetrical - - new_line - - same_line - -Layout/MultilineMethodCallBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on the same line as last argument - - symmetrical - - new_line - - same_line - -Layout/MultilineMethodCallIndentation: - EnforcedStyle: aligned - SupportedStyles: - - aligned - - indented - - indented_relative_to_receiver - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Layout/MultilineMethodDefinitionBraceLayout: - EnforcedStyle: symmetrical - SupportedStyles: - # symmetrical: closing brace is positioned in same way as opening brace - # new_line: closing brace is always on a new line - # same_line: closing brace is always on the same line as last parameter - - symmetrical - - new_line - - same_line - -Layout/MultilineOperationIndentation: - EnforcedStyle: aligned - SupportedStyles: - - aligned - - indented - # By default, the indentation width from Style/IndentationWidth is used - # But it can be overridden by setting this parameter - IndentationWidth: ~ - -Style/NumericLiterals: - MinDigits: 5 - -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_with_o - SupportedOctalStyles: - - zero_with_o - - zero_only - -Style/OptionHash: - # A list of parameter names that will be flagged by this cop. - SuspiciousParamNames: - - options - - opts - - args - - params - - parameters - -# Allow safe assignment in conditions. -Style/ParenthesesAroundCondition: - AllowSafeAssignment: true - -Style/PercentLiteralDelimiters: - PreferredDelimiters: - "%": () - "%i": () - "%q": () - "%Q": () - "%r": "{}" - "%s": () - "%w": () - "%W": () - "%x": () - -Style/PercentQLiterals: - EnforcedStyle: lower_case_q - SupportedStyles: - - lower_case_q # Use %q when possible, %Q when necessary - - upper_case_q # Always use %Q - -Naming/PredicateName: - # Predicate name prefixes. - NamePrefix: - - is_ - - has_ - - have_ - # Predicate name prefixes that should be removed. - NamePrefixBlacklist: - - is_ - - have_ - # Predicate names which, despite having a blacklisted prefix, or no ?, - # should still be accepted - NameWhitelist: - - is_a? - # Exclude Rspec specs because there is a strong convetion to write spec - # helpers in the form of `have_something` or `be_something`. - Exclude: - - "**/spec/**/*" - - "**/test/**/*" - -Style/PreferredHashMethods: - Enabled: true - EnforcedStyle: verbose - -Style/DateTime: - Enabled: true - -Style/Documentation: - Enabled: false - -Style/RaiseArgs: - EnforcedStyle: exploded - SupportedStyles: - - compact # raise Exception.new(msg) - - exploded # raise Exception, msg - -Style/RedundantReturn: - # When true allows code like `return x, y`. - AllowMultipleReturnValues: false - -# Use / or %r around regular expressions. -Style/RegexpLiteral: - EnforcedStyle: slashes - # slashes: Always use slashes. - # percent_r: Always use %r. - # mixed: Use slashes on single-line regexes, and %r on multi-line regexes. - SupportedStyles: - - slashes - - percent_r - - mixed - # If false, the cop will always recommend using %r if one or more slashes - # are found in the regexp string. - AllowInnerSlashes: false - -Style/SafeNavigation: - Enabled: false - -Style/Semicolon: - # Allow ; to separate several expressions on the same line. - AllowAsExpressionSeparator: false - -Style/SignalException: - EnforcedStyle: only_raise - SupportedStyles: - - only_raise - - only_fail - - semantic - -Style/SingleLineBlockParams: - Methods: - - reduce: - - a - - e - - inject: - - a - - e - -Style/SingleLineMethods: - AllowIfMethodIsEmpty: true - -Layout/SpaceBeforeFirstArg: - # When true, allows most uses of extra spacing if the intent is to align - # things with the previous or next line, not counting empty lines or comment - # lines. - AllowForAlignment: true - -Style/SpecialGlobalVars: - EnforcedStyle: use_english_names - SupportedStyles: - - use_perl_names - - use_english_names - -Style/StabbyLambdaParentheses: - EnforcedStyle: require_parentheses - SupportedStyles: - - require_parentheses - - require_no_parentheses - -Style/StringLiterals: - EnforcedStyle: double_quotes - SupportedStyles: - - single_quotes - - double_quotes - # If true, strings which span multiple lines using \ for continuation must - # use the same type of quotes on each line. - ConsistentQuotesInMultiline: false - -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - SupportedStyles: - - single_quotes - - double_quotes - -Style/StringMethods: - # Mapping from undesired method to desired_method - # e.g. to use `to_sym` over `intern`: - # - # StringMethods: - # PreferredMethods: - # intern: to_sym - PreferredMethods: - intern: to_sym - -Layout/SpaceAroundBlockParameters: - EnforcedStyleInsidePipes: no_space - -Layout/SpaceAroundEqualsInParameterDefault: - EnforcedStyle: space - SupportedStyles: - - space - - no_space - -Layout/SpaceAroundOperators: - # When true, allows most uses of extra spacing if the intent is to align - # with an operator on the previous or next line, not counting empty lines - # or comment lines. - AllowForAlignment: true - -Layout/SpaceBeforeBlockBraces: - EnforcedStyle: space - SupportedStyles: - - space - - no_space - -Layout/SpaceInsideBlockBraces: - EnforcedStyle: space - SupportedStyles: - - space - - no_space - # Valid values are: space, no_space - EnforcedStyleForEmptyBraces: no_space - # Space between { and |. Overrides EnforcedStyle if there is a conflict. - SpaceBeforeBlockParameters: true - -Layout/SpaceInsideHashLiteralBraces: - EnforcedStyle: space - EnforcedStyleForEmptyBraces: no_space - SupportedStyles: - - space - - no_space - # "compact" normally requires a space inside hash braces, with the exception - # that successive left braces or right braces are collapsed together - - compact - -Layout/SpaceInsideStringInterpolation: - EnforcedStyle: no_space - SupportedStyles: - - space - - no_space - -Style/AccessModifierDeclarations: - Enabled: false - -Style/SymbolArray: - EnforcedStyle: brackets - SupportedStyles: - - percent - - brackets - -Style/SymbolProc: - # A list of method names to be ignored by the check. - # The names should be fairly unique, otherwise you'll end up ignoring lots of code. - IgnoredMethods: - - respond_to - - define_method - -Style/TernaryParentheses: - EnforcedStyle: require_no_parentheses - SupportedStyles: - - require_parentheses - - require_no_parentheses - AllowSafeAssignment: true - -Layout/TrailingBlankLines: - EnforcedStyle: final_newline - SupportedStyles: - - final_newline - - final_blank_line - -Style/TrailingCommaInArguments: - # If `comma`, the cop requires a comma after the last argument, but only for - # parenthesized method calls where each argument is on its own line. - # If `consistent_comma`, the cop requires a comma after the last argument, - # for all parenthesized method calls with arguments. - EnforcedStyleForMultiline: no_comma - -Style/TrailingCommaInArrayLiteral: - # If `comma`, the cop requires a comma after the last item in an array or - # hash, but only when each item is on its own line. - # If `consistent_comma`, the cop requires a comma after the last item of all - # non-empty array and hash literals. - EnforcedStyleForMultiline: no_comma - -Style/TrailingCommaInHashLiteral: - # If `comma`, the cop requires a comma after the last item in an array or - # hash, but only when each item is on its own line. - # If `consistent_comma`, the cop requires a comma after the last item of all - # non-empty array and hash literals. - EnforcedStyleForMultiline: no_comma - -# TrivialAccessors requires exact name matches and doesn't allow -# predicated methods by default. -Style/TrivialAccessors: - # When set to false the cop will suggest the use of accessor methods - # in situations like: - # - # def name - # @other_name - # end - # - # This way you can uncover "hidden" attributes in your code. - ExactNameMatch: true - AllowPredicates: true - # Allows trivial writers that don't end in an equal sign. e.g. - # - # def on_exception(action) - # @on_exception=action - # end - # on_exception :restart - # - # Commonly used in DSLs - AllowDSLWriters: false - IgnoreClassMethods: false - Whitelist: - - to_ary - - to_a - - to_c - - to_enum - - to_h - - to_hash - - to_i - - to_int - - to_io - - to_open - - to_path - - to_proc - - to_r - - to_regexp - - to_str - - to_s - - to_sym - -Naming/VariableName: - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase - -Naming/VariableNumber: - EnforcedStyle: normalcase - SupportedStyles: - - snake_case - - normalcase - - non_integer - -# WordArray enforces how array literals of word-like strings should be expressed. -Style/WordArray: - EnforcedStyle: percent - SupportedStyles: - # percent style: %w(word1 word2) - - percent - # bracket style: ["word1", "word2"] - - brackets - # The MinSize option causes the WordArray rule to be ignored for arrays - # smaller than a certain size. The rule is only applied to arrays - # whose element count is greater than or equal to MinSize. - MinSize: 2 - # The regular expression WordRegex decides what is considered a word. - WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/' - -##################### Metrics ################################## - -Metrics/AbcSize: - # The ABC size is a calculated magnitude, so this number can be an Integer or - # a Float. - Max: 15 - Enabled: false - -Metrics/BlockNesting: - Max: 3 - -Metrics/ClassLength: - CountComments: false # count full line comments? - Max: 100 - Enabled: false - -Metrics/ModuleLength: - CountComments: false # count full line comments? - Max: 100 - Enabled: false - -# Avoid complex methods. -Metrics/CyclomaticComplexity: - Max: 9 - Exclude: - - "**/*/permissions.rb" - -Metrics/LineLength: - Max: 180 - # To make it possible to copy or click on URIs in the code, we allow lines - # containing a URI to be longer than Max. - AllowHeredoc: true - AllowURI: true - URISchemes: - - http - - https - Exclude: - - "**/spec/**/*" - -Metrics/MethodLength: - CountComments: false # count full line comments? - Max: 15 - Enabled: false - -Metrics/ParameterLists: - Max: 5 - CountKeywordArgs: true - Exclude: - - "decidim-core/lib/decidim/filter_form_builder.rb" - -Metrics/PerceivedComplexity: - Max: 10 - Exclude: - - "**/*/permissions.rb" - -##################### Lint ################################## - -Lint/AmbiguousBlockAssociation: - Enabled: true - Exclude: - - "**/abilities/**/*" - -# Allow safe assignment in conditions. -Lint/AssignmentInCondition: - AllowSafeAssignment: true - -# checks whether the end keywords are aligned properly for `do` `end` blocks. -Layout/BlockAlignment: - # The value `start_of_block` means that the `end` should be aligned with line - # where the `do` keyword appears. - # The value `start_of_line` means it should be aligned with the whole - # expression's starting line. - # The value `either` means both are allowed. - EnforcedStyleAlignWith: either - -# Align ends correctly. -Layout/EndAlignment: - # The value `keyword` means that `end` should be aligned with the matching - # keyword (if, while, etc.). - # The value `variable` means that in assignments, `end` should be aligned - # with the start of the variable on the left hand side of `=`. In all other - # situations, `end` should still be aligned with the keyword. - # The value `start_of_line` means that `end` should be aligned with the start - # of the line which the matching keyword appears on. - EnforcedStyleAlignWith: keyword - AutoCorrect: false - -Layout/DefEndAlignment: - # The value `def` means that `end` should be aligned with the def keyword. - # The value `start_of_line` means that `end` should be aligned with method - # calls like `private`, `public`, etc, if present in front of the `def` - # keyword on the same line. - EnforcedStyleAlignWith: start_of_line - AutoCorrect: false - -Lint/InheritException: - # The default base class in favour of `Exception`. - EnforcedStyle: runtime_error - SupportedStyles: - - runtime_error - - standard_error - -# Checks for unused block arguments -Lint/UnusedBlockArgument: - IgnoreEmptyBlocks: true - AllowUnusedKeywordArguments: false - -# Checks for unused method arguments. -Lint/UnusedMethodArgument: - AllowUnusedKeywordArguments: false - IgnoreEmptyMethods: true - -##################### Performance ############################ - -Metrics/BlockLength: - Enabled: false - -RSpec/BeforeAfterAll: - Enabled: true - -RSpec/ContextWording: - Enabled: true - Prefixes: - - when - - with - - without - - and - -RSpec/DescribeClass: - Exclude: - - spec/gemfiles_spec.rb - - spec/js_bundles_spec.rb - - spec/i18n_spec.rb - - "**/*/spec/**/*_badge_spec.rb" - - decidim-core/spec/lib/global_engines_spec.rb - - "**/tasks/**/*" - -RSpec/EmptyExampleGroup: - Exclude: - - decidim-core/spec/lib/participatory_space_manifest_spec.rb - -RSpec/ExampleLength: - Max: 49 - -RSpec/ExpectInHook: - Enabled: false - -RSpec/IteratedExpectation: - Enabled: true - -RSpec/LetSetup: - Enabled: false - -RSpec/MessageSpies: - Enabled: false - -RSpec/MultipleExpectations: - Enabled: false - -RSpec/NestedGroups: - Max: 7 - -RSpec/NamedSubject: - Enabled: false - -RSpec/RepeatedExampleGroupDescription: - Enabled: false - -RSpec/RepeatedExampleGroupBody: - Enabled: false -RSpec/VerifiedDoubles: - Enabled: false - -RSpec/LeakyConstantDeclaration: - Enabled: false - -RSpec/DescribedClass: - Enabled: false - -inherit_from: .rubocop_rails.yml +inherit_from: + - .rubocop_ruby.yml + - .rubocop_rails.yml diff --git a/.rubocop_rails.yml b/.rubocop_rails.yml index cf139e4..78093bd 100644 --- a/.rubocop_rails.yml +++ b/.rubocop_rails.yml @@ -5,22 +5,25 @@ Rails: Rails/ActionFilter: Include: - - decidim-*/app/controllers/**/*.rb + - app/controllers/**/*.rb + +Rails/ContentTag: + Enabled: false Rails/CreateTableWithTimestamps: Enabled: false Rails/EnumUniqueness: Include: - - decidim-*/app/models/**/*.rb + - app/models/**/*.rb Rails/Exit: Include: - - decidim-*/app/**/*.rb - - decidim-*/config/**/*.rb - - decidim-*/lib/**/*.rb + - app/**/*.rb + - config/**/*.rb + - lib/**/*.rb Exclude: - - decidim-*/lib/**/*.rake + - lib/**/*.rake Rails/FindBy: Include: @@ -28,57 +31,71 @@ Rails/FindBy: Rails/FindEach: Include: - - decidim-*/app/models/**/*.rb + - app/models/**/*.rb Rails/HasAndBelongsToMany: Include: - - decidim-*/app/models/**/*.rb + - app/models/**/*.rb Rails/HasManyOrHasOneDependent: Include: - - decidim-*/app/models/**/*.rb + - app/models/**/*.rb Rails/InverseOf: Enabled: false Rails/LexicallyScopedActionFilter: Include: - - decidim-*/app/controllers/**/*.rb + - app/controllers/**/*.rb Rails/NotNullColumn: Enabled: false Rails/Output: Include: - - decidim-*/app/**/*.rb - - decidim-*/config/**/*.rb - - decidim-*/db/**/*.rb - - decidim-*/lib/**/*.rb + - app/**/*.rb + - config/**/*.rb + - db/**/*.rb + - lib/**/*.rb Exclude: - - decidim-core/db/seeds.rb - - decidim-core/lib/decidim/core.rb - - decidim-core/lib/decidim/component_manifest.rb - - decidim-core/lib/decidim/participatory_space_manifest.rb - - decidim-system/db/seeds.rb - - decidim-templates/db/seeds.rb + - db/seeds.rb + - lib/decidim/core.rb + - lib/decidim/component_manifest.rb + - lib/decidim/participatory_space_manifest.rb + - db/seeds.rb + - db/seeds.rb Rails/OutputSafety: Enabled: false +Rails/Pluck: + Enabled: false + +Rails/RakeEnvironment: + Enabled: false + Rails/ReadWriteAttribute: Include: - - decidim-*/app/models/**/*.rb + - app/models/**/*.rb Rails/ReversibleMigration: Enabled: false Rails/ScopeArgs: Include: - - decidim-*/app/models/**/*.rb + - app/models/**/*.rb Rails/SkipsModelValidations: Enabled: true Rails/Validation: Include: - - decidim-*/app/models/**/*.rb + - app/models/**/*.rb + +Rails/BulkChangeTable: + Exclude: + - db/**/* + +RSpec/MultipleMemoizedHelpers: + Exclude: + - spec/**/** diff --git a/.rubocop_ruby.yml b/.rubocop_ruby.yml new file mode 100644 index 0000000..3634d85 --- /dev/null +++ b/.rubocop_ruby.yml @@ -0,0 +1,1761 @@ +require: + - rubocop-rspec + - rubocop-faker + +# Common configuration. +AllCops: + Include: + - .simplecov + - "**/*.rb" + - "**/*.rake" + - "**/*.gemspec" + - "**/*.ru" + - "**/Gemfile" + - "**/Rakefile" + Exclude: + - "vendor/**/*" + - "node_modules/**/*" + - "db/schema.rb" + - "spec/decidim_dummy_app/**/*" + # Default formatter will be used if no -f/--format option is given. + DefaultFormatter: progress + # Cop names are not displayed in offense messages by default. Change behavior + # by overriding DisplayCopNames, or by giving the -D/--display-cop-names + # option. + DisplayCopNames: true + # Style guide URLs are not displayed in offense messages by default. Change + # behavior by overriding DisplayStyleGuide, or by giving the + # -S/--display-style-guide option. + DisplayStyleGuide: false + # Extra details are not displayed in offense messages by default. Change + # behavior by overriding ExtraDetails, or by giving the + # -E/--extra-details option. + ExtraDetails: false + NewCops: enable + # Additional cops that do not reference a style guide rule may be enabled by + # default. Change behavior by overriding StyleGuideCopsOnly, or by giving + # the --only-guide-cops option. + StyleGuideCopsOnly: false + # All cops except the ones in disabled.yml are enabled by default. Change + # this behavior by overriding DisabledByDefault. When DisabledByDefault is + # true, all cops in the default configuration are disabled, and and only cops + # in user configuration are enabled. This makes cops opt-in instead of + # opt-out. Note that when DisabledByDefault is true, cops in user + # configuration will be enabled even if they don't set the Enabled parameter. + DisabledByDefault: false + # Enables the result cache if true. Can be overridden by the --cache command + # line option. + UseCache: true + # Threshold for how many files can be stored in the result cache before some + # of the files are automatically removed. + MaxFilesInCache: 20000 + # The cache will be stored in "rubocop_cache" under this directory. The name + # "/tmp" is special and will be converted to the system temporary directory, + # which is "/tmp" on Unix-like systems, but could be something else on other + # systems. + CacheRootDirectory: /tmp + # The default cache root directory is /tmp, which on most systems is + # writable by any system user. This means that it is possible for a + # malicious user to anticipate the location of Rubocop's cache directory, + # and create a symlink in its place that could cause Rubocop to overwrite + # unintended files, or read malicious input. If you are certain that your + # cache location is secure from this kind of attack, and wish to use a + # symlinked cache location, set this value to "true". + AllowSymlinksInCacheRootDirectory: true + # What MRI version of the Ruby interpreter is the inspected code intended to + # run on? (If there is more than one, set this to the lowest version.) + # If a value is specified for TargetRubyVersion then it is used. + # Else if .ruby-version exists and it contains an MRI version it is used. + # Otherwise we fallback to the oldest officially supported Ruby version (2.0). + TargetRubyVersion: 2.7 + + RSpec: + Patterns: + - "(?:^|/)spec/" + - "(?:^|/)test/" + +Lint/SafeNavigationChain: + Exclude: + - lib/tasks/migrate.rake + +# Indent private/protected/public as deep as method definitions +Layout/AccessModifierIndentation: + EnforcedStyle: indent + SupportedStyles: + - outdent + - indent + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +Style/Alias: + EnforcedStyle: prefer_alias + SupportedStyles: + - prefer_alias + - prefer_alias_method + +# Align the elements of a hash literal if they span more than one line. +Layout/HashAlignment: + # Alignment of entries using hash rocket as separator. Valid values are: + # + # key - left alignment of keys + # "a" => 2 + # "bb" => 3 + # separator - alignment of hash rockets, keys are right aligned + # "a" => 2 + # "bb" => 3 + # table - left alignment of keys, hash rockets, and values + # "a" => 2 + # "bb" => 3 + EnforcedHashRocketStyle: key + # Alignment of entries using colon as separator. Valid values are: + # + # key - left alignment of keys + # a: 0 + # bb: 1 + # separator - alignment of colons, keys are right aligned + # a: 0 + # bb: 1 + # table - left alignment of keys and values + # a: 0 + # bb: 1 + EnforcedColonStyle: key + # Select whether hashes that are the last argument in a method call should be + # inspected? Valid values are: + # + # always_inspect - Inspect both implicit and explicit hashes. + # Registers an offense for: + # function(a: 1, + # b: 2) + # Registers an offense for: + # function({a: 1, + # b: 2}) + # always_ignore - Ignore both implicit and explicit hashes. + # Accepts: + # function(a: 1, + # b: 2) + # Accepts: + # function({a: 1, + # b: 2}) + # ignore_implicit - Ignore only implicit hashes. + # Accepts: + # function(a: 1, + # b: 2) + # Registers an offense for: + # function({a: 1, + # b: 2}) + # ignore_explicit - Ignore only explicit hashes. + # Accepts: + # function({a: 1, + # b: 2}) + # Registers an offense for: + # function(a: 1, + # b: 2) + EnforcedLastArgumentHashStyle: always_inspect + SupportedLastArgumentHashStyles: + - always_inspect + - always_ignore + - ignore_implicit + - ignore_explicit + +Layout/ParameterAlignment: + # Alignment of parameters in multi-line method calls. + # + # The `with_first_parameter` style aligns the following lines along the same + # column as the first parameter. + # + # method_call(a, + # b) + # + # The `with_fixed_indentation` style aligns the following lines with one + # level of indentation relative to the start of the line with the method call. + # + # method_call(a, + # b) + EnforcedStyle: with_first_parameter + SupportedStyles: + - with_first_parameter + - with_fixed_indentation + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +Style/ArrayCoercion: + Description: >- + Use Array() instead of explicit Array check or [*var], when dealing + with a variable you want to treat as an Array, but you're not certain it's an array. + StyleGuide: '#array-coercion' + Safe: false + Enabled: false + VersionAdded: '0.88' + +Style/AndOr: + # Whether `and` and `or` are banned only in conditionals (conditionals) + # or completely (always). + EnforcedStyle: always + SupportedStyles: + - always + - conditionals + +Style/AsciiComments: + Enabled: false + +# Checks if usage of %() or %Q() matches configuration. +Style/BarePercentLiterals: + EnforcedStyle: bare_percent + SupportedStyles: + - percent_q + - bare_percent + +Style/BlockDelimiters: + EnforcedStyle: line_count_based + SupportedStyles: + # The `line_count_based` style enforces braces around single line blocks and + # do..end around multi-line blocks. + - line_count_based + # The `semantic` style enforces braces around functional blocks, where the + # primary purpose of the block is to return a value and do..end for + # procedural blocks, where the primary purpose of the block is its + # side-effects. + # + # This looks at the usage of a block's method to determine its type (e.g. is + # the result of a `map` assigned to a variable or passed to another + # method) but exceptions are permitted in the `ProceduralMethods`, + # `FunctionalMethods` and `IgnoredMethods` sections below. + - semantic + # The `braces_for_chaining` style enforces braces around single line blocks + # and do..end around multi-line blocks, except for multi-line blocks whose + # return value is being chained with another method (in which case braces + # are enforced). + - braces_for_chaining + ProceduralMethods: + # Methods that are known to be procedural in nature but look functional from + # their usage, e.g. + # + # time = Benchmark.realtime do + # foo.bar + # end + # + # Here, the return value of the block is discarded but the return value of + # `Benchmark.realtime` is used. + - benchmark + - bm + - bmbm + - create + - each_with_object + - measure + - new + - realtime + - tap + - with_object + FunctionalMethods: + # Methods that are known to be functional in nature but look procedural from + # their usage, e.g. + # + # let(:foo) { Foo.new } + # + # Here, the return value of `Foo.new` is used to define a `foo` helper but + # doesn't appear to be used from the return value of `let`. + - let + - let! + - subject + - watch + IgnoredMethods: + # Methods that can be either procedural or functional and cannot be + # categorised from their usage alone, e.g. + # + # foo = lambda do |x| + # puts "Hello, #{x}" + # end + # + # foo = lambda do |x| + # x * 100 + # end + # + # Here, it is impossible to tell from the return value of `lambda` whether + # the inner block's return value is significant. + - lambda + - proc + - it + +Style/ExplicitBlockArgument: + Enabled: false + +Style/HashEachMethods: + Enabled: false + +Style/HashLikeCase: + MinBranchesCount: 5 + +# Indentation of `when`. +Layout/CaseIndentation: + EnforcedStyle: case + SupportedStyles: + - case + - end + IndentOneStep: false + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + # This only matters if IndentOneStep is true + IndentationWidth: ~ + +Style/ClassAndModuleChildren: + Enabled: false + # Checks the style of children definitions at classes and modules. + # + # Basically there are two different styles: + # + # `nested` - have each child on a separate line + # class Foo + # class Bar + # end + # end + # + # `compact` - combine definitions as much as possible + # class Foo::Bar + # end + # + # The compact style is only forced, for classes / modules with one child. + EnforcedStyle: nested + SupportedStyles: + - nested + - compact + +Style/ClassCheck: + EnforcedStyle: is_a? + SupportedStyles: + - is_a? + - kind_of? + +# Align with the style guide. +Style/CollectionMethods: + # Mapping from undesired method to desired_method + # e.g. to use `detect` over `find`: + # + # CollectionMethods: + # PreferredMethods: + # find: detect + PreferredMethods: + collect: "map" + collect!: "map!" + inject: "reduce" + detect: "find" + find_all: "select" + +# Use ` or %x around command literals. +Style/CommandLiteral: + EnforcedStyle: backticks + # backticks: Always use backticks. + # percent_x: Always use %x. + # mixed: Use backticks on single-line commands, and %x on multi-line commands. + SupportedStyles: + - backticks + - percent_x + - mixed + # If false, the cop will always recommend using %x if one or more backticks + # are found in the command string. + AllowInnerBackticks: false + +# Checks formatting of special comments +Style/CommentAnnotation: + Keywords: + - TODO + - FIXME + - OPTIMIZE + - HACK + - REVIEW + +Style/ConditionalAssignment: + EnforcedStyle: assign_to_condition + SupportedStyles: + - assign_to_condition + - assign_inside_condition + # When configured to `assign_to_condition`, `SingleLineConditionsOnly` + # will only register an offense when all branches of a condition are + # a single line. + # When configured to `assign_inside_condition`, `SingleLineConditionsOnly` + # will only register an offense for assignment to a condition that has + # at least one multiline branch. + SingleLineConditionsOnly: true + +# Checks that you have put a copyright in a comment before any code. +# +# You can override the default Notice in your .rubocop.yml file. +# +# In order to use autocorrect, you must supply a value for the +# AutocorrectNotice key that matches the regexp Notice. A blank +# AutocorrectNotice will cause an error during autocorrect. +# +# Autocorrect will add a copyright notice in a comment at the top +# of the file immediately after any shebang or encoding comments. +# +# Example rubocop.yml: +# +# Style/Copyright: +# Enabled: true +# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc' +# AutocorrectNotice: "# Copyright (c) 2015 Yahoo! Inc." +# +Style/Copyright: + Notice: '^Copyright (\(c\) )?2[0-9]{3} .+' + AutocorrectNotice: "" + +Style/DocumentationMethod: + RequireForNonPublicMethods: false + +Style/MixinUsage: + Exclude: + - "bin/*" + +# Multi-line method chaining should be done with leading dots. +Layout/DotPosition: + EnforcedStyle: leading + SupportedStyles: + - leading + - trailing + +# Warn on empty else statements +# empty - warn only on empty else +# nil - warn on else with nil in it +# both - warn on empty else and else with nil in it +Style/EmptyElse: + EnforcedStyle: both + SupportedStyles: + - empty + - nil + - both + +# Use empty lines between defs. +Layout/EmptyLineBetweenDefs: + # If true, this parameter means that single line method definitions don't + # need an empty line between them. + AllowAdjacentOneLineDefs: false + +Layout/EmptyLinesAroundBlockBody: + EnforcedStyle: no_empty_lines + SupportedStyles: + - empty_lines + - no_empty_lines + +Layout/EmptyLinesAroundClassBody: + EnforcedStyle: no_empty_lines + SupportedStyles: + - empty_lines + - no_empty_lines + +Layout/EmptyLinesAroundModuleBody: + EnforcedStyle: no_empty_lines + SupportedStyles: + - empty_lines + - no_empty_lines + +# Checks whether the source file has a utf-8 encoding comment or not +# AutoCorrectEncodingComment must match the regex +# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/ +Style/Encoding: + Enabled: true + +Layout/ExtraSpacing: + # When true, allows most uses of extra spacing if the intent is to align + # things with the previous or next line, not counting empty lines or comment + # lines. + AllowForAlignment: false + # When true, forces the alignment of = in assignments on consecutive lines. + ForceEqualSignAlignment: false + +Naming/FileName: + Exclude: + - "**/Gemfile" + - "**/Rakefile" + - "**/*.gemspec" + # When true, requires that each source file should define a class or module + # with a name which matches the file name (converted to ... case). + # It further expects it to be nested inside modules which match the names + # of subdirectories in its path. + ExpectMatchingDefinition: false + # If non-nil, expect all source file names to match the following regex. + # Only the file name itself is matched, not the entire file path. + # Use anchors as necessary if you want to match the entire name rather than + # just a part of it. + Regex: ~ + # With `IgnoreExecutableScripts` set to `true`, this cop does not + # report offending filenames for executable scripts (i.e. source + # files with a shebang in the first line). + IgnoreExecutableScripts: true + +Layout/FirstArgumentIndentation: + EnforcedStyle: special_for_inner_method_call_in_parentheses + SupportedStyles: + # The first parameter should always be indented one step more than the + # preceding line. + - consistent + # The first parameter should normally be indented one step more than the + # preceding line, but if it's a parameter for a method call that is itself + # a parameter in a method call, then the inner parameter should be indented + # relative to the inner method. + - special_for_inner_method_call + # Same as special_for_inner_method_call except that the special rule only + # applies if the outer method call encloses its arguments in parentheses. + - special_for_inner_method_call_in_parentheses + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +# Checks use of for or each in multiline loops. +Style/For: + EnforcedStyle: each + SupportedStyles: + - for + - each + +# Enforce the method used for string formatting. +Style/FormatString: + EnforcedStyle: format + SupportedStyles: + - format + - sprintf + - percent + +Style/FormatStringToken: + EnforcedStyle: template + +Style/FrozenStringLiteralComment: + EnforcedStyle: always + SupportedStyles: + - never + # `always` will always add the frozen string literal comment to a file + # regardless of the Ruby version or if `freeze` or `<<` are called on a + # string literal. If you run code against multiple versions of Ruby, it is + # possible that this will create errors in Ruby 2.3.0+. + - always + +# Built-in global variables are allowed by default. +Style/GlobalVars: + AllowedVariables: [] + +# `MinBodyLength` defines the number of lines of the a body of an if / unless +# needs to have to trigger this cop +Style/GuardClause: + MinBodyLength: 6 + +Style/HashSyntax: + EnforcedStyle: ruby19 + SupportedStyles: + # checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys + - ruby19 + # checks for hash rocket syntax for all hashes + - hash_rockets + # forbids mixed key syntaxes (e.g. {a: 1, :b => 2}) + - no_mixed_keys + # enforces both ruby19 and no_mixed_keys styles + - ruby19_no_mixed_keys + # Force hashes that have a symbol value to use hash rockets + UseHashRocketsWithSymbolValues: false + # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style + PreferHashRocketsForNonAlnumEndingSymbols: false + +Layout/IndentationConsistency: + # The difference between `rails` and `normal` is that the `rails` style + # prescribes that in classes and modules the `protected` and `private` + # modifier keywords shall be indented the same as public methods and that + # protected and private members shall be indented one step more than the + # modifiers. Other than that, both styles mean that entities on the same + # logical depth shall have the same indentation. + EnforcedStyle: normal + SupportedStyles: + - normal + - rails + +Layout/IndentationWidth: + # Number of spaces for each indentation level. + Width: 2 + +# Checks the indentation of the first element in an array literal. +Layout/FirstArrayElementIndentation: + # The value `special_inside_parentheses` means that array literals with + # brackets that have their opening bracket on the same line as a surrounding + # opening round parenthesis, shall have their first element indented relative + # to the first position inside the parenthesis. + # + # The value `consistent` means that the indentation of the first element shall + # always be relative to the first position of the line where the opening + # bracket is. + # + # The value `align_brackets` means that the indentation of the first element + # shall always be relative to the position of the opening bracket. + EnforcedStyle: special_inside_parentheses + SupportedStyles: + - special_inside_parentheses + - consistent + - align_brackets + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +# Checks the indentation of assignment RHS, when on a different line from LHS +Layout/AssignmentIndentation: + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +# Checks the indentation of the first key in a hash literal. +Layout/FirstHashElementIndentation: + # The value `special_inside_parentheses` means that hash literals with braces + # that have their opening brace on the same line as a surrounding opening + # round parenthesis, shall have their first key indented relative to the + # first position inside the parenthesis. + # + # The value `consistent` means that the indentation of the first key shall + # always be relative to the first position of the line where the opening + # brace is. + # + # The value `align_braces` means that the indentation of the first key shall + # always be relative to the position of the opening brace. + EnforcedStyle: special_inside_parentheses + SupportedStyles: + - special_inside_parentheses + - consistent + - align_braces + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +Style/Lambda: + EnforcedStyle: line_count_dependent + SupportedStyles: + - line_count_dependent + - lambda + - literal + Exclude: + - "**/types/**/*" + - "**/*_interface.rb" + +Style/LambdaCall: + EnforcedStyle: call + SupportedStyles: + - call + - braces + +Style/Next: + # With `always` all conditions at the end of an iteration needs to be + # replaced by next - with `skip_modifier_ifs` the modifier if like this one + # are ignored: [1, 2].each { |a| return "yes" if a == 1 } + EnforcedStyle: skip_modifier_ifs + # `MinBodyLength` defines the number of lines of the a body of an if / unless + # needs to have to trigger this cop + MinBodyLength: 3 + SupportedStyles: + - skip_modifier_ifs + - always + +Style/NonNilCheck: + # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for + # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is + # **usually** OK, but might change behavior. + # + # With `IncludeSemanticChanges` set to `false`, this cop does not report + # offenses for `!x.nil?` and does no changes that might change behavior. + IncludeSemanticChanges: false + +Style/NumericPredicate: + EnforcedStyle: predicate + SupportedStyles: + - predicate + - comparison + +Style/MethodDefParentheses: + EnforcedStyle: require_parentheses + SupportedStyles: + - require_parentheses + - require_no_parentheses + - require_no_parentheses_except_multiline + +Naming/MethodName: + EnforcedStyle: snake_case + SupportedStyles: + - snake_case + - camelCase + +Style/ModuleFunction: + EnforcedStyle: module_function + SupportedStyles: + - module_function + - extend_self + +Layout/MultilineArrayBraceLayout: + EnforcedStyle: symmetrical + SupportedStyles: + # symmetrical: closing brace is positioned in same way as opening brace + # new_line: closing brace is always on a new line + # same_line: closing brace is always on the same line as last element + - symmetrical + - new_line + - same_line + +Layout/MultilineAssignmentLayout: + # The types of assignments which are subject to this rule. + SupportedTypes: + - block + - case + - class + - if + - kwbegin + - module + EnforcedStyle: new_line + SupportedStyles: + # Ensures that the assignment operator and the rhs are on the same line for + # the set of supported types. + - same_line + # Ensures that the assignment operator and the rhs are on separate lines + # for the set of supported types. + - new_line + +Layout/MultilineHashBraceLayout: + EnforcedStyle: symmetrical + SupportedStyles: + # symmetrical: closing brace is positioned in same way as opening brace + # new_line: closing brace is always on a new line + # same_line: closing brace is always on same line as last element + - symmetrical + - new_line + - same_line + +Layout/MultilineMethodCallBraceLayout: + EnforcedStyle: symmetrical + SupportedStyles: + # symmetrical: closing brace is positioned in same way as opening brace + # new_line: closing brace is always on a new line + # same_line: closing brace is always on the same line as last argument + - symmetrical + - new_line + - same_line + +Layout/MultilineMethodCallIndentation: + EnforcedStyle: aligned + SupportedStyles: + - aligned + - indented + - indented_relative_to_receiver + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +Layout/MultilineMethodDefinitionBraceLayout: + EnforcedStyle: symmetrical + SupportedStyles: + # symmetrical: closing brace is positioned in same way as opening brace + # new_line: closing brace is always on a new line + # same_line: closing brace is always on the same line as last parameter + - symmetrical + - new_line + - same_line + +Layout/MultilineOperationIndentation: + EnforcedStyle: aligned + SupportedStyles: + - aligned + - indented + # By default, the indentation width from Style/IndentationWidth is used + # But it can be overridden by setting this parameter + IndentationWidth: ~ + +Style/NumericLiterals: + MinDigits: 5 + +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_with_o + SupportedOctalStyles: + - zero_with_o + - zero_only + +Style/OptionHash: + # A list of parameter names that will be flagged by this cop. + SuspiciousParamNames: + - options + - opts + - args + - params + - parameters + +# Allow safe assignment in conditions. +Style/ParenthesesAroundCondition: + AllowSafeAssignment: true + +Style/PercentLiteralDelimiters: + PreferredDelimiters: + "%": () + "%i": () + "%q": () + "%Q": () + "%r": "{}" + "%s": () + "%w": () + "%W": () + "%x": () + +Style/PercentQLiterals: + EnforcedStyle: lower_case_q + SupportedStyles: + - lower_case_q # Use %q when possible, %Q when necessary + - upper_case_q # Always use %Q + +Style/SlicingWithRange: + Enabled: false + +Naming/PredicateName: + # Predicate name prefixes. + NamePrefix: + - is_ + - has_ + - have_ + # Predicate name prefixes that should be removed. + ForbiddenPrefixes: + - is_ + - have_ + # Predicate names which, despite having a blacklisted prefix, or no ?, + # should still be accepted + AllowedMethods: + - is_a? + # Exclude Rspec specs because there is a strong convetion to write spec + # helpers in the form of `have_something` or `be_something`. + Exclude: + - "**/spec/**/*" + - "**/test/**/*" + +Style/PreferredHashMethods: + Enabled: true + EnforcedStyle: verbose + +Style/DateTime: + Enabled: true + +Style/Documentation: + Enabled: false + +Style/RaiseArgs: + EnforcedStyle: exploded + SupportedStyles: + - compact # raise Exception.new(msg) + - exploded # raise Exception, msg + +Style/RedundantReturn: + # When true allows code like `return x, y`. + AllowMultipleReturnValues: false + +# Use / or %r around regular expressions. +Style/RegexpLiteral: + EnforcedStyle: slashes + # slashes: Always use slashes. + # percent_r: Always use %r. + # mixed: Use slashes on single-line regexes, and %r on multi-line regexes. + SupportedStyles: + - slashes + - percent_r + - mixed + # If false, the cop will always recommend using %r if one or more slashes + # are found in the regexp string. + AllowInnerSlashes: false + +Style/SafeNavigation: + Enabled: false + +Style/Semicolon: + # Allow ; to separate several expressions on the same line. + AllowAsExpressionSeparator: false + +Style/SignalException: + EnforcedStyle: only_raise + SupportedStyles: + - only_raise + - only_fail + - semantic + +Style/SingleLineBlockParams: + Methods: + - reduce: + - a + - e + - inject: + - a + - e + +Style/SingleLineMethods: + AllowIfMethodIsEmpty: true + +Layout/SpaceBeforeFirstArg: + # When true, allows most uses of extra spacing if the intent is to align + # things with the previous or next line, not counting empty lines or comment + # lines. + AllowForAlignment: true + +Style/SpecialGlobalVars: + EnforcedStyle: use_english_names + SupportedStyles: + - use_perl_names + - use_english_names + +Style/StabbyLambdaParentheses: + EnforcedStyle: require_parentheses + SupportedStyles: + - require_parentheses + - require_no_parentheses + +Style/StringLiterals: + EnforcedStyle: double_quotes + SupportedStyles: + - single_quotes + - double_quotes + # If true, strings which span multiple lines using \ for continuation must + # use the same type of quotes on each line. + ConsistentQuotesInMultiline: false + +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + SupportedStyles: + - single_quotes + - double_quotes + +Style/StringMethods: + # Mapping from undesired method to desired_method + # e.g. to use `to_sym` over `intern`: + # + # StringMethods: + # PreferredMethods: + # intern: to_sym + PreferredMethods: + intern: to_sym + +Layout/SpaceAroundBlockParameters: + EnforcedStyleInsidePipes: no_space + +Layout/SpaceAroundEqualsInParameterDefault: + EnforcedStyle: space + SupportedStyles: + - space + - no_space + +Layout/SpaceAroundOperators: + # When true, allows most uses of extra spacing if the intent is to align + # with an operator on the previous or next line, not counting empty lines + # or comment lines. + AllowForAlignment: true + +Layout/SpaceBeforeBlockBraces: + EnforcedStyle: space + SupportedStyles: + - space + - no_space + +Layout/SpaceInsideBlockBraces: + EnforcedStyle: space + SupportedStyles: + - space + - no_space + # Valid values are: space, no_space + EnforcedStyleForEmptyBraces: no_space + # Space between { and |. Overrides EnforcedStyle if there is a conflict. + SpaceBeforeBlockParameters: true + +Layout/SpaceInsideHashLiteralBraces: + EnforcedStyle: space + EnforcedStyleForEmptyBraces: no_space + SupportedStyles: + - space + - no_space + # "compact" normally requires a space inside hash braces, with the exception + # that successive left braces or right braces are collapsed together + - compact + +Layout/SpaceInsideStringInterpolation: + EnforcedStyle: no_space + SupportedStyles: + - space + - no_space + +Style/AccessModifierDeclarations: + Enabled: false + +Style/SymbolArray: + EnforcedStyle: brackets + SupportedStyles: + - percent + - brackets + +Style/SymbolProc: + # A list of method names to be ignored by the check. + # The names should be fairly unique, otherwise you'll end up ignoring lots of code. + IgnoredMethods: + - respond_to + - define_method + +Style/TernaryParentheses: + EnforcedStyle: require_no_parentheses + SupportedStyles: + - require_parentheses + - require_no_parentheses + AllowSafeAssignment: true + +Layout/TrailingEmptyLines: + EnforcedStyle: final_newline + SupportedStyles: + - final_newline + - final_blank_line + +Style/TrailingCommaInArguments: + # If `comma`, the cop requires a comma after the last argument, but only for + # parenthesized method calls where each argument is on its own line. + # If `consistent_comma`, the cop requires a comma after the last argument, + # for all parenthesized method calls with arguments. + EnforcedStyleForMultiline: no_comma + +Style/TrailingCommaInArrayLiteral: + # If `comma`, the cop requires a comma after the last item in an array or + # hash, but only when each item is on its own line. + # If `consistent_comma`, the cop requires a comma after the last item of all + # non-empty array and hash literals. + EnforcedStyleForMultiline: no_comma + +Style/TrailingCommaInHashLiteral: + # If `comma`, the cop requires a comma after the last item in an array or + # hash, but only when each item is on its own line. + # If `consistent_comma`, the cop requires a comma after the last item of all + # non-empty array and hash literals. + EnforcedStyleForMultiline: no_comma + +# TrivialAccessors requires exact name matches and doesn't allow +# predicated methods by default. +Style/TrivialAccessors: + # When set to false the cop will suggest the use of accessor methods + # in situations like: + # + # def name + # @other_name + # end + # + # This way you can uncover "hidden" attributes in your code. + ExactNameMatch: true + AllowPredicates: true + # Allows trivial writers that don't end in an equal sign. e.g. + # + # def on_exception(action) + # @on_exception=action + # end + # on_exception :restart + # + # Commonly used in DSLs + AllowDSLWriters: false + IgnoreClassMethods: false + AllowedMethods: + - to_ary + - to_a + - to_c + - to_enum + - to_h + - to_hash + - to_i + - to_int + - to_io + - to_open + - to_path + - to_proc + - to_r + - to_regexp + - to_str + - to_s + - to_sym + +Naming/VariableName: + EnforcedStyle: snake_case + SupportedStyles: + - snake_case + - camelCase + +Naming/VariableNumber: + EnforcedStyle: normalcase + SupportedStyles: + - snake_case + - normalcase + - non_integer + Exclude: + - "**/*/dummy_authorization_handler.rb" + - "app/controllers/decidim/proposals/proposals_controller.rb" + - "spec/system/homepage_spec.rb" + +# WordArray enforces how array literals of word-like strings should be expressed. +Style/WordArray: + EnforcedStyle: percent + SupportedStyles: + # percent style: %w(word1 word2) + - percent + # bracket style: ["word1", "word2"] + - brackets + # The MinSize option causes the WordArray rule to be ignored for arrays + # smaller than a certain size. The rule is only applied to arrays + # whose element count is greater than or equal to MinSize. + MinSize: 2 + # The regular expression WordRegex decides what is considered a word. + WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/' + +##################### Metrics ################################## + +Metrics/AbcSize: + # The ABC size is a calculated magnitude, so this number can be an Integer or + # a Float. + Max: 15 + Enabled: false + +Metrics/BlockNesting: + Max: 3 + +Metrics/ClassLength: + CountComments: false # count full line comments? + Max: 100 + Enabled: false + +Metrics/ModuleLength: + CountComments: false # count full line comments? + Max: 100 + Enabled: false + +# Avoid complex methods. +Metrics/CyclomaticComplexity: + Max: 9 + Exclude: + - "bin/bundle" + - "**/*/dummy_authorization_handler.rb" + - "**/*/permissions.rb" + +Metrics/MethodLength: + CountComments: false # count full line comments? + Max: 15 + Enabled: false + +Metrics/ParameterLists: + Max: 5 + CountKeywordArgs: true + +Metrics/PerceivedComplexity: + Max: 10 + Exclude: + - "**/*/dummy_authorization_handler.rb" + - "**/*/permissions.rb" + +##################### Lint ################################## + +Lint/AmbiguousBlockAssociation: + Enabled: true + Exclude: + - "**/abilities/**/*" + +# Allow safe assignment in conditions. +Lint/AssignmentInCondition: + AllowSafeAssignment: true + +Lint/ConstantDefinitionInBlock: + Enabled: false + +# Call super to initialize state of the parent class. +Lint/MissingSuper: + Enabled: false + +# checks whether the end keywords are aligned properly for `do` `end` blocks. +Layout/BlockAlignment: + # The value `start_of_block` means that the `end` should be aligned with line + # where the `do` keyword appears. + # The value `start_of_line` means it should be aligned with the whole + # expression's starting line. + # The value `either` means both are allowed. + EnforcedStyleAlignWith: either + +# Align ends correctly. +Layout/EndAlignment: + # The value `keyword` means that `end` should be aligned with the matching + # keyword (if, while, etc.). + # The value `variable` means that in assignments, `end` should be aligned + # with the start of the variable on the left hand side of `=`. In all other + # situations, `end` should still be aligned with the keyword. + # The value `start_of_line` means that `end` should be aligned with the start + # of the line which the matching keyword appears on. + EnforcedStyleAlignWith: keyword + AutoCorrect: false + +Layout/DefEndAlignment: + # The value `def` means that `end` should be aligned with the def keyword. + # The value `start_of_line` means that `end` should be aligned with method + # calls like `private`, `public`, etc, if present in front of the `def` + # keyword on the same line. + EnforcedStyleAlignWith: start_of_line + AutoCorrect: false + +Lint/InheritException: + # The default base class in favour of `Exception`. + EnforcedStyle: runtime_error + SupportedStyles: + - runtime_error + - standard_error + +Layout/LineLength: + Max: 180 + # To make it possible to copy or click on URIs in the code, we allow lines + # containing a URI to be longer than Max. + AllowHeredoc: true + AllowURI: true + URISchemes: + - http + - https + Exclude: + - "spec/**/*" + - "db/schema.rb" + +# Checks for unused block arguments +Lint/UnusedBlockArgument: + IgnoreEmptyBlocks: true + AllowUnusedKeywordArguments: false + +# Checks for unused method arguments. +Lint/UnusedMethodArgument: + AllowUnusedKeywordArguments: false + IgnoreEmptyMethods: true + +##################### Performance ############################ + +Metrics/BlockLength: + Enabled: false + +RSpec/BeforeAfterAll: + Enabled: true + +RSpec/ContextWording: + Enabled: true + Prefixes: + - when + - with + - without + - and + +RSpec/DescribeClass: + Exclude: + - spec/gemfiles_spec.rb + - spec/webpacker_spec.rb + - spec/i18n_spec.rb + - "**/*/spec/**/*_badge_spec.rb" + - "**/tasks/**/*" + +RSpec/ExampleLength: + Max: 49 + +RSpec/ExpectInHook: + Enabled: false + +RSpec/IteratedExpectation: + Enabled: true + +RSpec/LetSetup: + Enabled: false + +RSpec/MessageSpies: + Enabled: false + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/NestedGroups: + Max: 7 + +RSpec/NamedSubject: + Enabled: false + +RSpec/RepeatedExampleGroupDescription: + Enabled: false + +RSpec/RepeatedExampleGroupBody: + Enabled: false +RSpec/VerifiedDoubles: + Enabled: false + +RSpec/LeakyConstantDeclaration: + Enabled: false + +RSpec/DescribedClass: + Enabled: false + +# This is the default configuration file. + +Faker/DeprecatedArguments: + Description: 'Checks that Faker arguments style is based on Faker 2.' + Enabled: true + VersionAdded: '0.1' + Reference: 'https://github.com/faker-ruby/faker/blob/master/CHANGELOG.md#v20-2019-31-07' + ArgumentKeywords: + # + # FakerClassName: + # method_name: + # - keyword_name_for_first_argument + # - keyword_name_for_second_argument + # - keyword_name_for_third_argument + # + Faker::Dune: + quote: + - character + saying: + - source + Faker::Books::Lovecraft: + fhtagn: + - number + sentence: + - word_count + - random_words_to_add + words: + - number + - spaces_allowed + sentences: + - number + paragraph: + - sentence_count + - random_sentences_to_add + paragraphs: + - number + paragraph_by_chars: + - characters + Faker::Address: + city: + - options + street_address: + - include_secondary + zip_code: + - state_abbreviation + country_by_code: + - code + country_name_to_code: + - name + Faker::Alphanumeric: + alpha: + - number + alphanumeric: + - number + Faker::App: + semantic_version: + - major + - minor + - patch + Faker::Avatar: + image: + - slug + - size + - format + - set + - bgset + Faker::Bank: + account_number: + - digits + iban: + - country_code + Faker::Boolean: + boolean: + - true_ratio + Faker::ChileRut: + rut: + - min_rut + - fixed + full_rut: + - min_rut + - fixed + Faker::Code: + isbn: + - base + ean: + - base + nric: + - min_age + - max_age + Faker::Commerce: + promotion_code: + - digits + department: + - max + - fixed_amount + price: + - range + - as_string + Faker::Company: + polish_register_of_national_economy: + - length + brazilian_company_number: + - formatted + Faker::CryptoCoin: + coin_name: + - coin + acronym: + - coin + url_logo: + - coin + Faker::Date: + between: + - from + - to + between_except: + - from + - to + - excepted + forward: + - days + backward: + - days + birthday: + - min_age + - max_age + Faker::Demographic: + height: + - unit + Faker::DrivingLicence: + british_driving_licence: + - last_name + - initials + - gender + - date_of_birth + Faker::File: + dir: + - segment_count + - root + - directory_separator + file_name: + - dir + - name + - ext + - directory_separator + Faker::Fillmurray: + image: + - grayscale + - width + - height + Faker::Finance: + vat_number: + - country + Faker::Hipster: + words: + - number + - supplemental + - spaces_allowed + sentence: + - word_count + - supplemental + - random_words_to_add + sentences: + - number + - supplemental + paragraph: + - sentence_count + - supplemental + - random_sentences_to_add + paragraphs: + - number + - supplemental + paragraph_by_chars: + - characters + - supplemental + Faker::IDNumber: + brazilian_citizen_number: + - formatted + brazilian_id: + - formatted + Faker::Internet: + email: + - name + - separators + free_email: + - name + safe_email: + - name + username: + - specifier + - separators + password: + - min_length + - max_length + - mix_case + - special_characters + domain_name: + - subdomain + fix_umlauts: + - string + mac_address: + - prefix + url: + - host + - path + - scheme + slug: + - words + - glue + user_agent: + - vendor + Faker::Invoice: + amount_between: + - from + - to + creditor_reference: + - ref + reference: + - ref + Faker::Json: + shallow_json: + - width + - options + add_depth_to_json: + - json + - width + - options + Faker::Lorem: + words: + - number + - supplemental + characters: + - number + sentence: + - word_count + - supplemental + - random_words_to_add + sentences: + - number + - supplemental + paragraph: + - sentence_count + - supplemental + - random_sentences_to_add + paragraphs: + - number + - supplemental + paragraph_by_chars: + - number + - supplemental + question: + - word_count + - supplemental + - random_words_to_add + questions: + - number + - supplemental + Faker::LoremFlickr: + image: + - size + - search_terms + - match_all + grayscale_image: + - size + - search_terms + - match_all + pixelated_image: + - size + - search_terms + - match_all + colorized_image: + - size + - color + - search_terms + - match_all + Faker::LoremPixel: + image: + - size + - is_gray + - category + - number + - text + - secure + Faker::Markdown: + sandwich: + - sentences + - repeat + Faker::Measurement: + height: + - amount + length: + - amount + volume: + - amount + weight: + - amount + metric_height: + - amount + metric_length: + - amount + metric_volume: + - amount + metric_weight: + - amount + Faker::Name: + initials: + - number + Faker::NationalHealthService: + check_digit: + - number + Faker::Number: + number: + - digits + leading_zero_number: + - digits + decimal_part: + - digits + decimal: + - l_digits + - r_digits + hexadecimal: + - digits + normal: + - mean + - standard_deviation + between: + - from + - to + within: + - range + positive: + - from + - to + negative: + - from + - to + Faker::Omniauth: + google: + - name + - email + - uid + facebook: + - name + - email + - username + - uid + twitter: + - name + - nickname + - uid + linkedin: + - name + - email + - uid + github: + - name + - email + - uid + Faker::PhoneNumber: + subscriber_number: + - length + Faker::Placeholdit: + image: + - size + - format + - background_color + - text_color + - text + Faker::Relationship: + familial: + - connection + Faker::Source: + hello_world: + - lang + print: + - str + - lang + print_1_to_10: + - lang + Faker::String: + random: + - length + Faker::Stripe: + valid_card: + - card_type + valid_token: + - card_type + invalid_card: + - card_error + ccv: + - card_type + Faker::Time: + between: + - from + - to + - format + between_dates: + - from + - to + - period + - format + forward: + - days + - period + - format + backward: + - days + - period + - format + Faker::Twitter: + user: + - include_status + - include_email + status: + - include_user + - include_photo + status_entities: + - include_photo + Faker::Types: + rb_string: + - words + rb_integer: + - from + - to + rb_hash: + - number + - type + complex_rb_hash: + - number + rb_array: + - len + Faker::Vehicle: + model: + - make_of_model + mileage: + - min + - max + license_plate: + - state_abbreviation + Faker::WorldCup: + group: + - group + roster: + - country + - type + Faker::Dota: + quote: + - hero + Faker::Movies::StarWars: + quote: + - character + Decidim::Faker::Localized: + words: + - number + - supplemental + characters: + - number + sentence: + - word_count + - supplemental + - random_words_to_add + sentences: + - number + - supplemental + paragraph: + - sentence_count + - supplemental + - random_sentences_to_add + paragraphs: + - number + - supplemental + paragraph_by_chars: + - number + - supplemental + question: + - word_count + - supplemental + - random_words_to_add + questions: + - number + - supplemental diff --git a/.ruby-version b/.ruby-version index 338a5b5..860487c 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.6 +2.7.1 diff --git a/Gemfile b/Gemfile index 9a88597..b252f5d 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,7 @@ gem "decidim-socio_demographic_authorization_handler", path: "." gem "bootsnap", "~> 1.4" -gem "puma", "~> 4.3.7" +gem "puma", ">= 5.3.1" gem "uglifier", "~> 4.1" group :development, :test do @@ -27,9 +27,10 @@ group :development, :test do end group :development do - gem "faker", "~> 1.9" + gem "faker", "~> 2.14" gem "letter_opener_web", "~> 1.3" gem "listen", "~> 3.1" + gem "rubocop-faker" gem "spring", "~> 2.0" gem "spring-watcher-listen", "~> 2.0" gem "web-console", "~> 3.5" diff --git a/Gemfile.lock b/Gemfile.lock index 6288bbc..f97e8d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,78 +1,78 @@ GIT remote: https://github.com/decidim/decidim - revision: 81a3ea3531bcd7f3fb518451aa9a2139e7c37580 - branch: release/0.23-stable + revision: 44fb937b3aee7022ab135b383e1c138c57a2a90f + branch: release/0.24-stable specs: - decidim (0.23.6) - decidim-accountability (= 0.23.6) - decidim-admin (= 0.23.6) - decidim-api (= 0.23.6) - decidim-assemblies (= 0.23.6) - decidim-blogs (= 0.23.6) - decidim-budgets (= 0.23.6) - decidim-comments (= 0.23.6) - decidim-core (= 0.23.6) - decidim-debates (= 0.23.6) - decidim-forms (= 0.23.6) - decidim-generators (= 0.23.6) - decidim-meetings (= 0.23.6) - decidim-pages (= 0.23.6) - decidim-participatory_processes (= 0.23.6) - decidim-proposals (= 0.23.6) - decidim-sortitions (= 0.23.6) - decidim-surveys (= 0.23.6) - decidim-system (= 0.23.6) - decidim-verifications (= 0.23.6) - decidim-accountability (0.23.6) - decidim-comments (= 0.23.6) - decidim-core (= 0.23.6) + decidim (0.24.3) + decidim-accountability (= 0.24.3) + decidim-admin (= 0.24.3) + decidim-api (= 0.24.3) + decidim-assemblies (= 0.24.3) + decidim-blogs (= 0.24.3) + decidim-budgets (= 0.24.3) + decidim-comments (= 0.24.3) + decidim-core (= 0.24.3) + decidim-debates (= 0.24.3) + decidim-forms (= 0.24.3) + decidim-generators (= 0.24.3) + decidim-meetings (= 0.24.3) + decidim-pages (= 0.24.3) + decidim-participatory_processes (= 0.24.3) + decidim-proposals (= 0.24.3) + decidim-sortitions (= 0.24.3) + decidim-surveys (= 0.24.3) + decidim-system (= 0.24.3) + decidim-templates (= 0.24.3) + decidim-verifications (= 0.24.3) + decidim-accountability (0.24.3) + decidim-comments (= 0.24.3) + decidim-core (= 0.24.3) kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-admin (0.23.6) + decidim-admin (0.24.3) active_link_to (~> 1.0) - decidim-core (= 0.23.6) + decidim-core (= 0.24.3) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 1.7) - jquery-rails (~> 4.3) - sassc (~> 2.3.0) + jquery-rails (~> 4.4) + sassc (~> 2.4.0) sassc-rails (~> 2.1.2) - decidim-api (0.23.6) + decidim-api (0.24.3) graphiql-rails (~> 1.4, < 1.5) - graphql (~> 1.9) + graphql (~> 1.12, >= 1.12.3) rack-cors (~> 1.0) - redcarpet (~> 3.4) + redcarpet (~> 3.5, >= 3.5.1) sprockets-es6 (~> 0.9.2) - decidim-assemblies (0.23.6) - decidim-core (= 0.23.6) - decidim-blogs (0.23.6) - decidim-admin (= 0.23.6) - decidim-comments (= 0.23.6) - decidim-core (= 0.23.6) - httparty (~> 0.17) + decidim-assemblies (0.24.3) + decidim-core (= 0.24.3) + decidim-blogs (0.24.3) + decidim-admin (= 0.24.3) + decidim-comments (= 0.24.3) + decidim-core (= 0.24.3) jquery-tmpl-rails (~> 1.1) kaminari (~> 1.2, >= 1.2.1) - decidim-budgets (0.23.6) - decidim-comments (= 0.23.6) - decidim-core (= 0.23.6) + decidim-budgets (0.24.3) + decidim-comments (= 0.24.3) + decidim-core (= 0.24.3) kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-comments (0.23.6) - decidim-core (= 0.23.6) - jquery-rails (~> 4.3) - redcarpet (~> 3.4) - decidim-core (0.23.6) + decidim-comments (0.24.3) + decidim-core (= 0.24.3) + jquery-rails (~> 4.4) + redcarpet (~> 3.5, >= 3.5.1) + decidim-core (0.24.3) active_link_to (~> 1.0) - anchored (>= 1.1.0) + anchored (~> 1.1) autoprefixer-rails (~> 8.0) batch-loader (~> 1.2) browser (~> 2.7) - carrierwave (~> 1.3) + carrierwave (~> 2.2.1) cells-erb (~> 0.1.0) cells-rails (~> 0.0.9) charlock_holmes (~> 0.7) date_validator (~> 0.9.0) - decidim-api (= 0.23.6) + decidim-api (= 0.24.3) devise (~> 4.7) devise-i18n (~> 1.2) diffy (~> 3.3) @@ -80,12 +80,13 @@ GIT doorkeeper-i18n (~> 4.0) etherpad-lite (~> 0.3) file_validators (~> 2.1) + fog-local (~> 0.6) foundation-rails (~> 6.6, < 6.7) foundation_rails_helper (~> 3.0) - geocoder (>= 1.5) + geocoder (~> 1.5) hashdiff (>= 0.4.0, < 2.0.0) invisible_captcha (~> 0.12) - jquery-rails (~> 4.3) + jquery-rails (~> 4.4) kaminari (~> 1.2, >= 1.2.1) loofah (~> 2.3.1) mini_magick (~> 4.9) @@ -100,7 +101,7 @@ GIT pg (~> 1.1.4, < 2) pg_search (~> 2.2) premailer-rails (~> 1.10) - rack (>= 2.2.3) + rack (~> 2.2, >= 2.2.3) rack-attack (~> 6.0) rails (~> 5.2.6) rails-i18n (~> 5.0) @@ -108,7 +109,7 @@ GIT redis (~> 4.1) request_store (~> 1.5.0) rubyzip (~> 2.0) - sassc (~> 2.3.0) + sassc (~> 2.4.0) sassc-rails (~> 2.1.2) seven_zip_ruby (~> 1.3) social-share-button (~> 1.2, >= 1.2.1) @@ -119,92 +120,97 @@ GIT uglifier (~> 4.1) valid_email2 (~> 2.1) wisper (~> 2.0) - decidim-debates (0.23.6) - decidim-comments (= 0.23.6) - decidim-core (= 0.23.6) + decidim-debates (0.24.3) + decidim-comments (= 0.24.3) + decidim-core (= 0.24.3) kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-dev (0.23.6) + decidim-dev (0.24.3) byebug (~> 11.0) capybara (~> 3.24) db-query-matchers (~> 0.9.0) - decidim (= 0.23.6) + decidim (= 0.24.3) erb_lint (~> 0.0.28) factory_bot_rails (~> 4.8) i18n-tasks (~> 0.9.18) mdl (~> 0.5) - nokogiri (>= 1.10.8) - puma (>= 4.3) + nokogiri (~> 1.11, >= 1.11.4) + puffing-billy (~> 2.4.0) + puma (~> 5.0) rails-controller-testing (~> 1.0) rspec-cells (~> 0.3.4) rspec-html-matchers (~> 0.9.1) rspec-rails (~> 3.7) rspec-retry (~> 0.6.2) rspec_junit_formatter (~> 0.3.0) - rubocop (~> 0.71.0) + rubocop (~> 0.92.0) rubocop-rails (~> 2.0) rubocop-rspec (~> 1.21) selenium-webdriver (~> 3.142) simplecov (~> 0.19.0) simplecov-cobertura (~> 1.3.1) system_test_html_screenshots (~> 0.1.1) + vcr (~> 6.0) webmock (~> 3.6) wisper-rspec (~> 1.0) - decidim-forms (0.23.6) - decidim-core (= 0.23.6) + decidim-forms (0.24.3) + decidim-core (= 0.24.3) wicked_pdf (~> 1.4) wkhtmltopdf-binary (~> 0.12) - decidim-generators (0.23.6) - decidim-core (= 0.23.6) - decidim-meetings (0.23.6) + decidim-generators (0.24.3) + decidim-core (= 0.24.3) + decidim-meetings (0.24.3) cells-erb (~> 0.1.0) cells-rails (~> 0.0.9) - decidim-core (= 0.23.6) - decidim-forms (= 0.23.6) - httparty (~> 0.17) + decidim-core (= 0.24.3) + decidim-forms (= 0.24.3) icalendar (~> 2.5) jquery-tmpl-rails (~> 1.1) kaminari (~> 1.2, >= 1.2.1) searchlight (~> 4.1) - decidim-pages (0.23.6) - decidim-core (= 0.23.6) - decidim-participatory_processes (0.23.6) - decidim-core (= 0.23.6) - decidim-proposals (0.23.6) + decidim-pages (0.24.3) + decidim-core (= 0.24.3) + decidim-participatory_processes (0.24.3) + decidim-core (= 0.24.3) + decidim-proposals (0.24.3) acts_as_list (~> 0.9) cells-erb (~> 0.1.0) cells-rails (~> 0.0.9) - decidim-comments (= 0.23.6) - decidim-core (= 0.23.6) - doc2text (~> 0.4.2) + decidim-comments (= 0.24.3) + decidim-core (= 0.24.3) + doc2text (~> 0.4.3) kaminari (~> 1.2, >= 1.2.1) ransack (~> 2.1.1) - redcarpet (~> 3.4) - decidim-sortitions (0.23.6) - decidim-admin (= 0.23.6) - decidim-comments (= 0.23.6) - decidim-core (= 0.23.6) - decidim-proposals (= 0.23.6) - decidim-surveys (0.23.6) - decidim-core (= 0.23.6) - decidim-forms (= 0.23.6) - decidim-system (0.23.6) + redcarpet (~> 3.5, >= 3.5.1) + decidim-sortitions (0.24.3) + decidim-admin (= 0.24.3) + decidim-comments (= 0.24.3) + decidim-core (= 0.24.3) + decidim-proposals (= 0.24.3) + decidim-surveys (0.24.3) + decidim-core (= 0.24.3) + decidim-forms (= 0.24.3) + decidim-templates (= 0.24.3) + decidim-system (0.24.3) active_link_to (~> 1.0) - decidim-core (= 0.23.6) + decidim-core (= 0.24.3) devise (~> 4.7) devise-i18n (~> 1.2) devise_invitable (~> 1.7) - jquery-rails (~> 4.3) - sassc (~> 2.3.0) + jquery-rails (~> 4.4) + sassc (~> 2.4.0) sassc-rails (~> 2.1.2) - decidim-verifications (0.23.6) - decidim-core (= 0.23.6) + decidim-templates (0.24.3) + decidim-core (= 0.24.3) + decidim-forms (= 0.24.3) + decidim-verifications (0.24.3) + decidim-core (= 0.24.3) PATH remote: . specs: - decidim-socio_demographic_authorization_handler (0.23.6) - decidim-core (= 0.23.6) + decidim-socio_demographic_authorization_handler (0.24.3) + decidim-core (= 0.24.3) GEM remote: https://rubygems.org/ @@ -286,18 +292,22 @@ GEM browser (2.7.1) builder (3.2.4) byebug (11.1.3) - capybara (3.35.3) + capybara (3.36.0) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - carrierwave (1.3.2) - activemodel (>= 4.0.0) - activesupport (>= 4.0.0) - mime-types (>= 1.16) + carrierwave (2.2.2) + activemodel (>= 5.0.0) + activesupport (>= 5.0.0) + addressable (~> 2.6) + image_processing (~> 1.1) + marcel (~> 1.0.0) + mini_mime (>= 0.1.3) ssrf_filter (~> 1.0) cells (4.1.7) declarative-builder (< 0.2.0) @@ -311,7 +321,7 @@ GEM actionpack (>= 3.0) cells (>= 4.1.6, < 5.0.0) charlock_holmes (0.7.7) - chef-utils (17.4.25) + chef-utils (17.7.29) concurrent-ruby childprocess (3.0.0) coercible (1.0.0) @@ -323,7 +333,8 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) + cookiejar (0.3.3) crack (0.4.5) rexml crass (1.0.6) @@ -346,7 +357,7 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - devise-i18n (1.10.0) + devise-i18n (1.10.1) devise (>= 4.8.0) devise_invitable (1.7.5) actionmailer (>= 4.1.0) @@ -359,9 +370,19 @@ GEM docile (1.4.0) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - doorkeeper (5.5.2) + doorkeeper (5.5.4) railties (>= 5) doorkeeper-i18n (4.0.1) + em-http-request (1.1.7) + addressable (>= 2.3.4) + cookiejar (!= 0.3.1) + em-socksify (>= 0.3) + eventmachine (>= 1.0.3) + http_parser.rb (>= 0.6.0) + em-socksify (0.3.2) + eventmachine (>= 1.0.0.beta.4) + em-synchrony (1.0.6) + eventmachine (>= 1.0.0.beta.1) equalizer (0.0.11) erb_lint (0.0.37) activesupport @@ -376,15 +397,18 @@ GEM erubi (1.10.0) etherpad-lite (0.3.0) rest-client (>= 1.6) + eventmachine (1.2.7) + eventmachine_httpserver (0.2.1) + excon (0.88.0) execjs (2.8.1) factory_bot (4.11.1) activesupport (>= 3.0.0) factory_bot_rails (4.11.1) factory_bot (~> 4.11.1) railties (>= 3.0.0) - faker (1.9.6) - i18n (>= 0.7) - faraday (1.7.0) + faker (2.21.0) + i18n (>= 1.8.11, < 2) + faraday (1.8.0) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -407,6 +431,14 @@ GEM file_validators (2.3.0) activemodel (>= 3.2) mime-types (>= 1.0) + fog-core (2.2.4) + builder + excon (~> 0.71) + formatador (~> 0.2) + mime-types + fog-local (0.7.0) + fog-core (>= 1.27, < 3.0) + formatador (0.3.0) foundation-rails (6.6.2.0) railties (>= 3.1.0) sass (>= 3.3.0) @@ -417,27 +449,25 @@ GEM activesupport (>= 4.1, < 6.0) railties (>= 4.1, < 6.0) tzinfo (~> 1.2, >= 1.2.2) - geocoder (1.6.7) + geocoder (1.7.0) globalid (0.5.2) activesupport (>= 5.0) graphiql-rails (1.4.11) railties sprockets-rails - graphql (1.12.15) + graphql (1.13.0) hashdiff (1.0.1) - hashie (4.1.0) + hashie (5.0.0) highline (2.0.3) html_tokenizer (0.0.7) htmlentities (4.3.4) http-accept (1.7.0) http-cookie (1.0.4) domain_name (~> 0.5) - httparty (0.18.1) - mime-types (~> 3.0) - multi_xml (>= 0.5.2) - i18n (1.8.10) + http_parser.rb (0.6.0) + i18n (1.10.0) concurrent-ruby (~> 1.0) - i18n-tasks (0.9.34) + i18n-tasks (0.9.35) activesupport (>= 4.0.2) ast (>= 2.1.0) erubi @@ -449,18 +479,20 @@ GEM terminal-table (>= 1.5.1) icalendar (2.7.1) ice_cube (~> 0.16) - ice_cube (0.16.3) + ice_cube (0.16.4) ice_nine (0.11.2) + image_processing (1.12.1) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) invisible_captcha (0.13.0) rails (>= 3.2.0) - jaro_winkler (1.5.4) jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-tmpl-rails (1.1.0) rails (>= 3.1.0) - jwt (2.2.3) + jwt (2.3.0) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -493,7 +525,8 @@ GEM nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (1.0.1) + marcel (1.0.2) + matrix (0.4.2) mdl (0.11.0) kramdown (~> 2.3) kramdown-parser-gfm (~> 1.1) @@ -501,11 +534,12 @@ GEM mixlib-config (>= 2.2.1, < 4) mixlib-shellout method_source (1.0.0) - mime-types (3.3.1) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2021.0704) + mime-types-data (3.2021.1115) mini_magick (4.11.0) mini_mime (1.1.1) + mini_portile2 (2.5.3) minitest (5.14.4) mixlib-cli (2.1.8) mixlib-config (3.0.9) @@ -520,11 +554,12 @@ GEM netrc (0.11.0) nio4r (2.5.8) nobspw (0.6.2) - nokogiri (1.11.7-x86_64-darwin) + nokogiri (1.11.7) + mini_portile2 (~> 2.5.0) racc (~> 1.4) - nokogiri (1.11.7-x86_64-linux) + nokogiri (1.11.7-x86_64-darwin) racc (~> 1.4) - oauth (0.5.6) + oauth (0.5.8) oauth2 (1.4.7) faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) @@ -544,7 +579,7 @@ GEM omniauth-oauth (1.2.0) oauth omniauth (>= 1.0, < 3) - omniauth-oauth2 (1.7.1) + omniauth-oauth2 (1.7.2) oauth2 (~> 1.4) omniauth (>= 1.9, < 3) omniauth-rails_csrf_protection (0.1.2) @@ -557,8 +592,8 @@ GEM paper_trail (10.3.1) activerecord (>= 4.2) request_store (~> 1.1) - parallel (1.20.1) - parser (3.0.2.0) + parallel (1.21.0) + parser (3.0.3.1) ast (~> 2.4.1) pg (1.1.4) pg_search (2.3.5) @@ -572,7 +607,15 @@ GEM actionmailer (>= 3) premailer (~> 1.7, >= 1.7.9) public_suffix (4.0.6) - puma (4.3.8) + puffing-billy (2.4.1) + addressable (~> 2.5) + em-http-request (~> 1.1, >= 1.1.0) + em-synchrony + eventmachine (~> 1.2) + eventmachine_httpserver + http_parser.rb (~> 0.6.0) + multi_json + puma (5.5.2) nio4r (~> 2.0) racc (1.5.2) rack (2.2.3) @@ -630,7 +673,7 @@ GEM virtus (~> 1.0.5) wisper (>= 1.6.1) redcarpet (3.5.1) - redis (4.4.0) + redis (4.5.1) regexp_parser (2.1.1) request_store (1.5.0) rack (>= 1.4) @@ -647,7 +690,7 @@ GEM rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) - rspec-cells (0.3.6) + rspec-cells (0.3.7) cells (>= 4.0.0, < 6.0.0) rspec-rails (< 6.0) rspec-core (3.9.3) @@ -674,20 +717,31 @@ GEM rspec-support (3.9.4) rspec_junit_formatter (0.3.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.71.0) - jaro_winkler (~> 1.5.1) + rubocop (0.92.0) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.7) + rexml + rubocop-ast (>= 0.5.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - rubocop-rails (2.0.1) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-ast (1.13.0) + parser (>= 3.0.1.1) + rubocop-faker (1.1.0) + faker (>= 2.12.0) + rubocop (>= 0.82.0) + rubocop-rails (2.9.1) + activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.70.0) - rubocop-rspec (1.41.0) - rubocop (>= 0.68.1) + rubocop (>= 0.90.0, < 2.0) + rubocop-rspec (1.44.1) + rubocop (~> 0.87) + rubocop-ast (>= 0.7.1) ruby-ole (1.2.12.2) ruby-progressbar (1.11.0) + ruby-vips (2.1.4) + ffi (~> 1.12) ruby2_keywords (0.0.5) rubyzip (2.3.2) sass (3.7.4) @@ -695,7 +749,7 @@ GEM sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sassc (2.3.0) + sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -714,10 +768,10 @@ GEM simplecov-cobertura (1.3.1) simplecov (~> 0.8) simplecov-html (0.12.3) - smart_properties (1.16.0) + smart_properties (1.16.3) social-share-button (1.2.4) coffee-rails - spreadsheet (1.2.9) + spreadsheet (1.3.0) ruby-ole spring (2.1.1) spring-watcher-listen (2.0.1) @@ -730,15 +784,15 @@ GEM babel-source (>= 5.8.11) babel-transpiler sprockets (>= 3.0.0) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.1) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) ssrf_filter (1.0.7) system_test_html_screenshots (0.1.2) actionpack (>= 5.2, < 6.0.a) temple (0.8.2) - terminal-table (3.0.1) + terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) thor (1.1.0) thread_safe (0.3.6) @@ -754,11 +808,12 @@ GEM execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.7) - unicode-display_width (1.6.1) + unf_ext (0.0.8) + unicode-display_width (1.8.0) valid_email2 (2.3.1) activemodel (>= 3.2) mail (~> 2.5) + vcr (6.0.0) virtus (1.0.5) axiom-types (~> 0.1) coercible (~> 1.0) @@ -787,8 +842,8 @@ GEM nokogiri (~> 1.8) PLATFORMS + ruby x86_64-darwin-19 - x86_64-linux DEPENDENCIES bootsnap (~> 1.4) @@ -796,10 +851,11 @@ DEPENDENCIES decidim! decidim-dev! decidim-socio_demographic_authorization_handler! - faker (~> 1.9) + faker (~> 2.14) letter_opener_web (~> 1.3) listen (~> 3.1) - puma (~> 4.3.7) + puma (>= 5.3.1) + rubocop-faker simplecov (~> 0.19.0) spring (~> 2.0) spring-watcher-listen (~> 2.0) @@ -807,7 +863,7 @@ DEPENDENCIES web-console (~> 3.5) RUBY VERSION - ruby 2.6.6p146 + ruby 2.7.1p83 BUNDLED WITH - 2.2.18 + 2.3.12 diff --git a/config/locales/fr.yml b/config/locales/fr.yml index c3cfa66..4e8c86f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -10,6 +10,10 @@ fr: scope_id: Périmètre name: Données personnelles verifications: + authorizations: + first_login: + actions: + socio_demographic_authorization_handler: Vérifier avec Données personnelles age_slice: blank_option: Veuillez renseigner une tranche d'âge authorizations: diff --git a/decidim-socio_demographic_authorization_handler.gemspec b/decidim-socio_demographic_authorization_handler.gemspec index d4e12b6..5651bfb 100644 --- a/decidim-socio_demographic_authorization_handler.gemspec +++ b/decidim-socio_demographic_authorization_handler.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.email = ["fardeauarmand@gmail.com"] s.license = "AGPL-3.0" s.homepage = "https://github.com/decidim/decidim-module-socio_demographic_authorization_handler" - s.required_ruby_version = ">= 2.6" + s.required_ruby_version = ">= 2.7" s.name = "decidim-socio_demographic_authorization_handler" s.summary = "A decidim socio_demographic_authorization_handler module" diff --git a/lib/decidim/extends/controllers/confirmations_controller_extend.rb b/lib/decidim/extends/controllers/confirmations_controller_extend.rb index d8f08ff..341f59c 100644 --- a/lib/decidim/extends/controllers/confirmations_controller_extend.rb +++ b/lib/decidim/extends/controllers/confirmations_controller_extend.rb @@ -22,4 +22,4 @@ def first_login_and_not_authorized?(user) end end end -Devise::ConfirmationsController.send(:include, ConfirmationsControllerExtend) +Devise::ConfirmationsController.include ConfirmationsControllerExtend diff --git a/lib/decidim/socio_demographic_authorization_handler/version.rb b/lib/decidim/socio_demographic_authorization_handler/version.rb index e436a85..1fc2a34 100644 --- a/lib/decidim/socio_demographic_authorization_handler/version.rb +++ b/lib/decidim/socio_demographic_authorization_handler/version.rb @@ -4,11 +4,11 @@ module Decidim # This holds the decidim-meetings version. module SocioDemographicAuthorizationHandler def self.version - "0.23.6" + "0.24.3" end def self.decidim_version - "release/0.23-stable" + "release/0.24-stable" end end end diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb index 4a05e6d..61b98ee 100644 --- a/spec/i18n_spec.rb +++ b/spec/i18n_spec.rb @@ -7,7 +7,7 @@ ENV["ENFORCED_LOCALES"].presence || "en" end - let(:i18n) { I18n::Tasks::BaseTask.new(locales: locales.split(",")) } + let(:i18n) { I18n::Tasks::BaseTask.new({ locales: locales.split(",") }, config_file: nil) } let(:missing_keys) { i18n.missing_keys } let(:unused_keys) { i18n.unused_keys } let(:non_normalized_paths) { i18n.non_normalized_paths } diff --git a/spec/system/authorizations_spec.rb b/spec/system/authorizations_spec.rb index 26a8dd4..c9e0657 100644 --- a/spec/system/authorizations_spec.rb +++ b/spec/system/authorizations_spec.rb @@ -221,7 +221,7 @@ within ".authorizations-list" do expect(page).to have_no_link("Example authorization") - expect(page).to have_content(I18n.localize(authorization.granted_at, format: :long)) + expect(page).to have_content(I18n.l(authorization.granted_at, format: :long)) end end end