OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/.rubocop.yml

362 lines
5.9 KiB

require:
- rubocop-rails
- rubocop-rspec
AllCops:
4 years ago
TargetRubyVersion: 2.7
# Enable any new cops in new versions by default
NewCops: enable
Exclude:
- db/schema.rb
Gemspec/RequiredRubyVersion:
Exclude:
- modules/**/*.gemspec
Layout/ConditionPosition:
Enabled: false
Layout/DotPosition:
EnforcedStyle: leading
Layout/LineLength:
Max: 130
Layout/MultilineMethodCallIndentation:
Enabled: false
Lint/AmbiguousOperator:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Enabled: false
Lint/AssignmentInCondition:
Enabled: false
Lint/DeprecatedClassMethods:
Enabled: false
Lint/ElseLayout:
Enabled: false
Lint/FlipFlop:
Enabled: false
Lint/LiteralInInterpolation:
Enabled: false
Lint/Loop:
Enabled: false
Lint/ParenthesesAsGroupedExpression:
Enabled: false
Lint/RequireParentheses:
Enabled: false
Lint/SuppressedException:
Enabled: false
Lint/UnderscorePrefixedVariableName:
Enabled: false
Lint/Void:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/AbcSize:
Enabled: true
Exclude:
- 'spec/**/*.rb'
- 'modules/*/spec/**/*.rb'
Naming/AccessorMethodName:
Enabled: false
Naming/AsciiIdentifiers:
Enabled: false
Naming/FileName:
Enabled: false
Naming/PredicateName:
ForbiddenPrefixes:
- is_
# There are valid cases in which to use methods like:
# * update_all
# * touch_all
Rails/SkipsModelValidations:
Enabled: false
[26688] In-app notifications (#9399) * Add bell icon to icon font * Add in app notification in top menu * Add fullscreen modal * Add notification modal and items * Style items * Toggle details of item * Mark all read * Add no results box * wip specification for event api * Add events table, query and index * Send out events from WP notification mailer job There we have the recipients present * Add cleanup job for older events with a setting * Hide bell notification when not logged * Add specs for events API index/show * Fix setting yml key * remove pry in event creation * Fix before hook in events API to after_validation * Fix polymorphic association raising exception for aggregated journals * Fix typo in read_ian * Fix yml entry for mentioned * Add read/unread post actions to event API and add specs * Wire up API to frontend * Fix order on events * Switch to unread in notification * Add event query * rename WPEventService * route wp mail sending over events * rename spec methods * author becomes watcher * correct message call signature * rename events to notifications * renname parameter to reflect notification nature * create author watcher for existing work packages * Merge unreadCount from store * Take a stab at polymorphic representers * Fix link generation in polymorphic resources For journals, no title is being generated however * Fix frontend model for context * Use timer for polling * add notification_setting data layer * Fix show resource spec * Fix duplicate class in notification bell item * Add minimal feature spec for notification * API for notification settings * Persist notifications * adapt work package notification creation to notification settings * extract notified_on_all * consolidate wp#recipients * concentrate wp notification in journal service * simplify methods * Remove unused patch endpoint * Add specs for rendering and parsing notification settings * Contract spec * Update service spec * adapt specs * Angular notifications frontend commit e29dced64699eb5f2443b9307c78343c9a58d1ee Author: Wieland Lindenthal <w.lindenthal@forkmerge.com> Date: Mon Jun 21 17:34:50 2021 +0200 Create Akita store and query for notification settings commit 1a45c26c1a0c147d15393e49d2625aca4851a64d Author: Wieland Lindenthal <w.lindenthal@forkmerge.com> Date: Mon Jun 21 11:09:25 2021 +0200 Remove tabs from notificaition settings page commit 0ea21e90c13a197f8bf2cfba1b60ddcff4e5e827 Author: Oliver Günther <mail@oliverguenther.de> Date: Sun Jun 20 21:55:48 2021 +0200 WIP in app settings * migrate notification data * add project visible filter to project query * Add inline-create and table display grouped by project * Add notifications under admin/users * Remove notifications partial * Rename notififcations store to user preferences store * Add setting for self_notified and hook that up to the backend * Add aria-label to table checkboxes * Restyle table and toolbar * replace remains of mail_notifications attribute * initialize notification settings for new user * adapt my_preferences references * reenable no self notified for documents * adapt specs * Avoid has_many :notifcation_settings Rails magically autosaves the user's preferences when the user gets saved, which somehow also tries to save the notfifications even when unchanged. This breaks some specs such as the avatar upload spec. As we can't update the assocation through rails anyway, just delegate to the user for reading instead. * Restore update method of notification settings * Restore update spec * fix spec syntax * lint scss * linting * Fix content_tag for bell icon * Add feature specs for notification settings * Disable ContentTag cop * use visible filter to get projects for notification The visible filter will reduce the project list down to the set of projects visible to the user provided as a parameter. This includes public projects. * test for actual mail sending * adapt me resource path this.apiV3Service.users.me changed its type in 0d6c0b6bc7620de94e00e72b36d6cbc1ec4c8db4 * Implement changed migration * Linting * Add actor to notification representer * Fix factory creating a duplicate WP journal * Add work packages loading and journal details to notification entry component * IAN basic facets, keep and expanded states. * Fix notification bell spec * Render body separately and add auto updating relative time * Add fixedTime title * Add actor to notification entry * Fix clicking links on work package and project * Tiny styling changes on entry row * Disable count in notification if larger than 99 (wont fit) * Introduce virtual scrolling to entry table * allow delaying & prevent mail sending if ain read Introduces a setting to delay mail sending after a journal aggregation time has expired. That way, users can confirm a notification in app. If they do before the delay expires, no mail is sent out additionally for that user. * consolidate notifications (in&out) into shared admin menu Co-authored-by: ulferts <jens.ulferts@googlemail.com> Co-authored-by: Wieland Lindenthal <w.lindenthal@forkmerge.com>
3 years ago
# Don't force us to use tag instead of content_tag
# as this breaks angular elements
Rails/ContentTag:
Enabled: false
# Disable I18n.locale = in specs, where it is reset
# by us explicitly
Rails/I18nLocaleAssignment:
Enabled: true
Exclude:
- 'spec/**/*.rb'
# For feature specs, we tend to have longer specs that cover a larger part of the functionality.
# This is done for multiple reasons:
# * performance, as setting up integration tests is costly
# * following a scenario that is closer to how a user interacts
RSpec/ExampleLength:
Max: 25
Enabled: true
Exclude:
- 'spec/features/**/*.rb'
- 'modules/*/spec/features/**/*.rb'
RSpec/DescribeClass:
Enabled: true
Exclude:
- 'spec/features/**/*.rb'
- 'modules/*/spec/features/**/*.rb'
# See RSpec/ExampleLength for why feature specs are excluded
RSpec/MultipleExpectations:
Max: 15
Enabled: true
Exclude:
- 'spec/features/**/*.rb'
- 'modules/*/spec/features/**/*.rb'
RSpec/MultipleMemoizedHelpers:
Max: 15
AllowSubject: true
RSpec/NestedGroups:
Max: 4
# Don't force the second argument of describe
# to be .class_method or #instance_method
RSpec/DescribeMethod:
Enabled: false
# We use let!() to ensure dependencies are created
# instead of let() and referencing them explicitly
RSpec/LetSetup:
Enabled: false
RSpec/LeadingSubject:
Enabled: false
RSpec/NamedSubject:
Enabled: false
Style/Alias:
Enabled: false
Style/AndOr:
Enabled: false
Style/ArrayJoin:
Enabled: false
Style/AsciiComments:
Enabled: false
Style/Attr:
Enabled: false
Style/CaseEquality:
Enabled: false
Style/CharacterLiteral:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/ClassVars:
Enabled: false
Style/CollectionMethods:
PreferredMethods:
find: detect
reduce: inject
collect: map
find_all: select
Style/ColonMethodCall:
Enabled: false
Style/CommentAnnotation:
Enabled: false
Style/PreferredHashMethods:
Enabled: false
Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/EachWithObject:
Enabled: false
Style/EmptyLiteral:
Enabled: false
Style/Encoding:
Enabled: false
Style/EvenOdd:
Enabled: false
Style/FormatString:
Enabled: false
Style/GlobalVars:
Enabled: false
Style/GuardClause:
Enabled: false
Style/IfUnlessModifier:
Enabled: false
Style/IfWithSemicolon:
Enabled: false
Style/InlineComment:
Enabled: false
Style/Lambda:
Enabled: false
Style/LambdaCall:
Enabled: false
Style/LineEndConcatenation:
Enabled: false
Style/ModuleFunction:
Enabled: false
Style/NegatedIf:
Enabled: false
Style/NegatedWhile:
Enabled: false
Style/Next:
Enabled: false
Style/NilComparison:
Enabled: false
Style/Not:
Enabled: false
Style/OneLineConditional:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/PerlBackrefs:
Enabled: false
Style/Proc:
Enabled: false
Style/RaiseArgs:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/SelfAssignment:
Enabled: false
Style/SingleLineBlockParams:
Enabled: false
Style/SingleLineMethods:
Enabled: false
Style/SignalException:
Enabled: false
Style/SpecialGlobalVars:
Enabled: false
# Forcing single quotes doesn't give any reasonable advantages. To the contrary:
# it forces you to change the quotes every time you want to add interpolation,
# newlines or other escape sequences (\n), or quotes (') to a string. Rubbish.
# Don't even think about performance. That never was a valid argument to begin with.
#
# For the record: using single quotes does NOT have any performance advantages.
# Even if it did, this would be a silly argument.
#
# Ideally we would just use double quotes everywhere but since that would result
# in innumerable rubocop offenses we will just disable this. Quote away.
Style/StringLiterals:
Enabled: false
Style/TrivialAccessors:
Enabled: false
Style/VariableInterpolation:
Enabled: false
Style/WhenThen:
Enabled: false
Style/WhileUntilModifier:
Enabled: false
Style/WordArray:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/NumericLiterals:
Enabled: false
# Avoid enforcing "positive?"
Style/NumericPredicate:
Enabled: false
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true