Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expiring_todo only works if it is the first TODO in the file #3767

Closed
2 tasks done
BarryBryant opened this issue Nov 29, 2021 · 3 comments · Fixed by #3803
Closed
2 tasks done

expiring_todo only works if it is the first TODO in the file #3767

BarryBryant opened this issue Nov 29, 2021 · 3 comments · Fixed by #3803
Labels
bug Unexpected and reproducible misbehavior.

Comments

@BarryBryant
Copy link

New Issue Checklist

Describe the bug

The expiring_todo rule does not trigger when there are // TODO: comments above it in the file

Complete output when running SwiftLint, including the stack trace and command used

With a todo comment on a line above the todo with date, no expiring_todo violation

$ echo "// TODO: XYZ \n public enum Redacted { // TODO: [10/14/2019]" | Pods/SwiftLint/swiftlint line --no-cache --use-stdin --enable-all-rules

<nopath>:2:1: warning: Indentation Width Violation: Code should be indented using one tab or 4 spaces. (indentation_width)
<nopath>:2:9: warning: Missing Docs Violation: public declarations should be documented. (missing_docs)
<nopath>:1:4: warning: Todo Violation: TODOs should be resolved (XYZ). (todo)
<nopath>:2:28: warning: Todo Violation: TODOs should be resolved ([10/14/2019]). (todo)

With a normal comment on a line above the todo with date, correctly returns expiring_todo violation

$ echo "// XYZ \n public enum Redacted { // TODO: [10/14/2019]" | Pods/SwiftLint/swiftlint line --no-cache --use-stdin --enable-all-rules

<nopath>:2:35: error: ExpiringTodo Violation: TODO/FIXME has expired and must be resolved. (expiring_todo)
<nopath>:2:1: warning: Indentation Width Violation: Code should be indented using one tab or 4 spaces. (indentation_width)
<nopath>:2:9: warning: Missing Docs Violation: public declarations should be documented. (missing_docs)
<nopath>:2:28: warning: Todo Violation: TODOs should be resolved ([10/14/2019]). (todo)

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.45.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? CocoaPods
@jpsim jpsim added the bug Unexpected and reproducible misbehavior. label Nov 29, 2021
@serges147
Copy link
Contributor

serges147 commented Jan 9, 2022

Finally, I understand why some of my // TODO: [mm/dd/yyyy] Xxx are not triggered while others work perfectly! Exactly as described above, all you need is just have at least two such todos (separated by non-comment) in a swift file.

@serges147
Copy link
Contributor

I found pretty simple solution, preparing PR...

@serges147
Copy link
Contributor

#3803

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants