diff --git a/.pryrc b/.pryrc index 7d73617e97..a42fc96cc8 100644 --- a/.pryrc +++ b/.pryrc @@ -1,6 +1,7 @@ -if defined?(PryNav) +if defined?(PryDebugger) Pry.commands.alias_command 'c', 'continue' Pry.commands.alias_command 's', 'step' Pry.commands.alias_command 'n', 'next' + Pry.commands.alias_command 'f', 'finish' end diff --git a/.ruby-style.yml b/.ruby-style.yml index 6113736b65..f60a0cbbff 100644 --- a/.ruby-style.yml +++ b/.ruby-style.yml @@ -22,1049 +22,1463 @@ AllCops: DisplayCopNames: false StyleGuideCopsOnly: false DisabledByDefault: true + Style/AccessModifierIndentation: Description: Check indentation of private/protected visibility modifiers. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected - Enabled: false - EnforcedStyle: indent - SupportedStyles: - - outdent - - indent -Style/AlignHash: - Description: Align the elements of a hash literal if they span more than one line. - Enabled: false - EnforcedHashRocketStyle: key - EnforcedColonStyle: key - EnforcedLastArgumentHashStyle: always_inspect - SupportedLastArgumentHashStyles: - - always_inspect - - always_ignore - - ignore_implicit - - ignore_explicit -Style/AlignParameters: - Description: Align the parameters of a method call if they span more than one line. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-double-indent - Enabled: false - EnforcedStyle: with_first_parameter - SupportedStyles: - - with_first_parameter - - with_fixed_indentation -Style/AndOr: - Description: Use &&/|| instead of and/or. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or - Enabled: false - EnforcedStyle: always - SupportedStyles: - - always - - conditionals -Style/BarePercentLiterals: - Description: Checks if usage of %() or %Q() matches configuration. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand - Enabled: false - EnforcedStyle: bare_percent - SupportedStyles: - - percent_q - - bare_percent -Style/BracesAroundHashParameters: - Description: Enforce braces style around hash parameters. - Enabled: false - EnforcedStyle: no_braces - SupportedStyles: - - braces - - no_braces - - context_dependent -Style/CaseIndentation: - Description: Indentation of when in a case/when/[else/]end. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#indent-when-to-case - Enabled: false - IndentWhenRelativeTo: case - SupportedStyles: - - case - - end - IndentOneStep: false -Style/ClassAndModuleChildren: - Description: Checks style of children classes and modules. - Enabled: false - EnforcedStyle: nested - SupportedStyles: - - nested - - compact -Style/ClassCheck: - Description: Enforces consistent use of `Object#is_a?` or `Object#kind_of?`. - Enabled: false - EnforcedStyle: is_a? - SupportedStyles: - - is_a? - - kind_of? -Style/CollectionMethods: - Description: Preferred collection methods. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size - Enabled: false - PreferredMethods: - collect: map - collect!: map! - find: detect - find_all: select - reduce: inject -Style/CommentAnnotation: - Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK, - REVIEW). - StyleGuide: https://github.com/bbatsov/ruby-style-guide#annotate-keywords - Enabled: false - Keywords: - - TODO - - FIXME - - OPTIMIZE - - HACK - - REVIEW -Style/DotPosition: - Description: Checks the position of the dot in multi-line method calls. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains - Enabled: false - EnforcedStyle: trailing - SupportedStyles: - - leading - - trailing -Style/EmptyLineBetweenDefs: - Description: Use empty lines between defs. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods - Enabled: false - AllowAdjacentOneLineDefs: false -Style/EmptyLinesAroundBlockBody: - Description: Keeps track of empty lines around block bodies. - Enabled: false - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines -Style/EmptyLinesAroundClassBody: - Description: Keeps track of empty lines around class bodies. - Enabled: false - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines -Style/EmptyLinesAroundModuleBody: - Description: Keeps track of empty lines around module bodies. - Enabled: false - EnforcedStyle: no_empty_lines - SupportedStyles: - - empty_lines - - no_empty_lines -Style/Encoding: - Description: Use UTF-8 as the source file encoding. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#utf-8 - Enabled: true - EnforcedStyle: always - SupportedStyles: - - when_needed - - always -Style/FileName: - Description: Use snake_case for source file names. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files - Enabled: true - Exclude: [] -Style/FirstParameterIndentation: - Description: Checks the indentation of the first parameter in a method call. - Enabled: false - EnforcedStyle: special_for_inner_method_call_in_parentheses - SupportedStyles: - - consistent - - special_for_inner_method_call - - special_for_inner_method_call_in_parentheses -Style/For: - Description: Checks use of for or each in multiline loops. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-for-loops - Enabled: false - EnforcedStyle: each - SupportedStyles: - - for - - each -Style/FormatString: - Description: Enforce the use of Kernel#sprintf, Kernel#format or String#%. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#sprintf - Enabled: false - EnforcedStyle: format - SupportedStyles: - - format - - sprintf - - percent -Style/GlobalVars: - Description: Do not introduce global variables. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars - Enabled: false - AllowedVariables: [] -Style/GuardClause: - Description: Check for conditionals that can be replaced with guard clauses - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals - Enabled: false - MinBodyLength: 1 -Style/HashSyntax: - Description: 'Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a => - 1, :b => 2 }.' - StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-literals - Enabled: false - EnforcedStyle: ruby19 - SupportedStyles: - - ruby19 - - hash_rockets -Style/IfUnlessModifier: - Description: Favor modifier if/unless usage when you have a single-line body. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier - Enabled: false - MaxLineLength: 80 -Style/IndentationWidth: - Description: Use 2 spaces for indentation. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-indentation - Enabled: false - Width: 2 -Style/IndentHash: - Description: Checks the indentation of the first key in a hash literal. - Enabled: false - EnforcedStyle: special_inside_parentheses - SupportedStyles: - - special_inside_parentheses - - consistent -Style/LambdaCall: - Description: Use lambda.call(...) instead of lambda.(...). - StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call - Enabled: false - EnforcedStyle: call - SupportedStyles: - - call - - braces -Style/Next: - Description: Use `next` to skip iteration instead of a condition at the end. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals - Enabled: false - EnforcedStyle: skip_modifier_ifs - MinBodyLength: 3 - SupportedStyles: - - skip_modifier_ifs - - always -Style/NonNilCheck: - Description: Checks for redundant nil checks. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks - Enabled: false - IncludeSemanticChanges: false -Style/MethodDefParentheses: - Description: Checks if the method definitions have or don't have parentheses. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#method-parens - Enabled: false - EnforcedStyle: require_parentheses - SupportedStyles: - - require_parentheses - - require_no_parentheses -Style/MethodName: - Description: Use the configured style when naming methods. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars - Enabled: false - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase -Style/MultilineOperationIndentation: - Description: Checks indentation of binary operations that span more than one line. - Enabled: false - EnforcedStyle: aligned - SupportedStyles: - - aligned - - indented -Style/NumericLiterals: - Description: Add underscores to large numeric literals to improve their readability. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics - Enabled: false - MinDigits: 5 -Style/ParenthesesAroundCondition: - Description: Don't use parentheses around the condition of an if/unless/while. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-parens-if - Enabled: false - AllowSafeAssignment: true -Style/PercentLiteralDelimiters: - Description: Use `%`-literal delimiters consistently - StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces - Enabled: false - PreferredDelimiters: - "%": "()" - "%i": "()" - "%q": "()" - "%Q": "()" - "%r": "{}" - "%s": "()" - "%w": "()" - "%W": "()" - "%x": "()" -Style/PercentQLiterals: - Description: Checks if uses of %Q/%q match the configured preference. - Enabled: false - EnforcedStyle: lower_case_q - SupportedStyles: - - lower_case_q - - upper_case_q -Style/PredicateName: - Description: Check the names of predicate methods. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark - Enabled: false - NamePrefix: - - is_ - - has_ - - have_ - NamePrefixBlacklist: - - is_ - Exclude: - - spec/**/* -Style/RaiseArgs: - Description: Checks the arguments passed to raise/fail. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages - Enabled: false - EnforcedStyle: exploded - SupportedStyles: - - compact - - exploded -Style/RedundantReturn: - Description: Don't use return where it's not required. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-explicit-return - Enabled: false - AllowMultipleReturnValues: false -Style/RegexpLiteral: - Description: Use %r for regular expressions matching more than `MaxSlashes` '/' - characters. Use %r only for regular expressions matching more than `MaxSlashes` - '/' character. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-r - Enabled: false - MaxSlashes: 1 -Style/Semicolon: - Description: Don't use semicolons to terminate expressions. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon - Enabled: false - AllowAsExpressionSeparator: false -Style/SignalException: - Description: Checks for proper usage of fail and raise. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method - Enabled: false - EnforcedStyle: semantic - SupportedStyles: - - only_raise - - only_fail - - semantic -Style/SingleLineBlockParams: - Description: Enforces the names of some block params. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks - Enabled: false - Methods: - - reduce: - - a - - e - - inject: - - a - - e -Style/SingleLineMethods: - Description: Avoid single-line methods. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods - Enabled: false - AllowIfMethodIsEmpty: true -Style/StringLiterals: - Description: Checks if uses of quotes match the configured preference. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals - Enabled: false - EnforcedStyle: double_quotes - SupportedStyles: - - single_quotes - - double_quotes -Style/StringLiteralsInInterpolation: - Description: Checks if uses of quotes inside expressions in interpolated strings - match the configured preference. - Enabled: false - EnforcedStyle: single_quotes - SupportedStyles: - - single_quotes - - double_quotes -Style/SpaceAroundBlockParameters: - Description: Checks the spacing inside and after block parameters pipes. - Enabled: false - EnforcedStyleInsidePipes: no_space - SupportedStyles: - - space - - no_space -Style/SpaceAroundEqualsInParameterDefault: - Description: Checks that the equals signs in parameter default assignments have - or don't have surrounding space depending on configuration. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-around-equals - Enabled: false - EnforcedStyle: space - SupportedStyles: - - space - - no_space -Style/SpaceBeforeBlockBraces: - Description: Checks that the left block brace has or doesn't have space before it. - Enabled: false - EnforcedStyle: space - SupportedStyles: - - space - - no_space -Style/SpaceInsideBlockBraces: - Description: Checks that block braces have or don't have surrounding space. For - blocks taking parameters, checks that the left brace has or doesn't have trailing - space. - Enabled: false - EnforcedStyle: space - SupportedStyles: - - space - - no_space - EnforcedStyleForEmptyBraces: no_space - SpaceBeforeBlockParameters: true -Style/SpaceInsideHashLiteralBraces: - Description: Use spaces inside hash literal braces - or don't. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators - Enabled: false - EnforcedStyle: space - EnforcedStyleForEmptyBraces: no_space - SupportedStyles: - - space - - no_space -Style/SymbolProc: - Description: Use symbols as procs instead of blocks when possible. - Enabled: false - IgnoredMethods: - - respond_to -Style/TrailingBlankLines: - Description: Checks trailing blank lines and final newline. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#newline-eof - Enabled: true - EnforcedStyle: final_newline - SupportedStyles: - - final_newline - - final_blank_line -Style/TrailingComma: - Description: Checks for trailing comma in parameter lists and literals. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas - Enabled: false - EnforcedStyleForMultiline: no_comma - SupportedStyles: - - comma - - no_comma -Style/TrivialAccessors: - Description: Prefer attr_* methods to trivial readers/writers. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr_family - Enabled: false - ExactNameMatch: false - AllowPredicates: false - AllowDSLWriters: 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 -Style/VariableName: - Description: Use the configured style when naming variables. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars - Enabled: false - EnforcedStyle: snake_case - SupportedStyles: - - snake_case - - camelCase -Style/WhileUntilModifier: - Description: Favor modifier while/until usage when you have a single-line body. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier - Enabled: false - MaxLineLength: 80 -Style/WordArray: - Description: Use %w or %W for arrays of words. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-w - Enabled: false - MinSize: 0 - WordRegex: !ruby/regexp /\A[\p{Word}]+\z/ -Metrics/AbcSize: - Description: A calculated magnitude based on number of assignments, branches, and - conditions. - Enabled: false - Max: 15 -Metrics/BlockNesting: - Description: Avoid excessive block nesting - StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count - Enabled: false - Max: 3 -Metrics/ClassLength: - Description: Avoid classes longer than 100 lines of code. - Enabled: false - CountComments: false - Max: 100 -Metrics/CyclomaticComplexity: - Description: A complexity metric that is strongly correlated to the number of test - cases needed to validate a method. - Enabled: false - Max: 6 -Metrics/LineLength: - Description: Limit lines to 80 characters. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits - Enabled: false - Max: 80 - AllowURI: true - URISchemes: - - http - - https -Metrics/MethodLength: - Description: Avoid methods longer than 10 lines of code. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods - Enabled: false - CountComments: false - Max: 10 -Metrics/ParameterLists: - Description: Avoid parameter lists longer than three or four parameters. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params - Enabled: false - Max: 5 - CountKeywordArgs: true -Metrics/PerceivedComplexity: - Description: A complexity metric geared towards measuring complexity for a human - reader. - Enabled: false - Max: 7 -Lint/AssignmentInCondition: - Description: Don't use assignment in conditions. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition - Enabled: false - AllowSafeAssignment: true -Lint/EndAlignment: - Description: Align ends correctly. - Enabled: false - AlignWith: keyword - SupportedStyles: - - keyword - - variable -Lint/DefEndAlignment: - Description: Align ends corresponding to defs correctly. - Enabled: false - AlignWith: start_of_line - SupportedStyles: - - start_of_line - - def -Rails/ActionFilter: - Description: Enforces consistent use of action filter methods. - Enabled: false - EnforcedStyle: action - SupportedStyles: - - action - - filter - Include: - - app/controllers/**/*.rb -Rails/DefaultScope: - Description: Checks if the argument passed to default_scope is a block. - Enabled: false - Include: - - app/models/**/*.rb -Rails/HasAndBelongsToMany: - Description: Prefer has_many :through to has_and_belongs_to_many. - Enabled: false - Include: - - app/models/**/*.rb -Rails/Output: - Description: Checks for calls to puts, print, etc. - Enabled: false - Include: - - app/**/*.rb - - config/**/*.rb - - db/**/*.rb - - lib/**/*.rb -Rails/ReadWriteAttribute: - Description: Checks for read_attribute(:attr) and write_attribute(:attr, val). - Enabled: false - Include: - - app/models/**/*.rb -Rails/ScopeArgs: - Description: Checks the arguments of ActiveRecord scopes. - Enabled: false - Include: - - app/models/**/*.rb -Rails/Validation: - Description: Use validates :attribute, hash of validations. - Enabled: false - Include: - - app/models/**/*.rb -Style/InlineComment: - Description: Avoid inline comments. - Enabled: false -Style/MethodCalledOnDoEndBlock: - Description: Avoid chaining a method call on a do...end block. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks - Enabled: false -Style/SymbolArray: - Description: Use %i or %I for arrays of symbols. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-i - Enabled: false -Style/ExtraSpacing: - Description: Do not use unnecessary spacing. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected' Enabled: false + Style/AccessorMethodName: Description: Check the naming of accessor methods for get_/set_. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#accessor_mutator_method_names' Enabled: false + Style/Alias: - Description: Use alias_method instead of alias. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method + Description: 'Use alias instead of alias_method.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method' Enabled: false + Style/AlignArray: - Description: Align the elements of an array literal if they span more than one line. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays + Description: >- + Align the elements of an array literal if they span more than + one line. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays' Enabled: false -Style/ArrayJoin: - Description: Use Array#join instead of Array#*. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join + +Style/AlignHash: + Description: >- + Align the elements of a hash literal if they span more than + one line. Enabled: false + +Style/AlignParameters: + Description: >- + Align the parameters of a method call if they span more + than one line. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent' + Enabled: false + +Style/AndOr: + Description: 'Use &&/|| instead of and/or.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or' + Enabled: false + +Style/ArrayJoin: + Description: 'Use Array#join instead of Array#*.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join' + Enabled: true + Style/AsciiComments: - Description: Use only ascii symbols in comments. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-comments + Description: 'Use only ascii symbols in comments.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments' Enabled: false + Style/AsciiIdentifiers: - Description: Use only ascii symbols in identifiers. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-identifiers + Description: 'Use only ascii symbols in identifiers.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers' Enabled: false + Style/Attr: - Description: Checks for uses of Module#attr. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr + Description: 'Checks for uses of Module#attr.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr' Enabled: false + Style/BeginBlock: - Description: Avoid the use of BEGIN blocks. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks + Description: 'Avoid the use of BEGIN blocks.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks' Enabled: false + +Style/BarePercentLiterals: + Description: 'Checks if usage of %() or %Q() matches configuration.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand' + Enabled: false + Style/BlockComments: - Description: Do not use block comments. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments + Description: 'Do not use block comments.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments' Enabled: false + Style/BlockEndNewline: - Description: Put end statement of multiline block on its own line. + Description: 'Put end statement of multiline block on its own line.' + Enabled: false + +Style/BlockDelimiters: + Description: >- + Avoid using {...} for multi-line blocks (multiline chaining is + always ugly). + Prefer {...} over do...end for single-line blocks. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks' Enabled: false -Style/Blocks: - Description: Avoid using {...} for multi-line blocks (multiline chaining is always - ugly). Prefer {...} over do...end for single-line blocks. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks + +Style/BracesAroundHashParameters: + Description: 'Enforce braces style around hash parameters.' Enabled: false + Style/CaseEquality: - Description: Avoid explicit use of the case equality operator(===). - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-case-equality + Description: 'Avoid explicit use of the case equality operator(===).' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality' Enabled: false + +Style/CaseIndentation: + Description: 'Indentation of when in a case/when/[else/]end.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case' + Enabled: false + Style/CharacterLiteral: - Description: Checks for uses of character literals. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-character-literals + Description: 'Checks for uses of character literals.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals' Enabled: false + Style/ClassAndModuleCamelCase: - Description: Use CamelCase for classes and modules. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#camelcase-classes + Description: 'Use CamelCase for classes and modules.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes' + Enabled: true + +Style/ClassAndModuleChildren: + Description: 'Checks style of children classes and modules.' Enabled: false -Style/ClassMethods: - Description: Use self when defining module/class methods. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#def-self-singletons + +Style/ClassCheck: + Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.' Enabled: false + +Style/ClassMethods: + Description: 'Use self when defining module/class methods.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-class-methods' + Enabled: true + Style/ClassVars: - Description: Avoid the use of class variables. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-class-vars + Description: 'Avoid the use of class variables.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars' + Enabled: false + +Style/ClosingParenthesisIndentation: + Description: 'Checks the indentation of hanging closing parentheses.' Enabled: false + Style/ColonMethodCall: Description: 'Do not use :: for method call.' - StyleGuide: https://github.com/bbatsov/ruby-style-guide#double-colons + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons' + Enabled: false + +Style/CommandLiteral: + Description: 'Use `` or %x around command literals.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x' Enabled: false + +Style/CommentAnnotation: + Description: >- + Checks formatting of special comments + (TODO, FIXME, OPTIMIZE, HACK, REVIEW). + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords' + Enabled: false + Style/CommentIndentation: - Description: Indentation of comments. + Description: 'Indentation of comments.' Enabled: false -Style/ConstantName: - Description: Constants should use SCREAMING_SNAKE_CASE. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#screaming-snake-case + +Style/ConditionalAssignment: + Description: >- + Use the return value of `if` and `case` statements for + assignment to a variable and variable comparison instead + of assigning that variable inside of each branch. Enabled: false + +Style/ConstantName: + Description: 'Constants should use SCREAMING_SNAKE_CASE.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case' + Enabled: true + Style/DefWithParentheses: - Description: Use def with parentheses when there are arguments. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#method-parens + Description: 'Use def with parentheses when there are arguments.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens' Enabled: false -Style/DeprecatedHashMethods: - Description: Checks for use of deprecated Hash methods. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-key + +Style/PreferredHashMethods: + Description: 'Checks use of `has_key?` and `has_value?` Hash methods.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key' Enabled: false + Style/Documentation: - Description: Document classes and non-namespace modules. + Description: 'Document classes and non-namespace modules.' Enabled: false + Exclude: + - 'spec/**/*' + - 'test/**/*' + +Style/DotPosition: + Description: 'Checks the position of the dot in multi-line method calls.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains' + Enabled: false + Style/DoubleNegation: - Description: Checks for uses of double negation (!!). - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang + Description: 'Checks for uses of double negation (!!).' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang' Enabled: false + +Style/EachForSimpleLoop: + Description: >- + Use `Integer#times` for a simple loop which iterates a fixed + number of times. + Enabled: false + Style/EachWithObject: - Description: Prefer `each_with_object` over `inject` or `reduce`. + Description: 'Prefer `each_with_object` over `inject` or `reduce`.' Enabled: false + Style/ElseAlignment: - Description: Align elses and elsifs correctly. + Description: 'Align elses and elsifs correctly.' Enabled: false + Style/EmptyElse: - Description: Avoid empty else-clauses. + Description: 'Avoid empty else-clauses.' + Enabled: false + +Style/EmptyCaseCondition: + Description: 'Avoid empty condition in case statements.' Enabled: false + +Style/EmptyLineBetweenDefs: + Description: 'Use empty lines between defs.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods' + Enabled: true + Style/EmptyLines: - Description: Don't use several empty lines in a row. + Description: "Don't use several empty lines in a row." Enabled: false + Style/EmptyLinesAroundAccessModifier: - Description: Keep blank lines around access modifiers. + Description: "Keep blank lines around access modifiers." Enabled: false + +Style/EmptyLinesAroundBlockBody: + Description: "Keeps track of empty lines around block bodies." + Enabled: false + +Style/EmptyLinesAroundClassBody: + Description: "Keeps track of empty lines around class bodies." + Enabled: false + +Style/EmptyLinesAroundModuleBody: + Description: "Keeps track of empty lines around module bodies." + Enabled: false + Style/EmptyLinesAroundMethodBody: - Description: Keeps track of empty lines around method bodies. + Description: "Keeps track of empty lines around method bodies." Enabled: false + Style/EmptyLiteral: - Description: Prefer literals to Array.new/Hash.new/String.new. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash + Description: 'Prefer literals to Array.new/Hash.new/String.new.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash' Enabled: false + +Style/Encoding: + Description: Use UTF-8 as the source file encoding. + StyleGuide: https://github.com/bbatsov/ruby-style-guide#utf-8 + Enabled: true + EnforcedStyle: always + SupportedStyles: + - when_needed + - always + Style/EndBlock: - Description: Avoid the use of END blocks. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-END-blocks + Description: 'Avoid the use of END blocks.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks' Enabled: false + Style/EndOfLine: - Description: Use Unix-style line endings. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#crlf + Description: 'Use Unix-style line endings.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf' Enabled: true + Style/EvenOdd: - Description: Favor the use of Fixnum#even? && Fixnum#odd? - StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods + Description: 'Favor the use of Fixnum#even? && Fixnum#odd?' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods' + Enabled: false + +Style/ExtraSpacing: + Description: 'Do not use unnecessary spacing.' + Enabled: false + +Style/FileName: + Description: 'Use snake_case for source file names.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files' + Enabled: true + +Style/FrozenStringLiteralComment: + Description: >- + Add the frozen_string_literal comment to the top of files + to help transition from Ruby 2.3.0 to Ruby 3.0. + Enabled: false + +Style/InitialIndentation: + Description: >- + Checks the indentation of the first non-blank non-comment line in a file. + Enabled: false + +Style/FirstParameterIndentation: + Description: 'Checks the indentation of the first parameter in a method call.' Enabled: false + Style/FlipFlop: - Description: Checks for flip flops - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops + Description: 'Checks for flip flops' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops' + Enabled: false + +Style/For: + Description: 'Checks use of for or each in multiline loops.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops' + Enabled: true + +Style/FormatString: + Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf' + Enabled: false + +Style/GlobalVars: + Description: 'Do not introduce global variables.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars' + Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html' + Enabled: false + +Style/GuardClause: + Description: 'Check for conditionals that can be replaced with guard clauses' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals' + Enabled: false + +Style/HashSyntax: + Description: >- + Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax + { :a => 1, :b => 2 }. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals' + Enabled: false + +Style/IfInsideElse: + Description: 'Finds if nodes inside else, which can be converted to elsif.' + Enabled: false + +Style/IfUnlessModifier: + Description: >- + Favor modifier if/unless usage when you have a + single-line body. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier' + Enabled: false + +Style/IfUnlessModifierOfIfUnless: + Description: >- + Avoid modifier if/unless usage on conditionals. Enabled: false + Style/IfWithSemicolon: - Description: Do not use if x; .... Use the ternary operator instead. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs + Description: 'Do not use if x; .... Use the ternary operator instead.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs' Enabled: false + Style/IndentationConsistency: - Description: Keep indentation straight. + Description: 'Keep indentation straight.' Enabled: false + +Style/IndentationWidth: + Description: 'Use 2 spaces for indentation.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation' + Enabled: true + +Style/IdenticalConditionalBranches: + Description: >- + Checks that conditional statements do not have an identical + line at the end of each branch, which can validly be moved + out of the conditional. + Enabled: false + Style/IndentArray: - Description: Checks the indentation of the first element in an array literal. + Description: >- + Checks the indentation of the first element in an array + literal. + Enabled: false + +Style/IndentAssignment: + Description: >- + Checks the indentation of the first line of the + right-hand-side of a multi-line assignment. + Enabled: false + +Style/IndentHash: + Description: 'Checks the indentation of the first key in a hash literal.' Enabled: false + Style/InfiniteLoop: - Description: Use Kernel#loop for infinite loops. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#infinite-loop + Description: 'Use Kernel#loop for infinite loops.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#infinite-loop' Enabled: false + Style/Lambda: - Description: Use the new lambda literal syntax for single-line blocks. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#lambda-multi-line + Description: 'Use the new lambda literal syntax for single-line blocks.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line' Enabled: false + +Style/LambdaCall: + Description: 'Use lambda.call(...) instead of lambda.(...).' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call' + Enabled: false + Style/LeadingCommentSpace: - Description: Comments should start with a space. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-space + Description: 'Comments should start with a space.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space' Enabled: false + Style/LineEndConcatenation: - Description: Use \ instead of + or << to concatenate two string literals at line - end. + Description: >- + Use \ instead of + or << to concatenate two string literals at + line end. Enabled: false + Style/MethodCallParentheses: - Description: Do not use parentheses for method calls with no arguments. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-args-no-parens + Description: 'Do not use parentheses for method calls with no arguments.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens' + Enabled: false + +Style/MethodDefParentheses: + Description: >- + Checks if the method definitions have or don't have + parentheses. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens' Enabled: false + +Style/MethodName: + Description: 'Use the configured style when naming methods.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars' + Enabled: true + Style/ModuleFunction: - Description: Checks for usage of `extend self` in modules. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function + Description: 'Checks for usage of `extend self` in modules.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function' Enabled: false + +Style/MultilineArrayBraceLayout: + Description: >- + Checks that the closing brace in an array literal is + either on the same line as the last array element, or + a new line. + Enabled: false + Style/MultilineBlockChain: - Description: Avoid multi-line chains of blocks. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks + Description: 'Avoid multi-line chains of blocks.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks' Enabled: false + Style/MultilineBlockLayout: - Description: Ensures newlines after multiline block do statements. + Description: 'Ensures newlines after multiline block do statements.' + Enabled: false + +Style/MultilineHashBraceLayout: + Description: >- + Checks that the closing brace in a hash literal is + either on the same line as the last hash element, or + a new line. Enabled: false + Style/MultilineIfThen: - Description: Do not use then for multi-line if/unless. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-then + Description: 'Do not use then for multi-line if/unless.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then' + Enabled: false + +Style/MultilineMethodCallBraceLayout: + Description: >- + Checks that the closing brace in a method call is + either on the same line as the last method argument, or + a new line. + Enabled: false + +Style/MultilineMethodCallIndentation: + Description: >- + Checks indentation of method calls with the dot operator + that span more than one line. + Enabled: false + +Style/MultilineMethodDefinitionBraceLayout: + Description: >- + Checks that the closing brace in a method definition is + either on the same line as the last method parameter, or + a new line. + Enabled: false + +Style/MultilineOperationIndentation: + Description: >- + Checks indentation of binary operations that span more than + one line. Enabled: false + Style/MultilineTernaryOperator: - Description: 'Avoid multi-line ?: (the ternary operator); use if/unless instead.' - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary + Description: >- + Avoid multi-line ?: (the ternary operator); + use if/unless instead. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary' + Enabled: false + +Style/MutableConstant: + Description: 'Do not assign mutable objects to constants.' Enabled: false + Style/NegatedIf: - Description: Favor unless over if for negative conditions (or control flow or). - StyleGuide: https://github.com/bbatsov/ruby-style-guide#unless-for-negatives + Description: >- + Favor unless over if for negative conditions + (or control flow or). + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives' Enabled: false + Style/NegatedWhile: - Description: Favor until over while for negative conditions. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#until-for-negatives + Description: 'Favor until over while for negative conditions.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives' Enabled: false + +Style/NestedModifier: + Description: 'Avoid using nested modifiers.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-modifiers' + Enabled: false + +Style/NestedParenthesizedCalls: + Description: >- + Parenthesize method calls which are nested inside the + argument list of another parenthesized method call. + Enabled: false + Style/NestedTernaryOperator: - Description: Use one expression per branch in a ternary operator. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-ternary + Description: 'Use one expression per branch in a ternary operator.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary' Enabled: false + +Style/Next: + Description: 'Use `next` to skip iteration instead of a condition at the end.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals' + Enabled: false + Style/NilComparison: - Description: Prefer x.nil? to x == nil. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods + Description: 'Prefer x.nil? to x == nil.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods' Enabled: false + +Style/NonNilCheck: + Description: 'Checks for redundant nil checks.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks' + Enabled: true + Style/Not: - Description: Use ! instead of not. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#bang-not-not + Description: 'Use ! instead of not.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not' + Enabled: false + +Style/NumericLiterals: + Description: >- + Add underscores to large numeric literals to improve their + readability. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics' + Enabled: false + +Style/NumericLiteralPrefix: + Description: 'Use smallcase prefixes for numeric literals.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#numeric-literal-prefixes' Enabled: false + Style/OneLineConditional: - Description: Favor the ternary operator(?:) over if/then/else/end constructs. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator + Description: >- + Favor the ternary operator(?:) over + if/then/else/end constructs. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator' Enabled: false + Style/OpMethod: - Description: When defining binary operators, name the argument other. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg + Description: 'When defining binary operators, name the argument other.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg' + Enabled: false + +Style/OptionalArguments: + Description: >- + Checks for optional arguments that do not appear at the end + of the argument list + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#optional-arguments' + Enabled: false + +Style/ParallelAssignment: + Description: >- + Check for simple usages of parallel assignment. + It will only warn when the number of variables + matches on both sides of the assignment. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment' + Enabled: false + +Style/ParenthesesAroundCondition: + Description: >- + Don't use parentheses around the condition of an + if/unless/while. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if' + Enabled: false + +Style/PercentLiteralDelimiters: + Description: 'Use `%`-literal delimiters consistently' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces' Enabled: false + +Style/PercentQLiterals: + Description: 'Checks if uses of %Q/%q match the configured preference.' + Enabled: false + Style/PerlBackrefs: - Description: Avoid Perl-style regex back references. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers + Description: 'Avoid Perl-style regex back references.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers' + Enabled: false + +Style/PredicateName: + Description: 'Check the names of predicate methods.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark' Enabled: false + Style/Proc: - Description: Use proc instead of Proc.new. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc + Description: 'Use proc instead of Proc.new.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc' + Enabled: false + +Style/RaiseArgs: + Description: 'Checks the arguments passed to raise/fail.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages' Enabled: false + Style/RedundantBegin: - Description: Don't use begin blocks when they are not needed. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#begin-implicit + Description: "Don't use begin blocks when they are not needed." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit' Enabled: false + Style/RedundantException: - Description: Checks for an obsolete RuntimeException argument in raise/fail. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror + Description: "Checks for an obsolete RuntimeException argument in raise/fail." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror' Enabled: false + +Style/RedundantFreeze: + Description: "Checks usages of Object#freeze on immutable objects." + Enabled: false + +Style/RedundantParentheses: + Description: "Checks for parentheses that seem not to serve any purpose." + Enabled: false + +Style/RedundantReturn: + Description: "Don't use return where it's not required." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return' + Enabled: false + Style/RedundantSelf: - Description: Don't use self where it's not needed. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-self-unless-required + Description: "Don't use self where it's not needed." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required' + Enabled: false + +Style/RegexpLiteral: + Description: 'Use / or %r around regular expressions.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r' + Enabled: false + +Style/RescueEnsureAlignment: + Description: 'Align rescues and ensures correctly.' Enabled: false + Style/RescueModifier: - Description: Avoid using rescue in its modifier form. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers + Description: 'Avoid using rescue in its modifier form.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers' Enabled: false + Style/SelfAssignment: - Description: Checks for places where self-assignment shorthand should have been - used. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#self-assignment + Description: >- + Checks for places where self-assignment shorthand should have + been used. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment' Enabled: false -Style/SingleSpaceBeforeFirstArg: - Description: Checks that exactly one space is used between a method name and the - first argument for method calls without parentheses. + +Style/Semicolon: + Description: "Don't use semicolons to terminate expressions." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon' + Enabled: false + +Style/SignalException: + Description: 'Checks for proper usage of fail and raise.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#prefer-raise-over-fail' Enabled: false + +Style/SingleLineBlockParams: + Description: 'Enforces the names of some block params.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks' + Enabled: false + +Style/SingleLineMethods: + Description: 'Avoid single-line methods.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods' + Enabled: false + +Style/SpaceBeforeFirstArg: + Description: >- + Checks that exactly one space is used between a method name + and the first argument for method calls without parentheses. + Enabled: false + Style/SpaceAfterColon: - Description: Use spaces after colons. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators + Description: 'Use spaces after colons.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' Enabled: false + Style/SpaceAfterComma: - Description: Use spaces after commas. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators - Enabled: false -Style/SpaceAfterControlKeyword: - Description: Use spaces after if/elsif/unless/while/until/case/when. + Description: 'Use spaces after commas.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' Enabled: false + Style/SpaceAfterMethodName: - Description: Do not put a space between a method name and the opening parenthesis - in a method definition. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces + Description: >- + Do not put a space between a method name and the opening + parenthesis in a method definition. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces' Enabled: false + Style/SpaceAfterNot: Description: Tracks redundant space after the ! operator. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-bang + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang' Enabled: false + Style/SpaceAfterSemicolon: - Description: Use spaces after semicolons. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators + Description: 'Use spaces after semicolons.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' Enabled: false + +Style/SpaceBeforeBlockBraces: + Description: >- + Checks that the left block brace has or doesn't have space + before it. + Enabled: false + Style/SpaceBeforeComma: - Description: No spaces before commas. + Description: 'No spaces before commas.' Enabled: false + Style/SpaceBeforeComment: - Description: Checks for missing space between code and a comment on the same line. + Description: >- + Checks for missing space between code and a comment on the + same line. Enabled: false + Style/SpaceBeforeSemicolon: - Description: No spaces before semicolons. + Description: 'No spaces before semicolons.' + Enabled: false + +Style/SpaceInsideBlockBraces: + Description: >- + Checks that block braces have or don't have surrounding space. + For blocks taking parameters, checks that the left brace has + or doesn't have trailing space. Enabled: false + +Style/SpaceAroundBlockParameters: + Description: 'Checks the spacing inside and after block parameters pipes.' + Enabled: false + +Style/SpaceAroundEqualsInParameterDefault: + Description: >- + Checks that the equals signs in parameter default assignments + have or don't have surrounding space depending on + configuration. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals' + Enabled: false + +Style/SpaceAroundKeyword: + Description: 'Use a space around keywords if appropriate.' + Enabled: false + Style/SpaceAroundOperators: - Description: Use spaces around operators. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators + Description: 'Use a single space around operators.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' + Enabled: false + +Style/SpaceInsideArrayPercentLiteral: + Description: 'No unnecessary additional spaces between elements in %i/%w literals.' Enabled: false -Style/SpaceBeforeModifierKeyword: - Description: Put a space before the modifier keyword. + +Style/SpaceInsidePercentLiteralDelimiters: + Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.' Enabled: false + Style/SpaceInsideBrackets: - Description: No spaces after [ or before ]. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces + Description: 'No spaces after [ or before ].' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces' Enabled: false + +Style/SpaceInsideHashLiteralBraces: + Description: "Use spaces inside hash literal braces - or don't." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators' + Enabled: false + Style/SpaceInsideParens: - Description: No spaces after ( or before ). - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces + Description: 'No spaces after ( or before ).' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces' Enabled: false + Style/SpaceInsideRangeLiteral: - Description: No spaces inside range literals. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals + Description: 'No spaces inside range literals.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals' Enabled: false + Style/SpaceInsideStringInterpolation: - Description: 'No spaces inside "#{v}".' + Description: 'Checks for padding/surrounding spaces inside string interpolation.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation' Enabled: false + Style/SpecialGlobalVars: - Description: Avoid Perl-style global variables. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms + Description: 'Avoid Perl-style global variables.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms' + Enabled: false + +Style/StabbyLambdaParentheses: + Description: 'Check for the usage of parentheses around stabby lambda arguments.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#stabby-lambda-with-args' Enabled: false + +Style/StringLiterals: + Description: 'Checks if uses of quotes match the configured preference.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals' + Enabled: false + +Style/StringLiteralsInInterpolation: + Description: >- + Checks if uses of quotes inside expressions in interpolated + strings match the configured preference. + Enabled: false + Style/StructInheritance: - Description: Checks for inheritance from Struct.new. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new + Description: 'Checks for inheritance from Struct.new.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new' + Enabled: false + +Style/SymbolLiteral: + Description: 'Use plain symbols instead of string symbols when possible.' + Enabled: false + +Style/SymbolProc: + Description: 'Use symbols as procs instead of blocks when possible.' Enabled: false + Style/Tab: - Description: No hard tabs. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-indentation + Description: 'No hard tabs.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation' Enabled: true + +Style/TrailingBlankLines: + Description: 'Checks trailing blank lines and final newline.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof' + Enabled: true + +Style/TrailingCommaInArguments: + Description: 'Checks for trailing comma in argument lists.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma' + Enabled: false + +Style/TrailingCommaInLiteral: + Description: 'Checks for trailing comma in array and hash literals.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas' + Enabled: false + Style/TrailingWhitespace: - Description: Avoid trailing whitespace. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace + Description: 'Avoid trailing whitespace.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace' Enabled: true + +Style/TrivialAccessors: + Description: 'Prefer attr_* methods to trivial readers/writers.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family' + Enabled: false + Style/UnlessElse: - Description: Do not use unless with else. Rewrite these with the positive case first. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-else-with-unless + Description: >- + Do not use unless with else. Rewrite these with the positive + case first. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless' Enabled: false + Style/UnneededCapitalW: - Description: Checks for %W when interpolation is not needed. + Description: 'Checks for %W when interpolation is not needed.' Enabled: false + +Style/UnneededInterpolation: + Description: 'Checks for strings that are just an interpolated expression.' + Enabled: false + Style/UnneededPercentQ: - Description: Checks for %q/%Q when single quotes or double quotes would do. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-q + Description: 'Checks for %q/%Q when single quotes or double quotes would do.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q' Enabled: false -Style/UnneededPercentX: - Description: Checks for %x when `` would do. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-x + +Style/TrailingUnderscoreVariable: + Description: >- + Checks for the usage of unneeded trailing underscores at the + end of parallel variable assignment. + AllowNamedUnderscoreVariables: true Enabled: false + Style/VariableInterpolation: - Description: Don't interpolate global, instance and class variables directly in - strings. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate + Description: >- + Don't interpolate global, instance and class variables + directly in strings. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate' + Enabled: false + +Style/VariableName: + Description: 'Use the configured style when naming variables.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars' Enabled: false + Style/WhenThen: - Description: Use when x then ... for one-line cases. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases + Description: 'Use when x then ... for one-line cases.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases' Enabled: false + Style/WhileUntilDo: - Description: Checks for redundant do after while or until. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do + Description: 'Checks for redundant do after while or until.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do' + Enabled: false + +Style/WhileUntilModifier: + Description: >- + Favor modifier while/until usage when you have a + single-line body. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier' + Enabled: false + +Style/WordArray: + Description: 'Use %w or %W for arrays of words.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w' + Enabled: false + +Style/ZeroLengthPredicate: + Description: 'Use #empty? when testing for objects of length 0.' + Enabled: false + +#################### Metrics ################################ + +Metrics/AbcSize: + Description: >- + A calculated magnitude based on number of assignments, + branches, and conditions. + Reference: 'http://c2.com/cgi/wiki?AbcMetric' + Enabled: false + +Metrics/BlockNesting: + Description: 'Avoid excessive block nesting' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count' Enabled: false + +Metrics/ClassLength: + Description: 'Avoid classes longer than 100 lines of code.' + Enabled: false + +Metrics/ModuleLength: + Description: 'Avoid modules longer than 100 lines of code.' + Enabled: false + +Metrics/CyclomaticComplexity: + Description: >- + A complexity metric that is strongly correlated to the number + of test cases needed to validate a method. + Enabled: false + +Metrics/LineLength: + Description: 'Limit lines to 80 characters.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits' + Enabled: true + +Metrics/MethodLength: + Description: 'Avoid methods longer than 10 lines of code.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods' + Enabled: false + +Metrics/ParameterLists: + Description: 'Avoid parameter lists longer than three or four parameters.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params' + Enabled: false + +Metrics/PerceivedComplexity: + Description: >- + A complexity metric geared towards measuring complexity for a + human reader. + Enabled: false + +#################### Lint ################################ +### Warnings + Lint/AmbiguousOperator: - Description: Checks for ambiguous operators in the first argument of a method invocation - without parentheses. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-as-args + Description: >- + Checks for ambiguous operators in the first argument of a + method invocation without parentheses. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args' Enabled: false + Lint/AmbiguousRegexpLiteral: - Description: Checks for ambiguous regexp literals in the first argument of a method - invocation without parenthesis. + Description: >- + Checks for ambiguous regexp literals in the first argument of + a method invocation without parentheses. Enabled: false + +Lint/AssignmentInCondition: + Description: "Don't use assignment in conditions." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition' + Enabled: false + Lint/BlockAlignment: - Description: Align block ends correctly. + Description: 'Align block ends correctly.' + Enabled: false + +Lint/CircularArgumentReference: + Description: "Default values in optional keyword arguments and optional ordinal arguments should not refer back to the name of the argument." Enabled: false + Lint/ConditionPosition: - Description: Checks for condition placed in a confusing position relative to the - keyword. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#same-line-condition + Description: >- + Checks for condition placed in a confusing position relative to + the keyword. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition' Enabled: false + Lint/Debugger: - Description: Check for debugger calls. + Description: 'Check for debugger calls.' + Enabled: false + +Lint/DefEndAlignment: + Description: 'Align ends corresponding to defs correctly.' Enabled: false + Lint/DeprecatedClassMethods: - Description: Check for deprecated class method calls. + Description: 'Check for deprecated class method calls.' Enabled: false + Lint/DuplicateMethods: - Description: Check for duplicate methods calls. + Description: 'Check for duplicate method definitions.' + Enabled: false + +Lint/DuplicatedKey: + Description: 'Check for duplicate keys in hash literals.' + Enabled: false + +Lint/EachWithObjectArgument: + Description: 'Check for immutable argument given to each_with_object.' Enabled: false + Lint/ElseLayout: - Description: Check for odd code arrangement in an else block. + Description: 'Check for odd code arrangement in an else block.' Enabled: false + Lint/EmptyEnsure: - Description: Checks for empty ensure block. + Description: 'Checks for empty ensure block.' Enabled: false + Lint/EmptyInterpolation: - Description: Checks for empty string interpolation. + Description: 'Checks for empty string interpolation.' Enabled: false + +Lint/EndAlignment: + Description: 'Align ends correctly.' + Enabled: false + Lint/EndInMethod: - Description: END blocks should not be placed inside method definitions. + Description: 'END blocks should not be placed inside method definitions.' Enabled: false + Lint/EnsureReturn: - Description: Do not use return in an ensure block. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-return-ensure + Description: 'Do not use return in an ensure block.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure' Enabled: false + Lint/Eval: - Description: The use of eval represents a serious security risk. + Description: 'The use of eval represents a serious security risk.' Enabled: false -Lint/HandleExceptions: - Description: Don't suppress exception. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions + +Lint/FloatOutOfRange: + Description: >- + Catches floating-point literals too large or small for Ruby to + represent. Enabled: false + +Lint/FormatParameterMismatch: + Description: 'The number of parameters to format/sprint must match the fields.' + Enabled: false + +Lint/HandleExceptions: + Description: "Don't suppress exception." + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions' + Enabled: false + +Lint/ImplicitStringConcatenation: + Description: >- + Checks for adjacent string literals on the same line, which + could better be represented as a single string literal. + Enabled: false + +Lint/IneffectiveAccessModifier: + Description: >- + Checks for attempts to use `private` or `protected` to set + the visibility of a class method, which does not work. + Enabled: false + +Lint/InheritException: + Description: 'Avoid inheriting from the `Exception` class.' + Enabled: false + Lint/InvalidCharacterLiteral: - Description: Checks for invalid character literals with a non-escaped whitespace - character. + Description: >- + Checks for invalid character literals with a non-escaped + whitespace character. Enabled: false + Lint/LiteralInCondition: - Description: Checks of literals used in conditions. + Description: 'Checks of literals used in conditions.' Enabled: false + Lint/LiteralInInterpolation: - Description: Checks for literals used in interpolation. + Description: 'Checks for literals used in interpolation.' Enabled: false + Lint/Loop: - Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while - for post-loop tests. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#loop-with-break - Enabled: false + Description: >- + Use Kernel#loop with break rather than begin/end/until or + begin/end/while for post-loop tests. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break' + Enabled: false + +Lint/NestedMethodDefinition: + Description: 'Do not use nested method definitions.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods' + Enabled: false + +Lint/NextWithoutAccumulator: + Description: >- + Do not omit the accumulator when calling `next` + in a `reduce`/`inject` block. + Enabled: false + +Lint/NonLocalExitFromIterator: + Description: 'Do not use return in iterator to cause non-local exit.' + Enabled: false + Lint/ParenthesesAsGroupedExpression: - Description: Checks for method calls with a space before the opening parenthesis. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces - Enabled: false + Description: >- + Checks for method calls with a space before the opening + parenthesis. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces' + Enabled: false + +Lint/PercentStringArray: + Description: >- + Checks for unwanted commas and quotes in %w/%W literals. + Enabled: false + +Lint/PercentSymbolArray: + Description: >- + Checks for unwanted commas and colons in %i/%I literals. + Enabled: false + +Lint/RandOne: + Description: >- + Checks for `rand(1)` calls. Such calls always return `0` + and most likely a mistake. + Enabled: false + Lint/RequireParentheses: - Description: Use parentheses in the method call to avoid confusion about precedence. + Description: >- + Use parentheses in the method call to avoid confusion + about precedence. Enabled: false + Lint/RescueException: - Description: Avoid rescuing the Exception class. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-blind-rescues + Description: 'Avoid rescuing the Exception class.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues' Enabled: false -Lint/ShadowingOuterLocalVariable: - Description: Do not use the same name as outer local variable for block arguments - or block local variables. + +Lint/ShadowedException: + Description: >- + Avoid rescuing a higher level exception + before a lower level exception. Enabled: false -Lint/SpaceBeforeFirstArg: - Description: Put a space between a method name and the first argument in a method - call without parentheses. + +Lint/ShadowingOuterLocalVariable: + Description: >- + Do not use the same name as outer local variable + for block arguments or block local variables. Enabled: false + Lint/StringConversionInInterpolation: - Description: Checks for Object#to_s usage in string interpolation. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-to-s + Description: 'Checks for Object#to_s usage in string interpolation.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s' Enabled: false + Lint/UnderscorePrefixedVariableName: - Description: Do not use prefix `_` for a variable that is used. + Description: 'Do not use prefix `_` for a variable that is used.' + Enabled: false + +Lint/UnneededDisable: + Description: >- + Checks for rubocop:disable comments that can be removed. + Note: this cop is not disabled when disabling all cops. + It must be explicitly disabled. Enabled: false + Lint/UnusedBlockArgument: - Description: Checks for unused block arguments. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars + Description: 'Checks for unused block arguments.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' Enabled: false + Lint/UnusedMethodArgument: - Description: Checks for unused method arguments. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars + Description: 'Checks for unused method arguments.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' Enabled: false + Lint/UnreachableCode: - Description: Unreachable code. + Description: 'Unreachable code.' Enabled: false + Lint/UselessAccessModifier: - Description: Checks for useless access modifiers. + Description: 'Checks for useless access modifiers.' Enabled: false + +Lint/UselessArraySplat: + Description: 'Checks for useless array splats.' + Enabled: false + Lint/UselessAssignment: - Description: Checks for useless assignment to a local variable. - StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars + Description: 'Checks for useless assignment to a local variable.' + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' Enabled: false + Lint/UselessComparison: - Description: Checks for comparison of something with itself. + Description: 'Checks for comparison of something with itself.' Enabled: false + Lint/UselessElseWithoutRescue: - Description: Checks for useless `else` in `begin..end` without `rescue`. + Description: 'Checks for useless `else` in `begin..end` without `rescue`.' Enabled: false + Lint/UselessSetterCall: - Description: Checks for useless setter call to a local variable. + Description: 'Checks for useless setter call to a local variable.' Enabled: false + Lint/Void: - Description: Possible use of operator/literal/variable in void context. + Description: 'Possible use of operator/literal/variable in void context.' + Enabled: false + +##################### Performance ############################# + +Performance/Casecmp: + Description: >- + Use `casecmp` rather than `downcase ==`, `upcase ==`, `== downcase`, or `== upcase`.. + Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code' + Enabled: false + +Performance/CaseWhenSplat: + Description: >- + Place `when` conditions that use splat at the end + of the list of `when` branches. + Enabled: false + +Performance/Count: + Description: >- + Use `count` instead of `select...size`, `reject...size`, + `select...count`, `reject...count`, `select...length`, + and `reject...length`. + # This cop has known compatibility issues with `ActiveRecord` and other + # frameworks. ActiveRecord's `count` ignores the block that is passed to it. + # For more information, see the documentation in the cop itself. + # If you understand the known risk, you can disable `SafeMode`. + SafeMode: true + Enabled: false + +Performance/Detect: + Description: >- + Use `detect` instead of `select.first`, `find_all.first`, + `select.last`, and `find_all.last`. + Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code' + # This cop has known compatibility issues with `ActiveRecord` and other + # frameworks. `ActiveRecord` does not implement a `detect` method and `find` + # has its own meaning. Correcting `ActiveRecord` methods with this cop + # should be considered unsafe. + SafeMode: true + Enabled: false + +Performance/DoubleStartEndWith: + Description: >- + Use `str.{start,end}_with?(x, ..., y, ...)` + instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`. + Enabled: false + +Performance/EndWith: + Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.' + Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end' + Enabled: false + +Performance/FixedSize: + Description: 'Do not compute the size of statically sized objects except in constants' + Enabled: false + +Performance/FlatMap: + Description: >- + Use `Enumerable#flat_map` + instead of `Enumerable#map...Array#flatten(1)` + or `Enumberable#collect..Array#flatten(1)` + Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code' + Enabled: false + EnabledForFlattenWithoutParams: false + # If enabled, this cop will warn about usages of + # `flatten` being called without any parameters. + # This can be dangerous since `flat_map` will only flatten 1 level, and + # `flatten` without any parameters can flatten multiple levels. + +Performance/HashEachMethods: + Description: >- + Use `Hash#each_key` and `Hash#each_value` instead of + `Hash#keys.each` and `Hash#values.each`. + StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-each' + Enabled: false + AutoCorrect: false + +Performance/LstripRstrip: + Description: 'Use `strip` instead of `lstrip.rstrip`.' + Enabled: false + +Performance/PushSplat: + Description: 'Use `concat` instead of `push(*)`.' + Enabled: false + +Performance/RangeInclude: + Description: 'Use `Range#cover?` instead of `Range#include?`.' + Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code' + Enabled: false + +Performance/RedundantBlockCall: + Description: 'Use `yield` instead of `block.call`.' + Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-vs-yield-code' + Enabled: false + +Performance/RedundantMatch: + Description: >- + Use `=~` instead of `String#match` or `Regexp#match` in a context where the + returned `MatchData` is not needed. + Enabled: false + +Performance/RedundantMerge: + Description: 'Use Hash#[]=, rather than Hash#merge! with a single key-value pair.' + Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code' + Enabled: false + +Performance/RedundantSortBy: + Description: 'Use `sort` instead of `sort_by { |x| x }`.' + Enabled: false + +Performance/ReverseEach: + Description: 'Use `reverse_each` instead of `reverse.each`.' + Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code' + Enabled: false + +Performance/Sample: + Description: >- + Use `sample` instead of `shuffle.first`, + `shuffle.last`, and `shuffle[Fixnum]`. + Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code' + Enabled: false + +Performance/Size: + Description: >- + Use `size` instead of `count` for counting + the number of elements in `Array` and `Hash`. + Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code' + Enabled: false + +Performance/StartWith: + Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.' + Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end' + Enabled: false + +Performance/StringReplacement: + Description: >- + Use `tr` instead of `gsub` when you are replacing the same + number of characters. Use `delete` instead of `gsub` when + you are deleting characters. + Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code' + Enabled: false + +Performance/TimesMap: + Description: 'Checks for .times.map calls.' + Enabled: false + +##################### Rails ################################## + +Rails/ActionFilter: + Description: 'Enforces consistent use of action filter methods.' + Enabled: false + +Rails/Date: + Description: >- + Checks the correct usage of date aware methods, + such as Date.today, Date.current etc. Enabled: false + Rails/Delegate: - Description: Prefer delegate method for delegations. + Description: 'Prefer delegate method for delegations.' + Enabled: false + +Rails/Exit: + Description: >- + Favor `fail`, `break`, `return`, etc. over `exit` in + application or library code outside of Rake files to avoid + exits during unit testing or running in production. + Enabled: false + +Rails/FindBy: + Description: 'Prefer find_by over where.first.' + Enabled: false + +Rails/FindEach: + Description: 'Prefer all.find_each over all.find.' + Enabled: false + +Rails/HasAndBelongsToMany: + Description: 'Prefer has_many :through to has_and_belongs_to_many.' + Enabled: false + +Rails/Output: + Description: 'Checks for calls to puts, print, etc.' + Enabled: false + +Rails/OutputSafety: + Description: 'The use of `html_safe` or `raw` may be a security risk.' + Enabled: false + +Rails/PluralizationGrammar: + Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.' + Enabled: false + +Rails/ReadWriteAttribute: + Description: >- + Checks for read_attribute(:attr) and + write_attribute(:attr, val). + Enabled: false + +Rails/RequestReferer: + Description: 'Use consistent syntax for request.referer.' + Enabled: false + +Rails/ScopeArgs: + Description: 'Checks the arguments of ActiveRecord scopes.' + Enabled: false + +Rails/TimeZone: + Description: 'Checks the correct usage of time zone aware methods.' + StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time' + Reference: 'http://danilenko.org/2012/7/6/rails_timezones' + Enabled: false + +Rails/UniqBeforePluck: + Description: 'Prefer the use of uniq or distinct before pluck.' + Enabled: false + +Rails/Validation: + Description: 'Use validates :attribute, hash of validations.' Enabled: false + diff --git a/Gemfile b/Gemfile index 4ec89d181a..9afe1167fb 100644 --- a/Gemfile +++ b/Gemfile @@ -2,44 +2,47 @@ source 'https://rubygems.org' gem 'rails', '3.2.22.2' -gem 'pg', '~> 0.17.1' +gem 'pg', '~> 0.18.4' # New gem releases aren't being done. master is newer and supports Rails > 3.0 gem 'acts_as_versioned', :git => 'https://github.com/technoweenie/acts_as_versioned.git', :ref => '63b1fc8529d028' -gem 'active_model_otp', :git => 'https://github.com/mysociety/active_model_otp.git', :ref => '0eb977b4c6dafd' -gem 'charlock_holmes', '~> 0.6.9.4' +gem 'active_model_otp', :git => 'https://github.com/heapsource/active_model_otp.git', :ref => 'c342283fe564bf' +gem 'charlock_holmes', '~> 0.7.3' gem 'dynamic_form', '~> 1.1.4' -gem 'exception_notification', '~> 3.0.1' -gem 'fancybox-rails', '~> 0.2.1' -gem 'foundation-rails', '~> 5.2.1.0' +# 4.1.0 has a bug in it which is fixed in a later version which does not have Ruby 1.9.3 support +gem 'exception_notification', '4.0.1' +gem 'fancybox-rails', '~> 0.3.1' +gem 'foundation-rails', '~> 5.5.3.2' gem 'geoip', '~> 1.6.1' gem 'gnuplot', '2.6.2' gem 'htmlentities', '~> 4.3.4' -gem 'icalendar', '1.4.3' -gem 'jquery-rails', '~> 3.1.3' -gem 'jquery-ui-rails', '~> 4.1.0' +gem 'icalendar', '2.3.0' +gem 'jquery-rails', '~> 3.1.4' +gem 'jquery-ui-rails', '~> 5.0.0' gem 'json', '~> 1.8.1' gem 'holidays', '~> 2.2.0' -gem 'iso_country_codes', '~> 0.6.1' +gem 'iso_country_codes', '~> 0.7.3' gem 'mahoro', '~> 0.4' gem 'memcache-client', '~> 1.8.5' +gem 'newrelic_rpm' gem 'net-http-local', '~> 0.1.2', :platforms => [:ruby_19] gem 'net-purge', '~> 0.1.0' gem 'nokogiri', '~> 1.6' gem 'open4', '~> 1.3.4' gem 'rack', '~> 1.4.6' gem 'rack-utf8_sanitizer', '~> 1.3.0' -gem 'rails-i18n', '~> 0.7.3' +gem 'rails-i18n', '~> 3.0.0' gem 'recaptcha', '~> 0.4.0', :require => 'recaptcha/rails' -gem 'rmagick', '~> 2.14.0' +gem 'rmagick', '~> 2.15.0' gem 'ruby-msg', '~> 1.5.0', :git => 'https://github.com/mysociety/ruby-msg.git', :ref => 'f9f928ed76c024b4bc3a08bc1a59beb62df36663' -gem 'secure_headers', '~> 2.4.0' +gem 'sass', '3.4.21' # pinned because later versions cause problems (see blame) +gem 'secure_headers', '~> 3.1.2' gem 'statistics2', '~> 0.54' gem 'strip_attributes', :git => 'https://github.com/mysociety/strip_attributes.git', :branch => 'globalize3' gem 'syslog_protocol', '~> 0.9.2' gem 'thin', '~> 1.5.1' gem 'vpim', '~> 13.11.11' -gem 'will_paginate', '~> 3.0.5' +gem 'will_paginate', '~> 3.0.7' # 3.0.6 introduces Rails 4 support gem 'xapian-full-alaveteli', '~> 1.2.21.1' gem 'xml-simple', '~> 1.1.2', :require => 'xmlsimple' gem 'zip', '~> 2.0.2' @@ -49,48 +52,40 @@ gem 'gettext_i18n_rails', '~> 0.9.4' # Later versions cause error (see blame) gem 'gettext', '~> 2.3.9' gem 'globalize3', :git => 'https://github.com/globalize/globalize.git', :ref => '5fd95f2389dff1' gem 'locale', '~> 2.0.8' -gem 'routing-filter', '~> 0.3.1' +gem 'routing-filter', '~> 0.4.0' gem 'unicode', '~> 0.4.4' gem 'unidecoder', '~> 1.1.2' group :assets do - gem 'bootstrap-sass', '~> 2.3.1.2' + gem 'bootstrap-sass', '~> 2.3.2.2' gem 'sass-rails', '~> 3.2.3' - gem 'compass-rails', '2.0.0' + gem 'compass-rails', '3.0.2' gem 'coffee-rails', '~> 3.2.1' gem 'uglifier', '~> 2.7.2' gem 'therubyracer', '~> 0.12.2' end -group :production do - gem 'newrelic_rpm' -end - group :test do gem 'fakeweb', '~> 1.3.0' gem 'coveralls', :require => false - gem 'capybara', '~> 2.5.0' + gem 'capybara', '~> 2.7.0' + gem 'delorean', '~> 2.1.0' end group :test, :development do - gem 'bullet', '~> 4.14.6' - gem 'factory_girl_rails', '~> 1.7' - gem 'pry', '~> 0.10.3' + gem 'bullet', '~> 5.1.0' + gem 'factory_girl_rails', '~> 4.7.0' gem 'rspec-activemodel-mocks', '~> 1.0.1' - gem 'rspec-rails', '3.2.0' - gem 'test-unit', '~> 3.0' - gem 'spork-rails', '~> 3.2.1' - gem 'pry-nav', '~> 0.2.4' + gem 'rspec-rails', '~> 3.4.0' + gem 'test-unit', '~> 3.1.0' + gem 'spork-rails', '~> 4.0.0' + gem 'pry-debugger', '~> 0.2.3', :platforms => :ruby_19 end group :development do + gem 'annotate', '~> 2.7.1' gem 'capistrano', '~> 2.15.4' - gem 'mailcatcher', '~> 0.5.11' - gem 'quiet_assets', '~> 1.0.2' + gem 'mailcatcher', '~> 0.5.12' + gem 'quiet_assets', '~> 1.1.0' gem 'rdoc', '~> 3.12.2' end - -group :debug do - gem 'debugger', '~> 1.6.0', :platforms => :ruby_19 - gem 'annotate', '~> 2.7.0' -end diff --git a/Gemfile.lock b/Gemfile.lock index cf9c1d01dd..28e0eae7a0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,9 +9,9 @@ GIT paper_trail (~> 2) GIT - remote: https://github.com/mysociety/active_model_otp.git - revision: 0eb977b4c6dafdecaa6d0861783ebb502de3981f - ref: 0eb977b4c6dafd + remote: https://github.com/heapsource/active_model_otp.git + revision: c342283fe564bfe03d1798cb025ab80ff4e93451 + ref: c342283fe564bf specs: active_model_otp (1.2.0) activemodel @@ -72,31 +72,34 @@ GEM activesupport (3.2.22.2) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - annotate (2.7.0) + addressable (2.4.0) + annotate (2.7.1) activerecord (>= 3.2, < 6.0) - rake (~> 10.4) + rake (>= 10.4, < 12.0) arel (3.0.3) - bootstrap-sass (2.3.1.2) + bootstrap-sass (2.3.2.2) sass (~> 3.2) builder (3.0.4) - bullet (4.14.6) + bullet (5.1.0) activesupport (>= 3.0.0) - uniform_notifier (~> 1.9.0) + uniform_notifier (~> 1.10.0) capistrano (2.15.4) highline net-scp (>= 1.0.0) net-sftp (>= 2.0.0) net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) - capybara (2.5.0) + capybara (2.7.0) + addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - charlock_holmes (0.6.9.4) - chunky_png (1.3.3) - coderay (1.1.0) + charlock_holmes (0.7.3) + chronic (0.10.2) + chunky_png (1.3.5) + coderay (1.1.1) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) @@ -105,13 +108,23 @@ GEM execjs coffee-script-source (1.6.3) colorize (0.5.8) - columnize (0.3.6) - compass (0.12.2) + columnize (0.9.0) + compass (1.0.3) chunky_png (~> 1.2) - fssm (>= 0.2.7) - sass (~> 3.1) - compass-rails (2.0.0) - compass (>= 0.12.2) + compass-core (~> 1.0.2) + compass-import-once (~> 1.0.5) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + sass (>= 3.3.13, < 3.5) + compass-core (1.0.3) + multi_json (~> 1.0) + sass (>= 3.3.0, < 3.5) + compass-import-once (1.0.5) + sass (>= 3.2, < 3.5) + compass-rails (3.0.2) + compass (~> 1.0.0) + sass-rails (< 5.1) + sprockets (< 4.0) coveralls (0.6.7) colorize multi_json (~> 1.3) @@ -119,33 +132,35 @@ GEM simplecov (>= 0.7) thor daemons (1.1.9) - debugger (1.6.0) + debugger (1.6.8) columnize (>= 0.3.1) debugger-linecache (~> 1.2.0) - debugger-ruby_core_source (~> 1.2.1) + debugger-ruby_core_source (~> 1.3.5) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.2.2) + debugger-ruby_core_source (1.3.8) + delorean (2.1.0) + chronic diff-lcs (1.2.5) dynamic_form (1.1.4) erubis (2.7.0) eventmachine (1.0.7) - exception_notification (3.0.1) + exception_notification (4.0.1) actionmailer (>= 3.0.4) activesupport (>= 3.0.4) execjs (2.0.1) - factory_girl (2.6.4) - activesupport (>= 2.3.9) - factory_girl_rails (1.7.0) - factory_girl (~> 2.6.0) + factory_girl (4.7.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.7.0) + factory_girl (~> 4.7.0) railties (>= 3.0.0) fakeweb (1.3.0) - fancybox-rails (0.2.1) + fancybox-rails (0.3.1) railties (>= 3.1.0) fast_gettext (1.0.0) - foundation-rails (5.2.1.0) + ffi (1.9.10) + foundation-rails (5.5.3.2) railties (>= 3.1.0) - sass (>= 3.2.0) - fssm (0.2.10) + sass (>= 3.3.0, < 3.5) geoip (1.6.1) gettext (2.3.9) locale @@ -153,21 +168,21 @@ GEM gettext_i18n_rails (0.9.4) fast_gettext (>= 0.4.8) gnuplot (2.6.2) - haml (4.0.3) + haml (4.0.7) tilt highline (1.6.19) hike (1.2.3) holidays (2.2.0) htmlentities (4.3.4) i18n (0.7.0) - icalendar (1.4.3) - iso_country_codes (0.6.1) + icalendar (2.3.0) + iso_country_codes (0.7.3) journey (1.0.4) - jquery-rails (3.1.3) + jquery-rails (3.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (4.1.0) - railties (>= 3.1.0) + jquery-ui-rails (5.0.5) + railties (>= 3.2.16) json (1.8.3) libv8 (3.16.14.13) locale (2.0.8) @@ -175,7 +190,7 @@ GEM mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - mailcatcher (0.5.11) + mailcatcher (0.5.12) activesupport (~> 3.0) eventmachine (~> 1.0.0) haml (>= 3.1, < 5) @@ -187,8 +202,8 @@ GEM memcache-client (1.8.5) method_source (0.8.2) mime-types (1.25.1) - mini_portile2 (2.0.0) - multi_json (1.11.2) + mini_portile2 (2.1.0) + multi_json (1.12.1) net-http-local (0.1.2) net-purge (0.1.0) net-scp (1.1.1) @@ -199,34 +214,37 @@ GEM net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) newrelic_rpm (3.16.0.318) - nokogiri (1.6.7.2) - mini_portile2 (~> 2.0.0.rc2) + nokogiri (1.6.8) + mini_portile2 (~> 2.1.0) + pkg-config (~> 1.1.7) open4 (1.3.4) paper_trail (2.7.2) activerecord (~> 3.0) railties (~> 3.0) - pg (0.17.1) + pg (0.18.4) + pkg-config (1.1.7) polyglot (0.3.5) power_assert (0.2.7) pry (0.10.3) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - pry-nav (0.2.4) + pry-debugger (0.2.3) + debugger (~> 1.3) pry (>= 0.9.10, < 0.11.0) - quiet_assets (1.0.2) + quiet_assets (1.1.0) railties (>= 3.1, < 5.0) rack (1.4.7) rack-cache (1.6.1) rack (>= 0.4) - rack-protection (1.5.0) + rack-protection (1.5.3) rack rack-ssl (1.3.4) rack rack-test (0.6.3) rack (>= 1.0) - rack-utf8_sanitizer (1.3.0) - rack (~> 1.0) + rack-utf8_sanitizer (1.3.2) + rack (>= 1.0, < 3.0) rails (3.2.22.2) actionmailer (= 3.2.22.2) actionpack (= 3.2.22.2) @@ -235,8 +253,9 @@ GEM activesupport (= 3.2.22.2) bundler (~> 1.0) railties (= 3.2.22.2) - rails-i18n (0.7.3) + rails-i18n (3.0.1) i18n (~> 0.5) + rails (>= 3.0.0, < 4.0.0) railties (3.2.22.2) actionpack (= 3.2.22.2) activesupport (= 3.2.22.2) @@ -245,72 +264,75 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) rake (10.5.0) + rb-fsevent (0.9.7) + rb-inotify (0.9.7) + ffi (>= 0.5.0) rdoc (3.12.2) json (~> 1.4) recaptcha (0.4.0) ref (2.0.0) rest-client (1.6.7) mime-types (>= 1.16) - rmagick (2.14.0) - rotp (2.1.1) - routing-filter (0.3.1) - actionpack - rspec-activemodel-mocks (1.0.1) + rmagick (2.15.4) + rotp (3.0.1) + routing-filter (0.4.0.1) + actionpack (< 4.2) + rspec-activemodel-mocks (1.0.3) activemodel (>= 3.0) activesupport (>= 3.0) rspec-mocks (>= 2.99, < 4.0) - rspec-core (3.2.3) - rspec-support (~> 3.2.0) - rspec-expectations (3.2.1) + rspec-core (3.4.4) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.2.0) - rspec-mocks (3.2.1) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.2.0) - rspec-rails (3.2.0) - actionpack (>= 3.0, <= 4.2) - activesupport (>= 3.0, <= 4.2) - railties (>= 3.0, <= 4.2) - rspec-core (~> 3.2.0) - rspec-expectations (~> 3.2.0) - rspec-mocks (~> 3.2.0) - rspec-support (~> 3.2.0) - rspec-support (3.2.2) + rspec-support (~> 3.4.0) + rspec-rails (3.4.2) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) ruby-ole (1.2.11.8) - sass (3.2.10) + sass (3.4.21) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - secure_headers (2.4.4) - user_agent_parser + secure_headers (3.1.2) + useragent simplecov (0.7.1) multi_json (~> 1.0) simplecov-html (~> 0.7.1) simplecov-html (0.7.1) - sinatra (1.3.3) - rack (~> 1.3, >= 1.3.6) - rack-protection (~> 1.2) - tilt (~> 1.3, >= 1.3.3) - skinny (0.2.3) + sinatra (1.4.6) + rack (~> 1.4) + rack-protection (~> 1.4) + tilt (>= 1.3, < 3) + skinny (0.2.4) eventmachine (~> 1.0.0) - thin (~> 1.5.0) + thin (>= 1.5, < 1.7) slop (3.6.0) - spork (1.0.0rc3) - spork-rails (3.2.1) - rails (>= 3.0.0, < 3.3.0) + spork (1.0.0rc4) + spork-rails (4.0.0) + rails (>= 3.0.0, < 5) spork (>= 1.0rc0) sprockets (2.2.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.10) + sqlite3 (1.3.11) statistics2 (0.54) syslog_protocol (0.9.2) - test-unit (3.1.5) + test-unit (3.1.8) power_assert - text (1.2.1) + text (1.3.1) therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref @@ -329,12 +351,12 @@ GEM json (>= 1.8.0) unicode (0.4.4) unidecoder (1.1.2) - uniform_notifier (1.9.0) - user_agent_parser (2.3.0) + uniform_notifier (1.10.0) + useragent (0.16.7) vpim (13.11.11) - will_paginate (3.0.5) + will_paginate (3.0.7) xapian-full-alaveteli (1.2.21.1) - xml-simple (1.1.2) + xml-simple (1.1.5) xpath (2.0.0) nokogiri (~> 1.3) zip (2.0.2) @@ -345,22 +367,22 @@ PLATFORMS DEPENDENCIES active_model_otp! acts_as_versioned! - annotate (~> 2.7.0) - bootstrap-sass (~> 2.3.1.2) - bullet (~> 4.14.6) + annotate (~> 2.7.1) + bootstrap-sass (~> 2.3.2.2) + bullet (~> 5.1.0) capistrano (~> 2.15.4) - capybara (~> 2.5.0) - charlock_holmes (~> 0.6.9.4) + capybara (~> 2.7.0) + charlock_holmes (~> 0.7.3) coffee-rails (~> 3.2.1) - compass-rails (= 2.0.0) + compass-rails (= 3.0.2) coveralls - debugger (~> 1.6.0) + delorean (~> 2.1.0) dynamic_form (~> 1.1.4) - exception_notification (~> 3.0.1) - factory_girl_rails (~> 1.7) + exception_notification (= 4.0.1) + factory_girl_rails (~> 4.7.0) fakeweb (~> 1.3.0) - fancybox-rails (~> 0.2.1) - foundation-rails (~> 5.2.1.0) + fancybox-rails (~> 0.3.1) + foundation-rails (~> 5.5.3.2) geoip (~> 1.6.1) gettext (~> 2.3.9) gettext_i18n_rails (~> 0.9.4) @@ -368,49 +390,49 @@ DEPENDENCIES gnuplot (= 2.6.2) holidays (~> 2.2.0) htmlentities (~> 4.3.4) - icalendar (= 1.4.3) - iso_country_codes (~> 0.6.1) - jquery-rails (~> 3.1.3) - jquery-ui-rails (~> 4.1.0) + icalendar (= 2.3.0) + iso_country_codes (~> 0.7.3) + jquery-rails (~> 3.1.4) + jquery-ui-rails (~> 5.0.0) json (~> 1.8.1) locale (~> 2.0.8) mahoro (~> 0.4) - mailcatcher (~> 0.5.11) + mailcatcher (~> 0.5.12) memcache-client (~> 1.8.5) net-http-local (~> 0.1.2) net-purge (~> 0.1.0) newrelic_rpm nokogiri (~> 1.6) open4 (~> 1.3.4) - pg (~> 0.17.1) - pry (~> 0.10.3) - pry-nav (~> 0.2.4) - quiet_assets (~> 1.0.2) + pg (~> 0.18.4) + pry-debugger (~> 0.2.3) + quiet_assets (~> 1.1.0) rack (~> 1.4.6) rack-utf8_sanitizer (~> 1.3.0) rails (= 3.2.22.2) - rails-i18n (~> 0.7.3) + rails-i18n (~> 3.0.0) rdoc (~> 3.12.2) recaptcha (~> 0.4.0) - rmagick (~> 2.14.0) - routing-filter (~> 0.3.1) + rmagick (~> 2.15.0) + routing-filter (~> 0.4.0) rspec-activemodel-mocks (~> 1.0.1) - rspec-rails (= 3.2.0) + rspec-rails (~> 3.4.0) ruby-msg (~> 1.5.0)! + sass (= 3.4.21) sass-rails (~> 3.2.3) - secure_headers (~> 2.4.0) - spork-rails (~> 3.2.1) + secure_headers (~> 3.1.2) + spork-rails (~> 4.0.0) statistics2 (~> 0.54) strip_attributes! syslog_protocol (~> 0.9.2) - test-unit (~> 3.0) + test-unit (~> 3.1.0) therubyracer (~> 0.12.2) thin (~> 1.5.1) uglifier (~> 2.7.2) unicode (~> 0.4.4) unidecoder (~> 1.1.2) vpim (~> 13.11.11) - will_paginate (~> 3.0.5) + will_paginate (~> 3.0.7) xapian-full-alaveteli (~> 1.2.21.1) xml-simple (~> 1.1.2) zip (~> 2.0.2) diff --git a/app/assets/images/arrow-left.png b/app/assets/images/arrow-left.png index 74d2fa253c..6caebd51b4 100644 Binary files a/app/assets/images/arrow-left.png and b/app/assets/images/arrow-left.png differ diff --git a/app/assets/images/arrow-right.png b/app/assets/images/arrow-right.png index 34dd75ef83..d3e9004087 100644 Binary files a/app/assets/images/arrow-right.png and b/app/assets/images/arrow-right.png differ diff --git a/app/assets/images/bighand.png b/app/assets/images/bighand.png index 92a4a6105c..543e8a77cd 100644 Binary files a/app/assets/images/bighand.png and b/app/assets/images/bighand.png differ diff --git a/app/assets/images/button-gradient-large.png b/app/assets/images/button-gradient-large.png index 93ebc6cbcb..0be1a098a2 100644 Binary files a/app/assets/images/button-gradient-large.png and b/app/assets/images/button-gradient-large.png differ diff --git a/app/assets/images/button-gradient.png b/app/assets/images/button-gradient.png index 8b29e89ba4..1681dc3422 100644 Binary files a/app/assets/images/button-gradient.png and b/app/assets/images/button-gradient.png differ diff --git a/app/assets/images/button-preview.png b/app/assets/images/button-preview.png index 79b4ccd04e..5dd167579d 100644 Binary files a/app/assets/images/button-preview.png and b/app/assets/images/button-preview.png differ diff --git a/app/assets/images/button-search.png b/app/assets/images/button-search.png index 23945f4f01..ea77be590e 100644 Binary files a/app/assets/images/button-search.png and b/app/assets/images/button-search.png differ diff --git a/app/assets/images/calendar.png b/app/assets/images/calendar.png index 44981a41c6..c4a457b813 100644 Binary files a/app/assets/images/calendar.png and b/app/assets/images/calendar.png differ diff --git a/app/assets/images/defaultprofilepic.png b/app/assets/images/defaultprofilepic.png index affdaad3d0..267e643e26 100644 Binary files a/app/assets/images/defaultprofilepic.png and b/app/assets/images/defaultprofilepic.png differ diff --git a/app/assets/images/delivery-status/delivered.png b/app/assets/images/delivery-status/delivered.png new file mode 100644 index 0000000000..6e1db91d8e Binary files /dev/null and b/app/assets/images/delivery-status/delivered.png differ diff --git a/app/assets/images/delivery-status/delivered@2x.png b/app/assets/images/delivery-status/delivered@2x.png new file mode 100644 index 0000000000..b5f5df4cb5 Binary files /dev/null and b/app/assets/images/delivery-status/delivered@2x.png differ diff --git a/app/assets/images/delivery-status/failed.png b/app/assets/images/delivery-status/failed.png new file mode 100644 index 0000000000..86ff3726e0 Binary files /dev/null and b/app/assets/images/delivery-status/failed.png differ diff --git a/app/assets/images/delivery-status/failed@2x.png b/app/assets/images/delivery-status/failed@2x.png new file mode 100644 index 0000000000..ad9b6ebeea Binary files /dev/null and b/app/assets/images/delivery-status/failed@2x.png differ diff --git a/app/assets/images/delivery-status/sent.png b/app/assets/images/delivery-status/sent.png new file mode 100644 index 0000000000..41eb9b0909 Binary files /dev/null and b/app/assets/images/delivery-status/sent.png differ diff --git a/app/assets/images/delivery-status/sent@2x.png b/app/assets/images/delivery-status/sent@2x.png new file mode 100644 index 0000000000..064d4ef505 Binary files /dev/null and b/app/assets/images/delivery-status/sent@2x.png differ diff --git a/app/assets/images/email-16.png b/app/assets/images/email-16.png index 8692748e2b..02e1af0fde 100644 Binary files a/app/assets/images/email-16.png and b/app/assets/images/email-16.png differ diff --git a/app/assets/images/facebook-16.png b/app/assets/images/facebook-16.png new file mode 100644 index 0000000000..96da54bf40 Binary files /dev/null and b/app/assets/images/facebook-16.png differ diff --git a/app/assets/images/facebook-32.png b/app/assets/images/facebook-32.png new file mode 100644 index 0000000000..cb817a6f5d Binary files /dev/null and b/app/assets/images/facebook-32.png differ diff --git a/app/assets/images/fancybox-x.png b/app/assets/images/fancybox-x.png index c2130f8698..eb850fd3c7 100755 Binary files a/app/assets/images/fancybox-x.png and b/app/assets/images/fancybox-x.png differ diff --git a/app/assets/images/fancybox-y.png b/app/assets/images/fancybox-y.png index 7ef399b990..184585265d 100755 Binary files a/app/assets/images/fancybox-y.png and b/app/assets/images/fancybox-y.png differ diff --git a/app/assets/images/fancybox.png b/app/assets/images/fancybox.png index 65e14f68fd..58a512138c 100755 Binary files a/app/assets/images/fancybox.png and b/app/assets/images/fancybox.png differ diff --git a/app/assets/images/feed-14.png b/app/assets/images/feed-14.png index b3c949d224..5a70d662ad 100644 Binary files a/app/assets/images/feed-14.png and b/app/assets/images/feed-14.png differ diff --git a/app/assets/images/feed-16.png b/app/assets/images/feed-16.png index b641837f59..8302e85498 100644 Binary files a/app/assets/images/feed-16.png and b/app/assets/images/feed-16.png differ diff --git a/app/assets/images/feed-28.png b/app/assets/images/feed-28.png index d64c669c75..90c0035a59 100644 Binary files a/app/assets/images/feed-28.png and b/app/assets/images/feed-28.png differ diff --git a/app/assets/images/flying-computer.png b/app/assets/images/flying-computer.png index b1e1d59bb2..b338362662 100644 Binary files a/app/assets/images/flying-computer.png and b/app/assets/images/flying-computer.png differ diff --git a/app/assets/images/glyphicons-halflings-white.png b/app/assets/images/glyphicons-halflings-white.png index 3bf6484a29..c1ab58151c 100644 Binary files a/app/assets/images/glyphicons-halflings-white.png and b/app/assets/images/glyphicons-halflings-white.png differ diff --git a/app/assets/images/glyphicons-halflings.png b/app/assets/images/glyphicons-halflings.png index 79bc568c21..f241c76f9a 100644 Binary files a/app/assets/images/glyphicons-halflings.png and b/app/assets/images/glyphicons-halflings.png differ diff --git a/app/assets/images/helpmeinvestigate.png b/app/assets/images/helpmeinvestigate.png index e9aaf5aecd..4411f23a22 100644 Binary files a/app/assets/images/helpmeinvestigate.png and b/app/assets/images/helpmeinvestigate.png differ diff --git a/app/assets/images/home-grad.png b/app/assets/images/home-grad.png index ff9887a11b..df8fa3c0c6 100644 Binary files a/app/assets/images/home-grad.png and b/app/assets/images/home-grad.png differ diff --git a/app/assets/images/icon-foi.png b/app/assets/images/icon-foi.png index 138bf3b5c9..253d2f1765 100644 Binary files a/app/assets/images/icon-foi.png and b/app/assets/images/icon-foi.png differ diff --git a/app/assets/images/icon-person.png b/app/assets/images/icon-person.png index dfb35a8498..4148bb98fb 100644 Binary files a/app/assets/images/icon-person.png and b/app/assets/images/icon-person.png differ diff --git a/app/assets/images/icon-publicbody.png b/app/assets/images/icon-publicbody.png index 0f3848ccf5..99dae3cd3c 100644 Binary files a/app/assets/images/icon-publicbody.png and b/app/assets/images/icon-publicbody.png differ diff --git a/app/assets/images/icon_application_octet-stream_large.png b/app/assets/images/icon_application_octet-stream_large.png index a23916e9c9..3a305bebfa 100644 Binary files a/app/assets/images/icon_application_octet-stream_large.png and b/app/assets/images/icon_application_octet-stream_large.png differ diff --git a/app/assets/images/icon_application_pdf_large.png b/app/assets/images/icon_application_pdf_large.png index 990b96c0a4..e06a53fef8 100644 Binary files a/app/assets/images/icon_application_pdf_large.png and b/app/assets/images/icon_application_pdf_large.png differ diff --git a/app/assets/images/icon_application_rtf_large.png b/app/assets/images/icon_application_rtf_large.png index 9779721243..5ab062bd25 100644 Binary files a/app/assets/images/icon_application_rtf_large.png and b/app/assets/images/icon_application_rtf_large.png differ diff --git a/app/assets/images/icon_application_vnd.ms-excel_large.png b/app/assets/images/icon_application_vnd.ms-excel_large.png index acca5d92c1..0ead89d86b 100644 Binary files a/app/assets/images/icon_application_vnd.ms-excel_large.png and b/app/assets/images/icon_application_vnd.ms-excel_large.png differ diff --git a/app/assets/images/icon_application_vnd.ms-powerpoint_large.png b/app/assets/images/icon_application_vnd.ms-powerpoint_large.png index 9a1582930f..3e4ee00d88 100644 Binary files a/app/assets/images/icon_application_vnd.ms-powerpoint_large.png and b/app/assets/images/icon_application_vnd.ms-powerpoint_large.png differ diff --git a/app/assets/images/icon_application_vnd.ms-word_large.png b/app/assets/images/icon_application_vnd.ms-word_large.png index 2f3cb8efa0..5228288ea9 100644 Binary files a/app/assets/images/icon_application_vnd.ms-word_large.png and b/app/assets/images/icon_application_vnd.ms-word_large.png differ diff --git a/app/assets/images/icon_application_zip_large.png b/app/assets/images/icon_application_zip_large.png index c52d6d5aa7..7dbbaec1a3 100644 Binary files a/app/assets/images/icon_application_zip_large.png and b/app/assets/images/icon_application_zip_large.png differ diff --git a/app/assets/images/icon_image_img_large.png b/app/assets/images/icon_image_img_large.png index e19e7553c0..a87de83c9a 100644 Binary files a/app/assets/images/icon_image_img_large.png and b/app/assets/images/icon_image_img_large.png differ diff --git a/app/assets/images/icon_image_tiff_large.png b/app/assets/images/icon_image_tiff_large.png index 000bd03186..eb4d7cbdf3 100644 Binary files a/app/assets/images/icon_image_tiff_large.png and b/app/assets/images/icon_image_tiff_large.png differ diff --git a/app/assets/images/icon_message_delivery-status_large.png b/app/assets/images/icon_message_delivery-status_large.png index dccdbbccd6..67955a6937 100644 Binary files a/app/assets/images/icon_message_delivery-status_large.png and b/app/assets/images/icon_message_delivery-status_large.png differ diff --git a/app/assets/images/icon_text_html_large.png b/app/assets/images/icon_text_html_large.png index 3813d2582a..62802369c8 100644 Binary files a/app/assets/images/icon_text_html_large.png and b/app/assets/images/icon_text_html_large.png differ diff --git a/app/assets/images/icon_text_plain_large.png b/app/assets/images/icon_text_plain_large.png index f15b0dbdc7..e6ebd953df 100644 Binary files a/app/assets/images/icon_text_plain_large.png and b/app/assets/images/icon_text_plain_large.png differ diff --git a/app/assets/images/icon_text_x-vcard_large.png b/app/assets/images/icon_text_x-vcard_large.png index 804066af88..138841cde9 100644 Binary files a/app/assets/images/icon_text_x-vcard_large.png and b/app/assets/images/icon_text_x-vcard_large.png differ diff --git a/app/assets/images/icon_unknown.png b/app/assets/images/icon_unknown.png index 9a06d9baaa..2181d7e0fd 100644 Binary files a/app/assets/images/icon_unknown.png and b/app/assets/images/icon_unknown.png differ diff --git a/app/assets/images/link-icon.png b/app/assets/images/link-icon.png index 7d9237fcd1..b56ab8f0cd 100644 Binary files a/app/assets/images/link-icon.png and b/app/assets/images/link-icon.png differ diff --git a/app/assets/images/littlehand.png b/app/assets/images/littlehand.png index f7ec820455..17f3d16186 100644 Binary files a/app/assets/images/littlehand.png and b/app/assets/images/littlehand.png differ diff --git a/app/assets/images/loader-000-on-fff-16px.gif b/app/assets/images/loader-000-on-fff-16px.gif new file mode 100644 index 0000000000..d44cf73a17 Binary files /dev/null and b/app/assets/images/loader-000-on-fff-16px.gif differ diff --git a/app/assets/images/medium-16.png b/app/assets/images/medium-16.png new file mode 100644 index 0000000000..f50aa97063 Binary files /dev/null and b/app/assets/images/medium-16.png differ diff --git a/app/assets/images/medium-32.png b/app/assets/images/medium-32.png new file mode 100644 index 0000000000..df6da72d94 Binary files /dev/null and b/app/assets/images/medium-32.png differ diff --git a/app/assets/images/navimg/alaveteli-logo-header.png b/app/assets/images/navimg/alaveteli-logo-header.png index 49b5297181..c53a68cc2c 100644 Binary files a/app/assets/images/navimg/alaveteli-logo-header.png and b/app/assets/images/navimg/alaveteli-logo-header.png differ diff --git a/app/assets/images/navimg/alaveteli-logo.png b/app/assets/images/navimg/alaveteli-logo.png index ce9abdd3db..758e95296c 100644 Binary files a/app/assets/images/navimg/alaveteli-logo.png and b/app/assets/images/navimg/alaveteli-logo.png differ diff --git a/app/assets/images/navimg/auth-icon.png b/app/assets/images/navimg/auth-icon.png index 6eaa229bfe..c94aefdea9 100644 Binary files a/app/assets/images/navimg/auth-icon.png and b/app/assets/images/navimg/auth-icon.png differ diff --git a/app/assets/images/navimg/bnnr-ifyoudontask-24bit.png b/app/assets/images/navimg/bnnr-ifyoudontask-24bit.png index 5c87bdab4b..f68dd5ea04 100644 Binary files a/app/assets/images/navimg/bnnr-ifyoudontask-24bit.png and b/app/assets/images/navimg/bnnr-ifyoudontask-24bit.png differ diff --git a/app/assets/images/navimg/bnnr-ifyoudontask.png b/app/assets/images/navimg/bnnr-ifyoudontask.png index f577778e13..b4cff2b8fd 100644 Binary files a/app/assets/images/navimg/bnnr-ifyoudontask.png and b/app/assets/images/navimg/bnnr-ifyoudontask.png differ diff --git a/app/assets/images/navimg/bnnr-temp-100px.jpg b/app/assets/images/navimg/bnnr-temp-100px.jpg index baf03585e6..28330dd07f 100644 Binary files a/app/assets/images/navimg/bnnr-temp-100px.jpg and b/app/assets/images/navimg/bnnr-temp-100px.jpg differ diff --git a/app/assets/images/navimg/bnnr-temp-100pxa.jpg b/app/assets/images/navimg/bnnr-temp-100pxa.jpg index f95a4d9f52..414cd2e4a4 100644 Binary files a/app/assets/images/navimg/bnnr-temp-100pxa.jpg and b/app/assets/images/navimg/bnnr-temp-100pxa.jpg differ diff --git a/app/assets/images/navimg/bnnr-temp-100pxb.jpg b/app/assets/images/navimg/bnnr-temp-100pxb.jpg index f09f5c838e..42e1cbd3ad 100644 Binary files a/app/assets/images/navimg/bnnr-temp-100pxb.jpg and b/app/assets/images/navimg/bnnr-temp-100pxb.jpg differ diff --git a/app/assets/images/navimg/bnnr-temp-100pxc.jpg b/app/assets/images/navimg/bnnr-temp-100pxc.jpg index e83ec90edb..e39596cbb1 100755 Binary files a/app/assets/images/navimg/bnnr-temp-100pxc.jpg and b/app/assets/images/navimg/bnnr-temp-100pxc.jpg differ diff --git a/app/assets/images/navimg/bnnr-temp-100pxd.jpg b/app/assets/images/navimg/bnnr-temp-100pxd.jpg index 105b97a199..c7dfae88e2 100755 Binary files a/app/assets/images/navimg/bnnr-temp-100pxd.jpg and b/app/assets/images/navimg/bnnr-temp-100pxd.jpg differ diff --git a/app/assets/images/navimg/bnnr-temp.jpg b/app/assets/images/navimg/bnnr-temp.jpg index abcc0bcfce..3642d241f4 100644 Binary files a/app/assets/images/navimg/bnnr-temp.jpg and b/app/assets/images/navimg/bnnr-temp.jpg differ diff --git a/app/assets/images/navimg/infobug20px.png b/app/assets/images/navimg/infobug20px.png index f9cc70694b..0dda6a764e 100644 Binary files a/app/assets/images/navimg/infobug20px.png and b/app/assets/images/navimg/infobug20px.png differ diff --git a/app/assets/images/navimg/logo-trans-small.png b/app/assets/images/navimg/logo-trans-small.png index fde1d1e516..ddbbfc8a1f 100644 Binary files a/app/assets/images/navimg/logo-trans-small.png and b/app/assets/images/navimg/logo-trans-small.png differ diff --git a/app/assets/images/navimg/logo-trans.png b/app/assets/images/navimg/logo-trans.png index 320a52efda..51e951bd12 100644 Binary files a/app/assets/images/navimg/logo-trans.png and b/app/assets/images/navimg/logo-trans.png differ diff --git a/app/assets/images/navimg/mysoc-logo-header.png b/app/assets/images/navimg/mysoc-logo-header.png index ad813926ab..0c28441456 100755 Binary files a/app/assets/images/navimg/mysoc-logo-header.png and b/app/assets/images/navimg/mysoc-logo-header.png differ diff --git a/app/assets/images/navimg/mysoc-logo-small.png b/app/assets/images/navimg/mysoc-logo-small.png index 1d644924c5..34f14fc466 100644 Binary files a/app/assets/images/navimg/mysoc-logo-small.png and b/app/assets/images/navimg/mysoc-logo-small.png differ diff --git a/app/assets/images/navimg/quote-open-small.png b/app/assets/images/navimg/quote-open-small.png index 46edaa8501..75389ff79d 100755 Binary files a/app/assets/images/navimg/quote-open-small.png and b/app/assets/images/navimg/quote-open-small.png differ diff --git a/app/assets/images/navimg/quote-open.png b/app/assets/images/navimg/quote-open.png index 7e8858265c..46e15cdbab 100644 Binary files a/app/assets/images/navimg/quote-open.png and b/app/assets/images/navimg/quote-open.png differ diff --git a/app/assets/images/navimg/request-icon.png b/app/assets/images/navimg/request-icon.png index 9f2854d0e8..501ded6616 100644 Binary files a/app/assets/images/navimg/request-icon.png and b/app/assets/images/navimg/request-icon.png differ diff --git a/app/assets/images/navimg/status-icons-attn.png b/app/assets/images/navimg/status-icons-attn.png index 6a543c5da5..b09dd91394 100644 Binary files a/app/assets/images/navimg/status-icons-attn.png and b/app/assets/images/navimg/status-icons-attn.png differ diff --git a/app/assets/images/navimg/status-icons-error-message.png b/app/assets/images/navimg/status-icons-error-message.png index 03ddd60b77..7f2cd60f3b 100644 Binary files a/app/assets/images/navimg/status-icons-error-message.png and b/app/assets/images/navimg/status-icons-error-message.png differ diff --git a/app/assets/images/navimg/status-icons-fail.png b/app/assets/images/navimg/status-icons-fail.png index 57529237c1..554cf22cd0 100644 Binary files a/app/assets/images/navimg/status-icons-fail.png and b/app/assets/images/navimg/status-icons-fail.png differ diff --git a/app/assets/images/navimg/status-icons-internal-review.png b/app/assets/images/navimg/status-icons-internal-review.png index 44fe2fdb3d..1d90853898 100644 Binary files a/app/assets/images/navimg/status-icons-internal-review.png and b/app/assets/images/navimg/status-icons-internal-review.png differ diff --git a/app/assets/images/navimg/status-icons-not-held.png b/app/assets/images/navimg/status-icons-not-held.png index 1225a3db31..cc4f762ffe 100644 Binary files a/app/assets/images/navimg/status-icons-not-held.png and b/app/assets/images/navimg/status-icons-not-held.png differ diff --git a/app/assets/images/navimg/status-icons-post.png b/app/assets/images/navimg/status-icons-post.png index 56b9b9fa9c..dd2ce95593 100755 Binary files a/app/assets/images/navimg/status-icons-post.png and b/app/assets/images/navimg/status-icons-post.png differ diff --git a/app/assets/images/navimg/status-icons-succeed.png b/app/assets/images/navimg/status-icons-succeed.png index 8f3bba9857..3039f25833 100644 Binary files a/app/assets/images/navimg/status-icons-succeed.png and b/app/assets/images/navimg/status-icons-succeed.png differ diff --git a/app/assets/images/navimg/status-icons-user-withdrawn.png b/app/assets/images/navimg/status-icons-user-withdrawn.png index fa4e278ff5..b476c82cc8 100644 Binary files a/app/assets/images/navimg/status-icons-user-withdrawn.png and b/app/assets/images/navimg/status-icons-user-withdrawn.png differ diff --git a/app/assets/images/navimg/status-icons-wait.png b/app/assets/images/navimg/status-icons-wait.png index a264f06f5c..3cb2472880 100644 Binary files a/app/assets/images/navimg/status-icons-wait.png and b/app/assets/images/navimg/status-icons-wait.png differ diff --git a/app/assets/images/navimg/user-icon.png b/app/assets/images/navimg/user-icon.png index dfaf5525da..45cfe668c4 100644 Binary files a/app/assets/images/navimg/user-icon.png and b/app/assets/images/navimg/user-icon.png differ diff --git a/app/assets/images/next-step-facebook.png b/app/assets/images/next-step-facebook.png index c01fa6ced1..cfb09b606c 100644 Binary files a/app/assets/images/next-step-facebook.png and b/app/assets/images/next-step-facebook.png differ diff --git a/app/assets/images/next-step-twitter.png b/app/assets/images/next-step-twitter.png index e79255bd6b..661e5f936a 100644 Binary files a/app/assets/images/next-step-twitter.png and b/app/assets/images/next-step-twitter.png differ diff --git a/app/assets/images/petitions.png b/app/assets/images/petitions.png index 204e12b773..4c943ebb50 100644 Binary files a/app/assets/images/petitions.png and b/app/assets/images/petitions.png differ diff --git a/app/assets/images/pledgebank.png b/app/assets/images/pledgebank.png index 0f0a8f235c..b208cdc8d0 100644 Binary files a/app/assets/images/pledgebank.png and b/app/assets/images/pledgebank.png differ diff --git a/app/assets/images/quote-marks.png b/app/assets/images/quote-marks.png index e2bdfb06d1..66ac6c3b44 100644 Binary files a/app/assets/images/quote-marks.png and b/app/assets/images/quote-marks.png differ diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png index b8441f182e..256bfd709b 100644 Binary files a/app/assets/images/rails.png and b/app/assets/images/rails.png differ diff --git a/app/assets/images/rss-16.png b/app/assets/images/rss-16.png index d61986a56c..81e94f969b 100644 Binary files a/app/assets/images/rss-16.png and b/app/assets/images/rss-16.png differ diff --git a/app/assets/images/rss-blue.png b/app/assets/images/rss-blue.png index abc1b18598..ceb8f2fe4e 100644 Binary files a/app/assets/images/rss-blue.png and b/app/assets/images/rss-blue.png differ diff --git a/app/assets/images/rss-orange.png b/app/assets/images/rss-orange.png index d0e6a949e4..73355a2a84 100644 Binary files a/app/assets/images/rss-orange.png and b/app/assets/images/rss-orange.png differ diff --git a/app/assets/images/rss.png b/app/assets/images/rss.png index a88ac93f58..4f571caeaf 100644 Binary files a/app/assets/images/rss.png and b/app/assets/images/rss.png differ diff --git a/app/assets/images/search-button.png b/app/assets/images/search-button.png index f5d41d4f12..8490fd9339 100644 Binary files a/app/assets/images/search-button.png and b/app/assets/images/search-button.png differ diff --git a/app/assets/images/search.png b/app/assets/images/search.png index 9e427ba946..e87ccbabc6 100644 Binary files a/app/assets/images/search.png and b/app/assets/images/search.png differ diff --git a/app/assets/images/small-green-cross.png b/app/assets/images/small-green-cross.png index 5868f5775d..034fcab215 100644 Binary files a/app/assets/images/small-green-cross.png and b/app/assets/images/small-green-cross.png differ diff --git a/app/assets/images/small-white-cross.png b/app/assets/images/small-white-cross.png index 3f78064d22..88660b27d1 100644 Binary files a/app/assets/images/small-white-cross.png and b/app/assets/images/small-white-cross.png differ diff --git a/app/assets/images/social-facebook.png b/app/assets/images/social-facebook.png index fcc26f6653..3f98e184dc 100644 Binary files a/app/assets/images/social-facebook.png and b/app/assets/images/social-facebook.png differ diff --git a/app/assets/images/social-facebook@2.png b/app/assets/images/social-facebook@2.png index c74938cde3..6f033c3d85 100644 Binary files a/app/assets/images/social-facebook@2.png and b/app/assets/images/social-facebook@2.png differ diff --git a/app/assets/images/social-twitter.png b/app/assets/images/social-twitter.png index 3357084218..06293c6805 100644 Binary files a/app/assets/images/social-twitter.png and b/app/assets/images/social-twitter.png differ diff --git a/app/assets/images/social-twitter@2.png b/app/assets/images/social-twitter@2.png index 038ef7136d..7d63835da5 100644 Binary files a/app/assets/images/social-twitter@2.png and b/app/assets/images/social-twitter@2.png differ diff --git a/app/assets/images/start-button.png b/app/assets/images/start-button.png index 585931c350..eca9dc615c 100644 Binary files a/app/assets/images/start-button.png and b/app/assets/images/start-button.png differ diff --git a/app/assets/images/status-complete.png b/app/assets/images/status-complete.png index 2ff49770a3..9e00d56676 100644 Binary files a/app/assets/images/status-complete.png and b/app/assets/images/status-complete.png differ diff --git a/app/assets/images/status-denied.png b/app/assets/images/status-denied.png index 1f768af5e5..3412df291b 100644 Binary files a/app/assets/images/status-denied.png and b/app/assets/images/status-denied.png differ diff --git a/app/assets/images/status-error.png b/app/assets/images/status-error.png index 5865dd1e11..ee42e8e1d8 100644 Binary files a/app/assets/images/status-error.png and b/app/assets/images/status-error.png differ diff --git a/app/assets/images/status-gone-postal.png b/app/assets/images/status-gone-postal.png index 00df771ac0..a113933ace 100644 Binary files a/app/assets/images/status-gone-postal.png and b/app/assets/images/status-gone-postal.png differ diff --git a/app/assets/images/status-internal-review.png b/app/assets/images/status-internal-review.png index 639f727977..22c06c459f 100644 Binary files a/app/assets/images/status-internal-review.png and b/app/assets/images/status-internal-review.png differ diff --git a/app/assets/images/status-not-held.png b/app/assets/images/status-not-held.png index 9d20ac2e7e..b40419e000 100644 Binary files a/app/assets/images/status-not-held.png and b/app/assets/images/status-not-held.png differ diff --git a/app/assets/images/status-overdue.png b/app/assets/images/status-overdue.png index 637fed8d96..210b5ac0d2 100644 Binary files a/app/assets/images/status-overdue.png and b/app/assets/images/status-overdue.png differ diff --git a/app/assets/images/status-pending.png b/app/assets/images/status-pending.png index dcf4009f3e..9d5043a924 100644 Binary files a/app/assets/images/status-pending.png and b/app/assets/images/status-pending.png differ diff --git a/app/assets/images/status-withdrawn.png b/app/assets/images/status-withdrawn.png index d56aa213f6..f4b36c6e5f 100644 Binary files a/app/assets/images/status-withdrawn.png and b/app/assets/images/status-withdrawn.png differ diff --git a/app/assets/images/status/classification.png b/app/assets/images/status/classification.png index dcf4009f3e..9d5043a924 100644 Binary files a/app/assets/images/status/classification.png and b/app/assets/images/status/classification.png differ diff --git a/app/assets/images/status/classification@2x.png b/app/assets/images/status/classification@2x.png index dcf4009f3e..9d5043a924 100644 Binary files a/app/assets/images/status/classification@2x.png and b/app/assets/images/status/classification@2x.png differ diff --git a/app/assets/images/status/delayed.png b/app/assets/images/status/delayed.png index 637fed8d96..210b5ac0d2 100644 Binary files a/app/assets/images/status/delayed.png and b/app/assets/images/status/delayed.png differ diff --git a/app/assets/images/status/delayed@2x.png b/app/assets/images/status/delayed@2x.png index 637fed8d96..210b5ac0d2 100644 Binary files a/app/assets/images/status/delayed@2x.png and b/app/assets/images/status/delayed@2x.png differ diff --git a/app/assets/images/status/delivery_error.png b/app/assets/images/status/delivery_error.png index 5865dd1e11..ee42e8e1d8 100644 Binary files a/app/assets/images/status/delivery_error.png and b/app/assets/images/status/delivery_error.png differ diff --git a/app/assets/images/status/delivery_error@2x.png b/app/assets/images/status/delivery_error@2x.png index 5865dd1e11..ee42e8e1d8 100644 Binary files a/app/assets/images/status/delivery_error@2x.png and b/app/assets/images/status/delivery_error@2x.png differ diff --git a/app/assets/images/status/notheld.png b/app/assets/images/status/notheld.png index 9d20ac2e7e..b40419e000 100644 Binary files a/app/assets/images/status/notheld.png and b/app/assets/images/status/notheld.png differ diff --git a/app/assets/images/status/notheld@2x.png b/app/assets/images/status/notheld@2x.png index 9d20ac2e7e..b40419e000 100644 Binary files a/app/assets/images/status/notheld@2x.png and b/app/assets/images/status/notheld@2x.png differ diff --git a/app/assets/images/status/overdue.png b/app/assets/images/status/overdue.png index 637fed8d96..210b5ac0d2 100644 Binary files a/app/assets/images/status/overdue.png and b/app/assets/images/status/overdue.png differ diff --git a/app/assets/images/status/overdue@2x.png b/app/assets/images/status/overdue@2x.png index 637fed8d96..210b5ac0d2 100644 Binary files a/app/assets/images/status/overdue@2x.png and b/app/assets/images/status/overdue@2x.png differ diff --git a/app/assets/images/status/partiallysuccessful.png b/app/assets/images/status/partiallysuccessful.png index 2ff49770a3..9e00d56676 100644 Binary files a/app/assets/images/status/partiallysuccessful.png and b/app/assets/images/status/partiallysuccessful.png differ diff --git a/app/assets/images/status/partiallysuccessful@2x.png b/app/assets/images/status/partiallysuccessful@2x.png index 2ff49770a3..9e00d56676 100644 Binary files a/app/assets/images/status/partiallysuccessful@2x.png and b/app/assets/images/status/partiallysuccessful@2x.png differ diff --git a/app/assets/images/status/postal.png b/app/assets/images/status/postal.png index 00df771ac0..a113933ace 100644 Binary files a/app/assets/images/status/postal.png and b/app/assets/images/status/postal.png differ diff --git a/app/assets/images/status/postal@2x.png b/app/assets/images/status/postal@2x.png index 00df771ac0..a113933ace 100644 Binary files a/app/assets/images/status/postal@2x.png and b/app/assets/images/status/postal@2x.png differ diff --git a/app/assets/images/status/refused.png b/app/assets/images/status/refused.png index 1f768af5e5..3412df291b 100644 Binary files a/app/assets/images/status/refused.png and b/app/assets/images/status/refused.png differ diff --git a/app/assets/images/status/refused@2x.png b/app/assets/images/status/refused@2x.png index 1f768af5e5..3412df291b 100644 Binary files a/app/assets/images/status/refused@2x.png and b/app/assets/images/status/refused@2x.png differ diff --git a/app/assets/images/status/reported.png b/app/assets/images/status/reported.png index 9d20ac2e7e..b40419e000 100644 Binary files a/app/assets/images/status/reported.png and b/app/assets/images/status/reported.png differ diff --git a/app/assets/images/status/reported@2x.png b/app/assets/images/status/reported@2x.png index 9d20ac2e7e..b40419e000 100644 Binary files a/app/assets/images/status/reported@2x.png and b/app/assets/images/status/reported@2x.png differ diff --git a/app/assets/images/status/review.png b/app/assets/images/status/review.png index 639f727977..22c06c459f 100644 Binary files a/app/assets/images/status/review.png and b/app/assets/images/status/review.png differ diff --git a/app/assets/images/status/review@2x.png b/app/assets/images/status/review@2x.png index 639f727977..22c06c459f 100644 Binary files a/app/assets/images/status/review@2x.png and b/app/assets/images/status/review@2x.png differ diff --git a/app/assets/images/status/successful.png b/app/assets/images/status/successful.png index 2ff49770a3..9e00d56676 100644 Binary files a/app/assets/images/status/successful.png and b/app/assets/images/status/successful.png differ diff --git a/app/assets/images/status/successful@2x.png b/app/assets/images/status/successful@2x.png index 2ff49770a3..9e00d56676 100644 Binary files a/app/assets/images/status/successful@2x.png and b/app/assets/images/status/successful@2x.png differ diff --git a/app/assets/images/status/unusual.png b/app/assets/images/status/unusual.png index 637fed8d96..210b5ac0d2 100644 Binary files a/app/assets/images/status/unusual.png and b/app/assets/images/status/unusual.png differ diff --git a/app/assets/images/status/unusual@2x.png b/app/assets/images/status/unusual@2x.png index 637fed8d96..210b5ac0d2 100644 Binary files a/app/assets/images/status/unusual@2x.png and b/app/assets/images/status/unusual@2x.png differ diff --git a/app/assets/images/status/waiting.png b/app/assets/images/status/waiting.png index dcf4009f3e..9d5043a924 100644 Binary files a/app/assets/images/status/waiting.png and b/app/assets/images/status/waiting.png differ diff --git a/app/assets/images/status/waiting@2x.png b/app/assets/images/status/waiting@2x.png index dcf4009f3e..9d5043a924 100644 Binary files a/app/assets/images/status/waiting@2x.png and b/app/assets/images/status/waiting@2x.png differ diff --git a/app/assets/images/status/withdrawn.png b/app/assets/images/status/withdrawn.png index d56aa213f6..f4b36c6e5f 100644 Binary files a/app/assets/images/status/withdrawn.png and b/app/assets/images/status/withdrawn.png differ diff --git a/app/assets/images/status/withdrawn@2x.png b/app/assets/images/status/withdrawn@2x.png index d56aa213f6..f4b36c6e5f 100644 Binary files a/app/assets/images/status/withdrawn@2x.png and b/app/assets/images/status/withdrawn@2x.png differ diff --git a/app/assets/images/stripes-70-light.png b/app/assets/images/stripes-70-light.png index 7a0ee575de..be98031d28 100644 Binary files a/app/assets/images/stripes-70-light.png and b/app/assets/images/stripes-70-light.png differ diff --git a/app/assets/images/stripes-70-light2.png b/app/assets/images/stripes-70-light2.png index 443442a486..c31fd9294d 100644 Binary files a/app/assets/images/stripes-70-light2.png and b/app/assets/images/stripes-70-light2.png differ diff --git a/app/assets/images/stripes-70.png b/app/assets/images/stripes-70.png index fda1c339d3..da1b48d21f 100644 Binary files a/app/assets/images/stripes-70.png and b/app/assets/images/stripes-70.png differ diff --git a/app/assets/images/stripes.png b/app/assets/images/stripes.png index fda1c339d3..da1b48d21f 100644 Binary files a/app/assets/images/stripes.png and b/app/assets/images/stripes.png differ diff --git a/app/assets/images/twitter.png b/app/assets/images/twitter.png index 6589824afb..31cd6c50bb 100644 Binary files a/app/assets/images/twitter.png and b/app/assets/images/twitter.png differ diff --git a/app/assets/images/ui-icons-theme.png b/app/assets/images/ui-icons-theme.png index f619648da1..2e8e246aaf 100644 Binary files a/app/assets/images/ui-icons-theme.png and b/app/assets/images/ui-icons-theme.png differ diff --git a/app/assets/images/widget-base.png b/app/assets/images/widget-base.png index 8722445436..89c85c6036 100644 Binary files a/app/assets/images/widget-base.png and b/app/assets/images/widget-base.png differ diff --git a/app/assets/images/widget.png b/app/assets/images/widget.png index 13b5be7c03..df84e12584 100644 Binary files a/app/assets/images/widget.png and b/app/assets/images/widget.png differ diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index 9402f7f6cd..e2847a8ee9 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -1,8 +1,8 @@ // ... //= require jquery -//= require jquery.ui.tabs -//= require jquery.ui.sortable -//= require jquery.ui.effect-highlight +//= require jquery-ui/tabs +//= require jquery-ui/sortable +//= require jquery-ui/effect-highlight //= require bootstrap-collapse //= require bootstrap-tab //= require bootstrap-dropdown diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index fd49d3b538..e8f074911e 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,8 +1,8 @@ // ... //= require jquery //= require jquery_ujs -//= require jquery.ui.datepicker -//= require jquery.ui.position +//= require jquery-ui/datepicker +//= require jquery-ui/position //= require jquery.cookie //= require general //= require ba-throttle-debounce diff --git a/app/assets/javascripts/general.js b/app/assets/javascripts/general.js index 639a6917b7..fc4224ad45 100644 --- a/app/assets/javascripts/general.js +++ b/app/assets/javascripts/general.js @@ -65,4 +65,51 @@ $(document).ready(function() { $this.unbind("mouseup"); return false; }); + + $('.js-toggle-delivery-log').on('click', function(e){ + e.preventDefault(); + + var $correspondence = $(this).parents('.correspondence'); + var url = $(this).attr('href'); + var $correspondence_delivery = $correspondence.find('.correspondence_delivery'); + + if( $correspondence_delivery.length ){ + removeCorrespondenceDeliveryBox($correspondence_delivery); + } else { + loadCorrespondenceDeliveryBox($correspondence, url); + } + }); + + var loadCorrespondenceDeliveryBox = function loadCorrespondenceDeliveryBox($correspondence, url){ + var $toggle = $correspondence.find('.js-toggle-delivery-log'); + var $correspondence_delivery = $('
{{site_name}} is currently in maintenance. You can only view existing requests. You cannot make new ones, add followups or annotations, or otherwise change the database.
{{read_only}}
", - :site_name => site_name, - :read_only => AlaveteliConfiguration::read_only) + if AlaveteliConfiguration::enable_annotations + flash[:notice] = _("{{site_name}} is currently in maintenance. You can only view existing requests. You cannot make new ones, add followups or annotations, or otherwise change the database.
{{read_only}}
", + :site_name => site_name, + :read_only => AlaveteliConfiguration::read_only) + else + flash[:notice] = _("{{site_name}} is currently in maintenance. You can only view existing requests. You cannot make new ones, add followups or otherwise change the database.
{{read_only}}
", + :site_name => site_name, + :read_only => AlaveteliConfiguration::read_only) + end redirect_to frontpage_url end diff --git a/app/controllers/comment_controller.rb b/app/controllers/comment_controller.rb index 93eacd8242..118bf8030f 100644 --- a/app/controllers/comment_controller.rb +++ b/app/controllers/comment_controller.rb @@ -90,12 +90,13 @@ def create_track_thing @track_thing = TrackThing.create_track_for_request(@info_request) end - # Are comments disabled on this request? + # Are comments disabled on this request, or globally? # # There is no “add comment” link when comments are disabled, so users should - # not usually hit this unless they are explicitly attempting to avoid the comment block + # not usually hit this unless they are explicitly attempting to avoid the + # comment block. def reject_unless_comments_allowed - unless @info_request.comments_allowed? + unless AlaveteliConfiguration.enable_annotations && @info_request.comments_allowed? redirect_to request_url(@info_request), :notice => "Comments are not allowed on this request" end end diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb index 518f88fcbe..3365a5442a 100644 --- a/app/controllers/general_controller.rb +++ b/app/controllers/general_controller.rb @@ -24,6 +24,8 @@ def frontpage @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => _('Successful requests'), :has_json => true } ] + + respond_to :html end # Display blog entries @@ -53,6 +55,8 @@ def blog end end @twitter_user = AlaveteliConfiguration::twitter_username + + respond_to :html end # Just does a redirect from ?query= search to /query @@ -77,6 +81,13 @@ def search_redirect def search # TODO: Why is this so complicated with arrays and stuff? Look at the route # in config/routes.rb for comments. + + # respond with a 404 and do not execute the search if request was not for html + if request.format && !request.format.html? + respond_to { |format| format.any { head :not_found } } + return + end + combined = params[:combined].split("/") @sortby = nil @bodies = @requests = @users = true diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index a36db0f26b..b20714ae19 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -79,8 +79,10 @@ def contact private def catch_spam - if request.post? && !params[:contact][:comment].empty? - redirect_to frontpage_url + if request.post? && params[:contact] + if !params[:contact][:comment].blank? || !params[:contact].key?(:comment) + redirect_to frontpage_url + end end end diff --git a/app/controllers/outgoing_messages/delivery_statuses_controller.rb b/app/controllers/outgoing_messages/delivery_statuses_controller.rb new file mode 100644 index 0000000000..14c32f91be --- /dev/null +++ b/app/controllers/outgoing_messages/delivery_statuses_controller.rb @@ -0,0 +1,35 @@ +# -*- encoding : utf-8 -*- +class OutgoingMessages::DeliveryStatusesController < ApplicationController + before_filter :set_outgoing_message, :check_prominence + + def show + @title = _('Delivery Status for Outgoing Message #{{id}}', + :id => @outgoing_message.id) + + @delivery_status = @outgoing_message.delivery_status + + @show_mail_server_logs = @outgoing_message.is_owning_user?(@user) + + if @show_mail_server_logs + @mail_server_logs = @outgoing_message.mail_server_logs.map do |log| + log.line(:redact_idhash => !@user.super?) + end + end + + respond_to :html + end + + protected + + def set_outgoing_message + @outgoing_message = OutgoingMessage.find(params[:outgoing_message_id]) + end + + def check_prominence + unless @outgoing_message.user_can_view?(@user) && + @outgoing_message.info_request.user_can_view?(@user) + return render_hidden('request/_hidden_correspondence', + :locals => { :message => @outgoing_message }) + end + end +end diff --git a/app/controllers/password_changes_controller.rb b/app/controllers/password_changes_controller.rb index b5236a7168..5d93cb6ef5 100644 --- a/app/controllers/password_changes_controller.rb +++ b/app/controllers/password_changes_controller.rb @@ -16,6 +16,12 @@ def new end def create + unless @user || params[:password_change_user] + @email_field_options = {} + render :new + return + end + email = @user ? @user.email : params[:password_change_user][:email] unless MySociety::Validate.is_valid_email(email) diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index a0b5535aa9..052862c6aa 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -158,19 +158,6 @@ def list where_parameters.concat [@tag] end - if @tag == 'all' - @description = '' - elsif @tag.size == 1 - @description = _("beginning with ‘{{first_letter}}’", :first_letter => @tag) - else - category_name = PublicBodyCategory.get.by_tag[@tag] - if category_name.nil? - @description = _("matching the tag ‘{{tag_name}}’", :tag_name => @tag) - else - @description = _("in the category ‘{{category_name}}’", :category_name => category_name) - end - end - I18n.with_locale(@locale) do if AlaveteliConfiguration::public_body_list_fallback_to_default_locale @@ -224,6 +211,41 @@ def list end end + @description = + if @tag == 'all' + n_('Found {{count}} public authority', + 'Found {{count}} public authorities', + @public_bodies.total_entries, + :count => @public_bodies.total_entries) + elsif @tag.size == 1 + n_('Found {{count}} public authority beginning with ' \ + '‘{{first_letter}}’', + 'Found {{count}} public authorities beginning with ' \ + '‘{{first_letter}}’', + @public_bodies.total_entries, + :count => @public_bodies.total_entries, + :first_letter => @tag) + else + category_name = PublicBodyCategory.get.by_tag[@tag] + if category_name.nil? + n_('Found {{count}} public authority matching the tag ' \ + '‘{{tag_name}}’', + 'Found {{count}} public authorities matching the tag ' \ + '‘{{tag_name}}’', + @public_bodies.total_entries, + :count => @public_bodies.total_entries, + :tag_name => @tag) + else + n_('Found {{count}} public authority in the category ' \ + '‘{{category_name}}’', + 'Found {{count}} public authorities in the category ' \ + '‘{{category_name}}’', + @public_bodies.total_entries, + :count => @public_bodies.total_entries, + :category_name => category_name) + end + end + respond_to do |format| format.html { render :template => 'public_body/list' } end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index c47d70bba6..12133cb3c0 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/request_controller.rb @@ -167,6 +167,12 @@ def similar end def list + # respond with a 404 without a database lookup if request was not for html + if request.format && !request.format.html? + respond_to { |format| format.any { head :not_found } } + return + end + medium_cache @view = params[:view] @locale = I18n.locale.to_s @@ -782,6 +788,7 @@ def assign_variables_for_show_template(info_request) @new_responses_count = info_request.events_needing_description.select {|i| i.event_type == 'response'}.size # For send followup link at bottom @last_response = info_request.get_last_public_response + @follower_count = @info_request.track_things.count + 1 end def make_request_zip(info_request, file_path) @@ -925,12 +932,12 @@ def render_new_preview "request in order to get a reply, as we will ask " \ "for it on the next screen (" \ "details).", - :url => (help_privacy_path+"#email_address").html_safe) + :url => (help_privacy_path(:anchor => "email_address")).html_safe) else message += _("You do not need to include your email in the " \ "request in order to get a reply (" \ "details).
", - :url => (help_privacy_path+"#email_address").html_safe) + :url => (help_privacy_path(:anchor => "email_address")).html_safe) end message += _("We recommend that you edit your request and remove " \ "the email address. If you leave it, the email address " \ diff --git a/app/controllers/request_game_controller.rb b/app/controllers/request_game_controller.rb index 5b22561e0b..b48f99708f 100644 --- a/app/controllers/request_game_controller.rb +++ b/app/controllers/request_game_controller.rb @@ -10,16 +10,23 @@ class RequestGameController < ApplicationController def play session[:request_game] = Time.now - @missing = InfoRequest.count_old_unclassified(:conditions => ["prominence = 'normal'"]) + @missing = InfoRequest. + where_old_unclassified. + where(:prominence => 'normal'). + count @total = InfoRequest.count @done = @total - @missing @percentage = (@done.to_f / @total.to_f * 10000).round / 100.0 - @requests = InfoRequest.includes(:public_body, :user).get_random_old_unclassified(3, :conditions => ["prominence = 'normal'"]) - + @requests = InfoRequest. + includes(:public_body, :user). + where_old_unclassified. + limit(3). + where(:prominence => 'normal'). + order('random()') if @missing == 0 flash[:notice] = _('
All done! Thank you very much for your help.
There are more things you can do to help {{site_name}}.
', - :helpus_url => help_credits_path+"#helpus", + :helpus_url => help_credits_path(:anchor => "helpus"), :site_name => site_name) end diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb index 264f9f1f09..17aaf5cd09 100644 --- a/app/controllers/track_controller.rb +++ b/app/controllers/track_controller.rb @@ -220,10 +220,9 @@ def delete_all_type track_type = params[:track_type] flash[:notice] = _("You will no longer be emailed updates for those alerts") - for track_thing in TrackThing.find(:all, :conditions => [ "track_type = ? and tracking_user_id = ?", track_type, user_id ]) - track_thing.destroy - end - + TrackThing. + where(:track_type => track_type, :tracking_user_id => user_id). + destroy_all redirect_to URI.parse(params[:r]).path end diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 8a074faf50..80b0d1be31 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -62,7 +62,10 @@ def wall # All tracks for the user if @is_you - @track_things = TrackThing.find(:all, :conditions => ["tracking_user_id = ? and track_medium = ?", @display_user.id, 'email_daily'], :order => 'created_at desc') + @track_things = TrackThing. + where(:tracking_user_id => @display_user.id, + :track_medium => 'email_daily'). + order('created_at desc') @track_things.each do |track_thing| # TODO: factor out of track_mailer.rb xapian_object = ActsAsXapian::Search.new([InfoRequestEvent], track_thing.track_query, @@ -133,10 +136,10 @@ def signin # Create new account form def signup work_out_post_redirect - @request_from_foreign_country = country_from_ip != AlaveteliConfiguration::iso_country_code # Make the user and try to save it @user_signup = User.new(user_params(:user_signup)) error = false + @request_from_foreign_country = country_from_ip != AlaveteliConfiguration::iso_country_code if @request_from_foreign_country && !verify_recaptcha flash.now[:error] = _("There was an error with the words you entered, please try again.") error = true @@ -390,7 +393,7 @@ def set_profile_photo flash[:notice] = _("Thanks for updating your profile photo.
" \ "Next... You can put some text about " \ "you and your research on your profile.
") - redirect_to set_profile_about_me_url + redirect_to edit_profile_about_me_url else flash[:notice] = _("Thank you for updating your profile photo") redirect_to user_url(@user) @@ -401,9 +404,6 @@ def set_profile_photo end def clear_profile_photo - unless request.post? - raise "Can only clear profile photo from POST request" - end # check they are logged in (the upload photo option is anyway only available when logged in) if authenticated_user.nil? @@ -441,6 +441,10 @@ def get_profile_photo # Change about me text on your profile page def set_profile_about_me + warn %q([DEPRECATION] UserController#set_profile_about_me has been replaced + with UserProfile::AboutMeController and will be removed in Alaveteli + release 0.26).squish + if authenticated_user.nil? flash[:error] = _("You need to be logged in to change the text about you on your profile.") redirect_to frontpage_url diff --git a/app/controllers/user_profile/about_me_controller.rb b/app/controllers/user_profile/about_me_controller.rb new file mode 100644 index 0000000000..0c2da6be6b --- /dev/null +++ b/app/controllers/user_profile/about_me_controller.rb @@ -0,0 +1,56 @@ +# -*- encoding : utf-8 -*- +class UserProfile::AboutMeController < ApplicationController + before_filter :set_title + before_filter :check_user_logged_in + + def edit ; end + + def update + if @user.banned? + flash[:error] = _('Banned users cannot edit their profile') + redirect_to edit_profile_about_me_path + return + end + + # TODO: Use strong params to require :user key + return redirect_to user_url(@user) unless params[:user] + @user.about_me = params[:user][:about_me] + + unless @user.confirmed_not_spam? + if UserSpamScorer.new.spam?(@user) + flash[:error] = _("You can't update your profile text at this time.") + redirect_to user_url(@user) + return + end + end + + if @user.save + if @user.profile_photo + flash[:notice] = _("You have now changed the text about you on your profile.") + redirect_to user_url(@user) + else + flash[:notice] = _("Thanks for changing the text about you on your " \ + "profile.
Next... You can " \ + "upload a profile photograph too.
") + redirect_to set_profile_photo_url + end + else + render :edit + end + end + + private + + def check_user_logged_in + if authenticated_user.nil? + flash[:error] = _("You need to be logged in to change the text about you on your profile.") + redirect_to frontpage_url + return + end + end + + def set_title + @title = _('Change the text about you on your profile at {{site_name}}', + :site_name => site_name) + end +end diff --git a/app/controllers/widgets_controller.rb b/app/controllers/widgets_controller.rb index 1ff706ab3e..3ea14bd10a 100644 --- a/app/controllers/widgets_controller.rb +++ b/app/controllers/widgets_controller.rb @@ -8,9 +8,9 @@ class WidgetsController < ApplicationController before_filter :check_widget_config, :find_info_request, :check_prominence - skip_before_filter :set_x_frame_options_header, :only => [:show] def show + use_secure_headers_override(:allow_frames) medium_cache @track_thing = TrackThing.create_track_for_request(@info_request) @status = @info_request.calculate_status diff --git a/app/helpers/analytics_helper.rb b/app/helpers/analytics_helper.rb new file mode 100644 index 0000000000..40dc3bc971 --- /dev/null +++ b/app/helpers/analytics_helper.rb @@ -0,0 +1,101 @@ +# -*- encoding : utf-8 -*- +module AnalyticsHelper + + # helpers for embedding Google Analytics code + # + # Event categories and actions should be drawn from the list in the + # lib/analytics_events.rb file (add your own there when making new ones) + + + # Public: Constructs a String consisting of a Google Analytics (GA) tracking + # event function call with the (mandatory) event category and action params + # and optional label and value params. + # + # event_category - The String to be sent to GA as the tracking event category. + # Ideally this should be an AnalyticsEvent::Category::THING + # to avoid having magic strings everywhere + # event_action - The String to be sent to GA as the tracking event action. + # Ideally this should be an AnalyticsEvent::Action::THING + # to avoid having magic strings everywhere + # options - Hash of optional values, expects: + # label - String, an optional label for the event + # label_is_script - Boolean, whether to treat the label + # String as literal or browser- + # interpreted (Javascript) + # value - Integer, Google insists that a numerical + # value param is supplied if label is used; + # if you don't care about this value and + # don't want to set it, leave it blank + # and a default of 1 will be sent + # Any other supplied options will be ignored + # + # Examples + # + # track_analytics_event("test", "button clicked") + # # => "if (ga) { ga('send','event','test','button clicked') };" + # + # track_analytics_event("test", "vote button", :label => "sidebar") + # # => "if (ga) { ga('send','event','test','vote button','sidebar',1) };" + # + # track_analytics_event("test", "Points Scored", :label => "Bonus", :value => 100) + # # => "if (ga) { ga('send','event','test','Points Scored','Bonus',100) };" + # + # track_analytics_event("test", + # "Embedded", + # :label => "window.location.href", + # :label_is_script => true) + # # => "if (ga) { ga('send','event','test','Embedded',window.location.href,1) };" + # + # Returns a string of a GA JavaScript function to drop into an :onclick handler + def track_analytics_event(event_category, event_action, options={}) + begin + value = if options[:value].nil? + 1 + else + Integer(options[:value]) + end + rescue ArgumentError + raise ArgumentError, %Q(:value option must be an Integer: "#{ options[:value] }") + end + + label_is_script = options[:label_is_script] == true + label = options[:label] + if label + label_string = ",#{format_event_label(label, label_is_script)},#{value}" + end + event_args = "'#{event_category}','#{event_action}'#{label_string}" + "if (ga) { ga('send','event',#{event_args}) };" + end + + private + + # Private: Format the event label by wrapping in single quotes if it is + # going to be used as a String literal (e.g. "'Button clicked'") or without if + # it is a JavaScript string (e.g. "window.location.href") that needs to be run + # and interpreted by the browser. + # + # label - The label text (String) to by used + # is_script - Boolean indicating whether the supplied label text is intended + # to be interpreted as JavaScript by the browser (defaults + # to false) + # + # Examples + # + # format_event_label("Vote Button Clicked", false) + # # => "'Vote Button Clicked'" + # + # format_event_label("window.top.location.href", true) + # # => "window.top.location.href" + # + # Returns the label String with or without containing single quotes, + # depending on the value of the is_script param default behaviour: + # is_script is evaluated as false, string returned wrapped in single quotes) + def format_event_label(label, is_script=false) + if is_script + label + else + "'#{label}'" + end + end + +end diff --git a/app/helpers/link_to_helper.rb b/app/helpers/link_to_helper.rb index 79c8f8ab6b..07ea585bbc 100755 --- a/app/helpers/link_to_helper.rb +++ b/app/helpers/link_to_helper.rb @@ -16,7 +16,7 @@ def request_url(info_request, options = {}) end def request_path(info_request, options = {}) - request_url(info_request, {:only_path => true}.merge(options)) + request_url(info_request, options.merge(:only_path => true)) end def request_link(info_request, cls=nil) @@ -32,24 +32,24 @@ def incoming_message_url(incoming_message, options = {}) message_url(incoming_message, options) end - def incoming_message_path(incoming_message) - message_path(incoming_message) + def incoming_message_path(incoming_message, options = {}) + message_path(incoming_message, options) end def outgoing_message_url(outgoing_message, options = {}) message_url(outgoing_message, options) end - def outgoing_message_path(outgoing_message) - message_path(outgoing_message) + def outgoing_message_path(outgoing_message, options = {}) + message_path(outgoing_message, options) end def comment_url(comment, options = {}) request_url(comment.info_request, options.merge(:anchor => "comment-#{comment.id}")) end - def comment_path(comment) - comment_url(comment, :only_path => true) + def comment_path(comment, options = {}) + comment_url(comment, options.merge(:only_path => true)) end # Respond to request @@ -62,8 +62,8 @@ def respond_to_last_url(info_request, options = {}) end end - def respond_to_last_path(info_request) - respond_to_last_url(info_request, :only_path => true) + def respond_to_last_path(info_request, options = {}) + respond_to_last_url(info_request, options.merge(:only_path => true)) end # Public bodies @@ -71,8 +71,8 @@ def public_body_url(public_body, options = {}) public_body.url_name.nil? ? '' : show_public_body_url(options.merge(:url_name => public_body.url_name)) end - def public_body_path(public_body) - public_body_url(public_body, :only_path => true) + def public_body_path(public_body, options = {}) + public_body_url(public_body, options.merge(:only_path => true)) end def public_body_link_short(public_body) @@ -92,8 +92,8 @@ def user_url(user, options = {}) show_user_url(options.merge(:url_name => user.url_name)) end - def user_path(user) - user_url(user, :only_path => true) + def user_path(user, options = {}) + user_url(user, options.merge(:only_path => true)) end def user_link(user, cls=nil) @@ -201,12 +201,12 @@ def do_track_url(track_thing, feed = 'track', options = {}) end end - def do_track_path(track_thing, feed = 'track') - do_track_url(track_thing, feed, :only_path => true) + def do_track_path(track_thing, feed = 'track', options = {}) + do_track_url(track_thing, feed, options.merge(:only_path => true)) end # General pages. - def search_url(query, params = nil) + def search_url(query, options = nil) if query.kind_of?(Array) query = query - ["", nil] query = query.join("/") @@ -215,8 +215,8 @@ def search_url(query, params = nil) :action => 'search', :combined => query, :view => nil} - if !params.nil? - routing_info = params.merge(routing_info) + if !options.nil? + routing_info = options.merge(routing_info) end url = url_for(routing_info) # Here we can't escape the slashes, as RFC 2396 doesn't allow slashes @@ -242,15 +242,15 @@ def search_link(query) end # About page URLs - def about_url - return help_general_url(:action => 'about') + def about_url(options = {}) + help_general_url(options.merge(:action => 'about')) end - def unhappy_url(info_request = nil) + def unhappy_url(info_request = nil, options = {}) if info_request.nil? - return help_general_url(:action => 'unhappy') + return help_general_url(options.merge(:action => 'unhappy')) else - return help_unhappy_url(:url_title => info_request.url_title) + return help_unhappy_url(options.merge(:url_title => info_request.url_title)) end end @@ -269,8 +269,8 @@ def message_url(message, options = {}) request_url(message.info_request, options.merge(default_options)) end - def message_path(message) - message_url(message, :only_path => true) + def message_path(message, options = {}) + message_url(message, options.merge(:only_path => true)) end end diff --git a/app/helpers/public_body_helper.rb b/app/helpers/public_body_helper.rb index f097e47aa2..62f3a14972 100644 --- a/app/helpers/public_body_helper.rb +++ b/app/helpers/public_body_helper.rb @@ -47,7 +47,7 @@ def type_of_authority(public_body) if index.zero? desc = desc.sub(/\S/) { |m| Unicode.upcase(m) } end - link_to(desc, list_public_bodies_path(category.category_tag)) + link_to(desc, list_public_bodies_by_tag_path(category.category_tag)) end if types.any? diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index 3caf812c95..82184d01c2 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -11,9 +11,11 @@ def to_admin_message(name, email, subject, message, logged_in_user, last_request @message, @logged_in_user, @last_request, @last_body = message, logged_in_user, last_request, last_body # Return path is an address we control so that SPF checks are done on it. - headers('Return-Path' => blackhole_email, 'Reply-To' => MailHandler.address_from_name_and_email(name, email)) + headers('Return-Path' => blackhole_email, + 'Reply-To' => MailHandler.address_from_name_and_email(name, email)) - mail(:from => MailHandler.address_from_name_and_email(name, email), + # From is an address we control so that strict DMARC senders don't get refused + mail(:from => MailHandler.address_from_name_and_email(name, blackhole_email), :to => contact_from_name_and_email, :subject => subject) end @@ -32,7 +34,7 @@ def user_message(from_user, recipient_user, from_user_url, subject, message) # someone's email addresses from transitory bounce messages. headers('Return-Path' => blackhole_email, 'Reply-To' => from_user.name_and_email) - mail(:from => from_user.name_and_email, + mail(:from => MailHandler.address_from_name_and_email(from_user.name, blackhole_email), :to => recipient_user.name_and_email, :subject => subject) end @@ -50,7 +52,21 @@ def from_admin_message(recipient_name, recipient_email, subject, message) # Send a request to the administrator to add an authority def add_public_body(change_request) @change_request = change_request - mail(:from => MailHandler.address_from_name_and_email(@change_request.get_user_name, @change_request.get_user_email), + + + # Return path is an address we control so that SPF checks are done on it. + headers('Return-Path' => blackhole_email, + 'Reply-To' => MailHandler.address_from_name_and_email( + @change_request.get_user_name, + @change_request.get_user_email + ) + ) + + # From is an address we control so that strict DMARC senders don't get refused + mail(:from => MailHandler.address_from_name_and_email( + @change_request.get_user_name, + blackhole_email + ), :to => contact_from_name_and_email, :subject => _('Add authority - {{public_body_name}}', :public_body_name => @change_request.get_public_body_name)) @@ -59,7 +75,20 @@ def add_public_body(change_request) # Send a request to the administrator to update an authority email address def update_public_body_email(change_request) @change_request = change_request - mail(:from => MailHandler.address_from_name_and_email(@change_request.get_user_name, @change_request.get_user_email), + + # Return path is an address we control so that SPF checks are done on it. + headers('Return-Path' => blackhole_email, + 'Reply-To' => MailHandler.address_from_name_and_email( + @change_request.get_user_name, + @change_request.get_user_email + ) + ) + + # From is an address we control so that strict DMARC senders don't get refused + mail(:from => MailHandler.address_from_name_and_email( + @change_request.get_user_name, + blackhole_email + ), :to => contact_from_name_and_email, :subject => _('Update email address - {{public_body_name}}', :public_body_name => @change_request.get_public_body_name)) diff --git a/app/mailers/outgoing_mailer.rb b/app/mailers/outgoing_mailer.rb index 5d6e0e55c4..8a83aa5466 100644 --- a/app/mailers/outgoing_mailer.rb +++ b/app/mailers/outgoing_mailer.rb @@ -16,22 +16,27 @@ class OutgoingMailer < ApplicationMailer # Email to public body requesting info def initial_request(info_request, outgoing_message) - @info_request, @outgoing_message, @contact_email = info_request, outgoing_message, AlaveteliConfiguration::contact_email - headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message) + @info_request = info_request + @outgoing_message = outgoing_message + @contact_email = AlaveteliConfiguration.contact_email + headers["message-id"] = OutgoingMailer.id_for_message(@outgoing_message) - mail(:from => info_request.incoming_name_and_email, - :to => info_request.recipient_name_and_email, - :subject => info_request.email_subject_request(:html => false)) + mail(:from => @outgoing_message.from, + :to => @outgoing_message.to, + :subject => @outgoing_message.subject) end # Later message to public body regarding existing request def followup(info_request, outgoing_message, incoming_message_followup) - @info_request, @outgoing_message, @incoming_message_followup, @contact_email = info_request, outgoing_message, incoming_message_followup, AlaveteliConfiguration::contact_email - headers["message-id"] = OutgoingMailer.id_for_message(outgoing_message) + @info_request = info_request + @outgoing_message = outgoing_message + @incoming_message_followup = incoming_message_followup + @contact_email = AlaveteliConfiguration.contact_email + headers["message-id"] = OutgoingMailer.id_for_message(@outgoing_message) - mail(:from => info_request.incoming_name_and_email, - :to => OutgoingMailer.name_and_email_for_followup(info_request, incoming_message_followup), - :subject => OutgoingMailer.subject_for_followup(info_request, outgoing_message, :html => false)) + mail(:from => @outgoing_message.from, + :to => @outgoing_message.to, + :subject => @outgoing_message.subject) end # TODO: the condition checking valid_to_reply_to? also appears in views/request/_followup.html.erb, diff --git a/app/mailers/request_mailer.rb b/app/mailers/request_mailer.rb index 6c1e561b52..8c0fc8bc42 100644 --- a/app/mailers/request_mailer.rb +++ b/app/mailers/request_mailer.rb @@ -67,7 +67,11 @@ def requires_admin(info_request, set_by = nil, message = "") headers('Return-Path' => blackhole_email, 'Reply-To' => user.name_and_email) - mail(:from => user.name_and_email, + # From is an address we control so that strict DMARC senders don't get refused + mail(:from => MailHandler.address_from_name_and_email( + user.name, + blackhole_email + ), :to => contact_from_name_and_email, :subject => _("FOI response requires admin ({{reason}}) - " \ "{{request_title}}", @@ -97,10 +101,10 @@ def new_response(info_request, incoming_message) # Tell the requester that the public body is late in replying def overdue_alert(info_request, user) - respond_url = respond_to_last_url(info_request) + "#followup" + respond_url = respond_to_last_url(info_request, :anchor => "followup") post_redirect = PostRedirect.new( - :uri => respond_to_last_url(info_request) + "#followup", + :uri => respond_to_last_url(info_request, :anchor => "followup"), :user_id => user.id) post_redirect.save! url = confirm_url(:email_token => post_redirect.email_token) @@ -118,10 +122,10 @@ def overdue_alert(info_request, user) # Tell the requester that the public body is very late in replying def very_overdue_alert(info_request, user) - respond_url = respond_to_last_url(info_request) + "#followup" + respond_url = respond_to_last_url(info_request, :anchor => "followup") post_redirect = PostRedirect.new( - :uri => respond_to_last_url(info_request) + "#followup", + :uri => respond_to_last_url(info_request, :anchor => "followup"), :user_id => user.id) post_redirect.save! @url = confirm_url(:email_token => post_redirect.email_token) @@ -141,7 +145,7 @@ def new_response_reminder_alert(info_request, incoming_message) # Make a link going to the form to describe state, and which logs the # user in. post_redirect = PostRedirect.new( - :uri => request_url(info_request) + "#describe_state_form_1", + :uri => request_url(info_request, :anchor => "describe_state_form_1"), :user_id => info_request.user.id) post_redirect.save! @url = confirm_url(:email_token => post_redirect.email_token) @@ -166,9 +170,8 @@ def old_unclassified_updated(info_request) # Tell the requester that they need to clarify their request def not_clarified_alert(info_request, incoming_message) respond_url = new_request_incoming_followup_url(:request_id => info_request.id, - :incoming_message_id => incoming_message.id) - respond_url = respond_url + "#followup" - + :incoming_message_id => incoming_message.id, + :anchor => 'followup') post_redirect = PostRedirect.new( :uri => respond_url, :user_id => info_request.user.id) @@ -269,9 +272,7 @@ def receive(email, raw_email) # Send email alerts for overdue requests def self.alert_overdue_requests - info_requests = InfoRequest.find(:all, - :conditions => [ - "described_state = 'waiting_response' + info_requests = InfoRequest.where("described_state = 'waiting_response' AND awaiting_description = ? AND user_id is not null AND (SELECT id @@ -286,10 +287,7 @@ def self.alert_overdue_requests 'resent', 'followup_resent') AND info_request_id = info_requests.id) - ) IS NULL", false - ], - :include => [ :user ] - ) + ) IS NULL", false).includes(:user) for info_request in info_requests alert_event_id = info_request.last_event_forming_initial_request.id @@ -306,17 +304,15 @@ def self.alert_overdue_requests # For now, just to the user who created the request sent_already = UserInfoRequestSentAlert. - find(:first, - :conditions => - [ "alert_type = ? " \ - "AND user_id = ? " \ - "AND info_request_id = ? " \ - "AND info_request_event_id = ?", - alert_type, - info_request.user_id, - info_request.id, - alert_event_id - ]) + where("alert_type = ? " \ + "AND user_id = ? " \ + "AND info_request_id = ? " \ + "AND info_request_event_id = ?", + alert_type, + info_request.user_id, + info_request.id, + alert_event_id). + first if sent_already.nil? # Alert not yet sent for this user, so send it store_sent = UserInfoRequestSentAlert.new @@ -349,9 +345,10 @@ def self.alert_new_response_reminders end end def self.alert_new_response_reminders_internal(days_since, type_code) - info_requests = InfoRequest.find_old_unclassified(:order => 'info_requests.id', - :include => [:user], - :age_in_days => days_since) + info_requests = InfoRequest. + where_old_unclassified(days_since). + order('info_requests.id'). + includes(:user) info_requests.each do |info_request| alert_event_id = info_request.get_last_public_response_event_id @@ -362,17 +359,15 @@ def self.alert_new_response_reminders_internal(days_since, type_code) end # To the user who created the request sent_already = UserInfoRequestSentAlert. - find(:first, - :conditions => [ - "alert_type = ? " \ - "AND user_id = ? " \ - "AND info_request_id = ? " \ - "AND info_request_event_id = ?", - type_code, - info_request.user_id, - info_request.id, - alert_event_id - ]) + where("alert_type = ? " \ + "AND user_id = ? " \ + "AND info_request_id = ? " \ + "AND info_request_event_id = ?", + type_code, + info_request.user_id, + info_request.id, + alert_event_id). + first if sent_already.nil? # Alert not yet sent for this user store_sent = UserInfoRequestSentAlert.new @@ -391,16 +386,13 @@ def self.alert_new_response_reminders_internal(days_since, type_code) # after last update of event. def self.alert_not_clarified_request info_requests = InfoRequest. - find(:all, - :conditions => - [ - "awaiting_description = ? - AND described_state = 'waiting_clarification' - AND info_requests.updated_at < ?", - false, - Time.now - 3.days - ], - :include => [ :user ], :order => "info_requests.id") + where("awaiting_description = ? + AND described_state = 'waiting_clarification' + AND info_requests.updated_at < ?", + false, + Time.now - 3.days + ). + includes(:user).order("info_requests.id") for info_request in info_requests alert_event_id = info_request.get_last_public_response_event_id last_response_message = info_request.get_last_public_response @@ -410,17 +402,14 @@ def self.alert_not_clarified_request end # To the user who created the request sent_already = UserInfoRequestSentAlert. - find(:first, - :conditions => - [ - "alert_type = 'not_clarified_1' - AND user_id = ? - AND info_request_id = ? - AND info_request_event_id = ?", - info_request.user_id, - info_request.id, - alert_event_id - ]) + where("alert_type = 'not_clarified_1' + AND user_id = ? + AND info_request_id = ? + AND info_request_event_id = ?", + info_request.user_id, + info_request.id, + alert_event_id). + first if sent_already.nil? # Alert not yet sent for this user store_sent = UserInfoRequestSentAlert.new @@ -487,7 +476,11 @@ def self.alert_comment_on_request if e.event_type == 'comment' && e.comment.user_id != info_request.user_id last_comment_event = e if last_comment_event.nil? - alerted_for = e.user_info_request_sent_alerts.find(:first, :conditions => [ "alert_type = 'comment_1' and user_id = ?", info_request.user_id]) + alerted_for = e.user_info_request_sent_alerts. + where("alert_type = 'comment_1' + AND user_id = ?", + info_request.user_id). + first if alerted_for.nil? count = count + 1 earliest_unalerted_comment_event = e @@ -534,12 +527,6 @@ def auto_generated_headers }) end - def mail_user_with_info_request_title(user, subject, info_request) - warn %q([DEPRECATION] RequestMailer#mail_user_with_info_request_title - will be removed in Alaveteli release 0.25).squish - mail_user(user, subject + info_request.title.html_safe) - end - def mail_user(user, subject) mail({ :from => contact_from_name_and_email, diff --git a/app/mailers/track_mailer.rb b/app/mailers/track_mailer.rb index 9924a94147..22b7702e30 100644 --- a/app/mailers/track_mailer.rb +++ b/app/mailers/track_mailer.rb @@ -10,8 +10,8 @@ def event_digest(user, email_about_things) @user, @email_about_things = user, email_about_things post_redirect = PostRedirect.new( - :uri => user_url(user) + "#email_subscriptions", - :user_id => user.id) + :uri => user_url(user, :anchor => "email_subscriptions"), + :user_id => user.id) post_redirect.save! @unsubscribe_url = confirm_url(:email_token => post_redirect.email_token) @@ -36,7 +36,7 @@ def contact_from_name_and_email # weeks. # Useful query to run by hand to see how many alerts are due: - # User.find(:all, :conditions => [ "last_daily_track_email < ?", Time.now - 1.day ]).size + # User.where("last_daily_track_email < ?", Time.now - 1.day).size def self.alert_tracks done_something = false now = Time.now @@ -46,7 +46,8 @@ def self.alert_tracks next if !user.should_be_emailed? || !user.receive_email_alerts email_about_things = [] - track_things = TrackThing.find(:all, :conditions => [ "tracking_user_id = ? and track_medium = ?", user.id, 'email_daily' ]) + track_things = TrackThing.where(:tracking_user_id => user.id, + :track_medium => 'email_daily') for track_thing in track_things # What have we alerted on already? # @@ -56,7 +57,7 @@ def self.alert_tracks # earlier, so this is safe (with a week long margin of error). If the alerts break # for a whole week, then they will miss some items. Tough. done_info_request_events = {} - tt_sent = track_thing.track_things_sent_emails.find(:all, :conditions => ['created_at > ?', now - 14.days]) + tt_sent = track_thing.track_things_sent_emails.where('created_at > ?', now - 14.days) for t in tt_sent if not t.info_request_event_id.nil? done_info_request_events[t.info_request_event_id] = 1 diff --git a/app/models/about_me_validator.rb b/app/models/about_me_validator.rb index 46c5f6ad4c..8776973137 100644 --- a/app/models/about_me_validator.rb +++ b/app/models/about_me_validator.rb @@ -13,6 +13,8 @@ class AboutMeValidator validates_length_of :about_me, :maximum => 500, :message => _("Please keep it shorter than 500 characters") def initialize(attributes = {}) + warn %q([DEPRECATION] AboutMeValidator has been deprecated and will be + removed in Alaveteli release 0.26).squish attributes.each do |name, value| send("#{name}=", value) end diff --git a/app/models/censor_rule.rb b/app/models/censor_rule.rb index 34fb5e34bf..d730c21769 100644 --- a/app/models/censor_rule.rb +++ b/app/models/censor_rule.rb @@ -28,17 +28,6 @@ class CensorRule < ActiveRecord::Base belongs_to :user belongs_to :public_body - # a flag to allow the require_user_request_or_public_body - # validation to be skipped - def allow_global - warn %q([DEPRECATION] CensorRule#allow_global will be removed in 0.25) - @allow_global - end - - def allow_global=(value) - warn %q([DEPRECATION] CensorRule#allow_global= will be removed in 0.25) - @allow_global = value - end validate :require_valid_regexp, :if => proc { |rule| rule.regexp? == true } @@ -47,34 +36,22 @@ def allow_global=(value) :last_edit_comment, :last_edit_editor - scope :global, { :conditions => { :info_request_id => nil, - :user_id => nil, - :public_body_id => nil } } + scope :global, -> { + where(info_request_id: nil, + user_id: nil, + public_body_id: nil) + } def apply_to_text(text_to_censor) return nil if text_to_censor.nil? text_to_censor.gsub(to_replace('UTF-8'), replacement) end - def apply_to_text!(text_to_censor) - warn %q([DEPRECATION] CensorRule#apply_to_text! will be removed in 0.25. - Use the non-destructive CensorRule#apply_to_text instead).squish - return nil if text_to_censor.nil? - text_to_censor.gsub!(to_replace('UTF-8'), replacement) - end - def apply_to_binary(binary_to_censor) return nil if binary_to_censor.nil? binary_to_censor.gsub(to_replace('ASCII-8BIT')) { |match| match.gsub(single_char_regexp, 'x') } end - def apply_to_binary!(binary_to_censor) - warn %q([DEPRECATION] CensorRule#apply_to_binary! will be removed in 0.25. - Use the non-destructive CensorRule#apply_to_binary instead).squish - return nil if binary_to_censor.nil? - binary_to_censor.gsub!(to_replace('ASCII-8BIT')) { |match| match.gsub(single_char_regexp, 'x') } - end - def is_global? info_request_id.nil? && user_id.nil? && public_body_id.nil? end diff --git a/app/models/comment.rb b/app/models/comment.rb index 1998db64bb..a5c70bc15f 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -24,7 +24,7 @@ class Comment < ActiveRecord::Base include AdminColumn strip_attributes :allow_empty => true - belongs_to :user + belongs_to :user, :counter_cache => true belongs_to :info_request has_many :info_request_events # in practice only ever has one @@ -33,7 +33,7 @@ class Comment < ActiveRecord::Base validate :check_body_has_content, :check_body_uses_mixed_capitals - scope :visible, lambda { + scope :visible, -> { joins(:info_request).merge(InfoRequest.visible).where(:visible => true) } diff --git a/app/models/concerns/admin_column.rb b/app/models/concerns/admin_column.rb index c39468e70a..fe11c89372 100644 --- a/app/models/concerns/admin_column.rb +++ b/app/models/concerns/admin_column.rb @@ -12,7 +12,7 @@ class << self def for_admin_column self.class.content_columns.reject { |c| self.class.non_admin_columns.include?(c.name) }.each do |column| - yield(column.human_name, send(column.name), column.type.to_s, column.name) + yield(column.name.humanize, send(column.name), column.type.to_s, column.name) end end end diff --git a/app/models/holiday.rb b/app/models/holiday.rb index 03965d452e..baac01ceb4 100644 --- a/app/models/holiday.rb +++ b/app/models/holiday.rb @@ -26,7 +26,7 @@ class Holiday < ActiveRecord::Base validates_presence_of :day def self.holidays - @@holidays ||= all.collect { |h| h.day }.to_set + @@holidays ||= uniq.pluck(:day) end def self.weekend_or_holiday?(date) diff --git a/app/models/holiday_import.rb b/app/models/holiday_import.rb index 89f7dfc345..6bccfabf47 100644 --- a/app/models/holiday_import.rb +++ b/app/models/holiday_import.rb @@ -63,8 +63,13 @@ def all_holidays_valid def populate_from_ical_feed begin cal_file = open(ical_feed_url) - cals = Icalendar.parse(cal_file, strict=false) + cal_parser = Icalendar::Parser.new(cal_file) + cals = cal_parser.parse cal = cals.first + unless cal + errors.add(:ical_feed_url, "Sorry, there's a problem with the format of that feed.") + return + end cal.events.each{ |cal_event| populate_from_ical_event(cal_event) } rescue Errno::ENOENT, Exception => e if e.message == 'Invalid line in calendar string!' diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index e7cf4eaa2f..5473b93ad4 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -39,6 +39,9 @@ class IncomingMessage < ActiveRecord::Base include AdminColumn extend MessageProminence + + MAX_ATTACHMENT_TEXT_CLIPPED = 1000000 # 1Mb ish + belongs_to :info_request validates_presence_of :info_request @@ -146,39 +149,105 @@ def destroy_email_file raw_email.destroy_file_representation! end - def valid_to_reply_to? - return self.valid_to_reply_to - end - # The cached fields mentioned in the previous comment - # TODO: there must be a nicer way to do this without all that - # repetition. I tried overriding method_missing but got some - # unpredictable results. + + # Public: Can this message be replied to? + # Caches the value set by _calculate_valid_to_reply_to in #parse_raw_email! + # #valid_to_reply_to overrides the ActiveRecord provided #valid_to_reply_to + # + # Returns a Boolean def valid_to_reply_to parse_raw_email! super end + + alias_method :valid_to_reply_to?, :valid_to_reply_to + + # Public: The date and time the email was sent. Uses the Date header if + # present in the email, otherwise uses the record's created_at attribute. + # #sent_at overrides the ActiveRecord provided #sent_at + # + # Returns an ActiveSupport::TimeWithZone def sent_at parse_raw_email! super end + # Public: The subject of an email. + # #subject overrides the ActiveRecord provided #subject + # + # Examples: + # + # # Subject: A response to your FOI request + # incoming_message.subject + # # => 'A response to your FOI request' + # + # # No subject header + # incoming_message.subject + # # => nil + # + # Returns a String or nil def subject parse_raw_email! super end + # Public: The display name of the email sender. + # #mail_from overrides the ActiveRecord provided #mail_from + # + # Examples: + # + # # From: John Doe<%= link_to "Download", admin_raw_email_path(@raw_email, :format => 'txt') %>
+<%= link_to "Download", admin_raw_email_path(@raw_email, :format => 'txt'), :class => 'btn' %>
- - <%= select( 'info_request', "allow_new_responses_from", [ "anybody", "authority_only", "nobody" ] ) %>; - - <%= select( 'info_request', "handle_rejected_responses", [ "bounce", "holding_pen", "blackhole" ] ) %> + <% if @info_request.reject_incoming_at_mta? %> + <% new_response_options_disabled = true %> +
@@ -53,7 +75,7 @@ <%= form_tag admin_request_path(@info_request), :method => :delete do %>
- This is permanent and irreversible! <%= submit_tag 'Destroy request entirely', :class => 'btn btn-danger', :confirm => "Are you sure you want to destroy this request?" %>
+ This is permanent and irreversible! <%= submit_tag 'Destroy request entirely', :class => 'btn btn-danger', :data => { :confirm => "Are you sure you want to destroy this request?" } %>
Use it mainly if someone posts private information, e.g. made a Data Protection request. It
destroys all responses and tracks as well.
<% if not @is_owning_user %> - (You will be asked to sign in as <%= user_link(@info_request.user) %>) + <%= _("(You will be asked to sign in as {{user_name}})", + :user_name => user_link(@info_request.user)) %> <% end %>
<% end %> diff --git a/app/views/followups/new.html.erb b/app/views/followups/new.html.erb index a43f2b7ab8..54a6c9ba3d 100644 --- a/app/views/followups/new.html.erb +++ b/app/views/followups/new.html.erb @@ -28,7 +28,7 @@-- <%= _('Add an annotation to your request with choice quotes, ' \
- 'or a summary of the response.') %>
+ <% if AlaveteliConfiguration.enable_annotations %>
+ - <%= _('Add an annotation to your request with choice quotes, ' \
+ 'or a summary of the response.') %>
+ <% end %>
- <%= _('If you can, scan in or photograph the response, and ' \
'send us a copy to upload.') %>
diff --git a/app/views/followups/preview.html.erb b/app/views/followups/preview.html.erb index d6d2b4a1fa..beb2ce5fae 100644 --- a/app/views/followups/preview.html.erb +++ b/app/views/followups/preview.html.erb @@ -1,7 +1,11 @@ <% @title = _("Preview follow up to '") + h(@info_request.public_body.name) + "'" %><%= _('Now preview your message asking for an internal review') %>
diff --git a/app/views/general/_advanced_search_tips.html.erb b/app/views/general/_advanced_search_tips.html.erb index ce197bfb4a..701f15879f 100644 --- a/app/views/general/_advanced_search_tips.html.erb +++ b/app/views/general/_advanced_search_tips.html.erb @@ -9,7 +9,9 @@variety:
to select type of thing to search for, see the table of varieties below.', :varieties_url => "#varieties") %>requested_from:home_office
to search requests from the Home Office, typing the name as in the URL.')%>requested_by:julian_todd
to search requests made by Julian Todd, typing the name as in the URL.') %>commented_by:tony_bowden
to search annotations made by Tony Bowden, typing the name as in the URL.')%>commented_by:tony_bowden
to search annotations made by Tony Bowden, typing the name as in the URL.')%>request:
to restrict to a specific request, typing the title as in the URL.')%>filetype:pdf
to find all responses with PDF attachments. Or try these:{{list_of_file_extensions}}
', :list_of_file_extensions => IncomingMessage.get_all_file_extensions)%>01/01/2008..14/01/2008
to only show things that happened in the first two weeks of January.')%>