Swiftlint: What is the file_header rule about?

Created on 4 May 2017  路  5Comments  路  Source: realm/SwiftLint

I do not understand what is the issue reported by the rule file_header.

//
//  ActivityModel.swift
//  English 24/7
//
//  Created by Antoine C艙ur on 8/24/16.
//  Copyright 漏 2016 EF Education. All rights reserved.
//

/MyApp/ActivityModel.swift:6:5: warning: File Header Violation: Files should have consistent header comments. (file_header)

What does it mean?
Does it mean I need to change the Copyright year for all my files on every January 1st?

question

Most helpful comment

It validates that a certain string or regex should be present (or avoided) on the file header. By the default, this rule warns against occurrences of "Copyright".

You can see an example of how it can be configured on SwiftLint configuration file.

All 5 comments

It validates that a certain string or regex should be present (or avoided) on the file header. By the default, this rule warns against occurrences of "Copyright".

You can see an example of how it can be configured on SwiftLint configuration file.

OK, so the error message wasn't very informative. I would suggest to change it to something more like:

warning: File Header Violation: Header comments should match the project pattern. (file_header)

It's just that the rule can enforce that a certain string/pattern must be avoided as well, so "should match the project pattern" doesn't feel right to me.

But I agree we can have a better message here.

Suggestions?

  • "Header comments should match or exclude defined project patterns."
  • "Header comments should be consistent with project patterns."
Was this page helpful?
0 / 5 - 0 ratings