realm / realm/SwiftLint

When -todo and -expiring_todo is enabled // TODO: with expiring dates should not cause a warning

Open
#3,627 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion enhancement
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
Describe the bug

We want // TODO: comments without an expiry date to appear as a warning, however expect that enabling expiring_todo would not cause //TODO: with dates outside the threshold to cause a warning under the standard -todo flag. And they seem to cause warnings regardless.

So it seems that -todo overrides -expiring_todo, and they probably should be complementary.

Additionally, approaching_expiry_threshold: doesn't seem to be in the documentation.

Environment
  • SwiftLint version 0.43.1
  • Installation method used CocoaPods
  • Paste your configuration file:
opt_in_rules:
- empty_count
- weak_delegate
- expiring_todo
- todo


force_try: error
closing_brace: error
comma: error
control_statement: error
leading_whitespace: error
operator_whitespace: error
return_arrow_whitespace: error
trailing_newline: error
trailing_semicolon: error
void_return: error
weak_delegate: error

expiring_todo:
  approaching_expiry_threshold: 3

colon:
  severity: error
 
identifier_name:
  severity: error
  min_length: 2
  max_length: 100
 
line_length:
  warning: 300
  error: 150
  ignores_comments: true

trailing_whitespace:
  severity: error
  ignores_empty_lines: false
  ignores_comments: true
 
type_name:
  severity: error
  min_length: 2
  max_length: 100
 
vertical_whitespace:
  severity: error
 
custom_rules:
    private_set_outlet:
        regex: '@IBOutlet(?!.*private \(set\).*)'
        severity: error
        message: "IBOutlets should be private to avoid leaking UIKit to higher layers."
#  guard_style:
#    name: "Guard Style"
#    regex: "(guard([^\n]*\,\n)+[^\n]*\n[\h]*else\n)|(guard[^\n]*\n[\h]*else)"
#    severity: error
#    message: "Else should be on the same line as the guard"
#  else_style:
#   name: "Else/Catch Style"
#   regex: "\}[^\n]*else|else[^\n]*\{|\}[^\n]*catch|catch[^\n]*\{"
#   severity: error
#   message: "Else/Catch and opening brace should go on new lines."
 
disabled_rules: # rule identifiers to exclude from running
  - function_parameter_count
  - large_tuple # tuples larger than 3 properties
  - statement_position # placement of else/catch near '{'
  - file_length
  - switch_case_alignment
  - multiple_closures_with_trailing_closure
  - fallthrough
  - vertical_parameter_alignment
  - function_body_length
  - type_body_length
  - nesting
  - block_based_kvo
  - trailing_comma

example (I'm including leading 0 to accommodate the bug yet to be released)

// TODO: [05/15/2021] Fix me by now

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior using the provided SwiftLint configuration, with both todo and expiring_todo enabled, and the dated TODO example. Check whether dated TODO comments outside the expiry threshold still trigger the standard warning, and verify that approaching_expiry_threshold is documented; done means the rules behave complementarily and the option is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.