Skip to content

Commit

Permalink
Years in copyright examples updated to 2021
Browse files Browse the repository at this point in the history
### What's done:
* Years updated
  • Loading branch information
petertrr committed Jan 6, 2021
1 parent c852602 commit 9664339
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion diktat-rules/src/main/resources/diktat-analysis-huawei.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
enabled: true
configuration:
isCopyrightMandatory: true
copyrightText: ' Copyright (c) Huawei Technologies Co., Ltd. 2012-2020. All rights reserved.'
copyrightText: ' Copyright (c) Huawei Technologies Co., Ltd. 2012-2021. All rights reserved.'
# Checks that header kdoc is located before package directive
- name: HEADER_NOT_BEFORE_PACKAGE
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion diktat-rules/src/main/resources/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
enabled: true
configuration:
isCopyrightMandatory: true
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2020'
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021'
# Checks that header kdoc is located before package directive
- name: HEADER_NOT_BEFORE_PACKAGE
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import generated.WarningNames.WRONG_COPYRIGHT_YEAR
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Tags
import org.junit.jupiter.api.Test
import java.time.LocalDate

class HeaderCommentRuleFixTest : FixTestBase(
"test/paragraph2/header",
Expand All @@ -19,7 +20,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
RulesConfig("HEADER_MISSING_OR_WRONG_COPYRIGHT", true,
mapOf(
"isCopyrightMandatory" to "true",
"copyrightText" to "Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.")
"copyrightText" to "Copyright (c) Huawei Technologies Co., Ltd. 2020-${LocalDate.now().year}. All rights reserved.")
),
RulesConfig("HEADER_WRONG_FORMAT", true, emptyMap())
)
Expand All @@ -36,6 +37,9 @@ class HeaderCommentRuleFixTest : FixTestBase(
fixAndCompare("AutoCopyrightExpected.kt", "AutoCopyrightTest.kt")
}

/**
* Fixme there shouldn't be an additional blank line after copyright
*/
@Test
@Tag(WarningNames.HEADER_NOT_BEFORE_PACKAGE)
fun `header KDoc should be moved before package`() {
Expand Down Expand Up @@ -74,7 +78,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
listOf(RulesConfig(HEADER_MISSING_OR_WRONG_COPYRIGHT.name, true, mapOf(
"isCopyrightMandatory" to "true",
"copyrightText" to """
| Copyright 2018-2020 John Doe.
| Copyright 2018-${LocalDate.now().year} John Doe.
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) {
)
private val rulesConfigListYear: List<RulesConfig> = listOf(
RulesConfig("HEADER_MISSING_OR_WRONG_COPYRIGHT", true,
mapOf("copyrightText" to "Copyright (c) 2020 My Company, Ltd. All rights reserved."))
mapOf("copyrightText" to "Copyright (c) $curYear My Company, Ltd. All rights reserved."))
)
private val rulesConfigListCn: List<RulesConfig> = listOf(
RulesConfig("HEADER_MISSING_OR_WRONG_COPYRIGHT", true,
mapOf("copyrightText" to "版权所有 (c) 华为技术有限公司 2012-2020"))
mapOf("copyrightText" to "版权所有 (c) 华为技术有限公司 2012-$curYear"))
)
private val curYearCopyright = "Copyright (c) My Company, Ltd. 2012-$curYear. All rights reserved."
private val copyrightBlock = """
Expand Down Expand Up @@ -75,7 +75,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) {
lintMethod(
"""
/*
* 版权所有 (c) 华为技术有限公司 2012-2020
* 版权所有 (c) 华为技术有限公司 2012-$curYear
*/
/**
* Very useful description, why this file has two classes
Expand Down Expand Up @@ -191,7 +191,7 @@ class HeaderCommentRuleTest : LintTestBase(::HeaderCommentRule) {
lintMethod(
"""
/*
* Copyright (c) 2020 My Company, Ltd. All rights reserved.
* Copyright (c) $curYear My Company, Ltd. All rights reserved.
*/
/**
* Very useful description, why this file has two classes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test

import kotlinx.serialization.encodeToString
import java.time.LocalDate

typealias ruleToConfig = Map<Warnings, Map<String, String>>

Expand Down Expand Up @@ -110,7 +111,7 @@ class DiktatSmokeTest : FixTestBase("test/smoke/src/main/kotlin",
mapOf(
Warnings.HEADER_MISSING_OR_WRONG_COPYRIGHT to mapOf(
"isCopyrightMandatory" to "true",
"copyrightText" to """|Copyright 2018-2020 John Doe.
"copyrightText" to """|Copyright 2018-${LocalDate.now().year} John Doe.
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.
*/

package test.paragraph2.header
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) My Company., Ltd. 2012-2020. All rights reserved.
* Copyright (c) My Company., Ltd. 2012-2021. All rights reserved.
*/
/**
* Lorem ipsum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.
*/
/**
* Lorem ipsum
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/*
Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.
*/


/**
* Lorem ipsum
* dolor sit amet
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2020 John Doe.
Copyright 2018-2021 John Doe.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. All rights reserved.
*/

/**
* This is a file used in unit test
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2018-2020 John Doe.
Copyright 2018-2021 John Doe.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion examples/gradle-groovy-dsl/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
enabled: true
configuration:
isCopyrightMandatory: true
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2020'
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021'
- name: HEADER_NOT_BEFORE_PACKAGE
enabled: true
- name: HEADER_CONTAINS_DATE_OR_AUTHOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
enabled: true
configuration:
isCopyrightMandatory: true
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2020'
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021'
- name: HEADER_NOT_BEFORE_PACKAGE
enabled: true
- name: HEADER_CONTAINS_DATE_OR_AUTHOR
Expand Down
2 changes: 1 addition & 1 deletion examples/gradle-kotlin-dsl/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
enabled: true
configuration:
isCopyrightMandatory: true
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2020'
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021'
- name: HEADER_NOT_BEFORE_PACKAGE
enabled: true
- name: HEADER_CONTAINS_DATE_OR_AUTHOR
Expand Down
2 changes: 1 addition & 1 deletion examples/maven/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
enabled: true
configuration:
isCopyrightMandatory: true
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2020'
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021'
- name: HEADER_NOT_BEFORE_PACKAGE
enabled: true
- name: HEADER_CONTAINS_DATE_OR_AUTHOR
Expand Down

0 comments on commit 9664339

Please sign in to comment.