Skip to content

Commit

Permalink
feat: Support both LICENSE.txt and LICENSE in license checker
Browse files Browse the repository at this point in the history
  • Loading branch information
lieut-data committed Jan 16, 2025
1 parent b3bc489 commit e6c3a99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion license/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func run(pass *analysis.Pass) (interface{}, error) {

const licenseLine1 = "// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved."
const defaultLicenseLine2 = "// See LICENSE.txt for license information."
const defaultLicenseLine2Alt = "// See LICENSE for license information."
const enterpriseLicenseLine2 = "// See ENTERPRISE-LICENSE.txt and SOURCE-CODE-LICENSE.txt for license information."
const sourceAvailableLicenseLine2 = "// See LICENSE.enterprise for license information."

Expand Down Expand Up @@ -109,7 +110,8 @@ func run(pass *analysis.Pass) (interface{}, error) {
continue
}

if file.Comments[commentGroup].List[1].Text != licenseLine2 {
secondLine := file.Comments[commentGroup].List[1].Text
if secondLine != licenseLine2 && (licenseLine2 == defaultLicenseLine2 && secondLine != defaultLicenseLine2Alt) {
pass.Reportf(file.Comments[0].List[1].Pos(), "License wrong:\n\tseen:\n\t%s\n\t%s\n\n\texpected:\n\t%s\n\t%s", file.Comments[0].List[0].Text, file.Comments[0].List[1].Text, licenseLine1, licenseLine2)
continue
}
Expand Down

0 comments on commit e6c3a99

Please sign in to comment.