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

Error on bad expiring todo date formats. #3626

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Error on bad expiring todo date formats. #3626

merged 1 commit into from
Apr 11, 2022

Conversation

chrispomeroyhale
Copy link
Contributor

Motivation

For expiring todos, there is currently a lack of documentation on the default date format. This currently requires a deep dive into SwiftLint to figure out what it is. This is a detractor of this tool in a team setting. Unfortunately, the default is an American date format which is a little surprising. Although it may be too late to change the default to be in line with ISO 8601, we can reject badly formatted dates which otherwise never expire or unexpectedly expire.

What Changed

  1. A bad TODO date format throws an error by default. This can be configured
  2. To alleviate the lack of documentation, consoleDescription has been updated to correct and include all the latest properties
  3. Updated the regex to accept any 1-4 letter date format in any position. In the future we might consider matching anything within the delimiters to the date_format and remove date_separator

@SwiftLintBot
Copy link

SwiftLintBot commented May 5, 2021

12 Messages
📖 Linting Aerial with this PR took 0.97s vs 0.98s on master (1% faster)
📖 Linting Alamofire with this PR took 1.1s vs 1.11s on master (0% faster)
📖 Linting Firefox with this PR took 4.11s vs 4.18s on master (1% faster)
📖 Linting Kickstarter with this PR took 7.37s vs 7.45s on master (1% faster)
📖 Linting Moya with this PR took 4.36s vs 4.36s on master (0% slower)
📖 Linting Nimble with this PR took 0.39s vs 0.4s on master (2% faster)
📖 Linting Quick with this PR took 0.17s vs 0.17s on master (0% slower)
📖 Linting Realm with this PR took 10.22s vs 9.97s on master (2% slower)
📖 Linting SourceKitten with this PR took 0.33s vs 0.33s on master (0% slower)
📖 Linting Sourcery with this PR took 2.04s vs 2.02s on master (0% slower)
📖 Linting Swift with this PR took 3.17s vs 3.18s on master (0% faster)
📖 Linting WordPress with this PR took 7.54s vs 7.36s on master (2% slower)

Generated by 🚫 Danger

@SimplyDanny
Copy link
Collaborator

Thank you for the contribution and sorry for the late feedback!

The changes make sense to me. Would you like to rebase them and fix the conflicts?

In the future we might consider matching anything within the delimiters to the date_format and remove date_separator.

This would indeed be a reasonable change in the future. The date_format can handle this. There is actually no need for the data_separator configuration.

@chrispomeroyhale
Copy link
Contributor Author

@SimplyDanny Rebased

Copy link
Collaborator

@SimplyDanny SimplyDanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @chrispomeroyhale!

@SimplyDanny SimplyDanny merged commit 9beef23 into realm:master Apr 11, 2022
coffmark pushed a commit to coffmark/SwiftLint that referenced this pull request Apr 11, 2022
@chrispomeroyhale chrispomeroyhale deleted the expiring_todo_bad_date_format branch April 20, 2022 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants