Skip to content

Commit

Permalink
Fix DiKTat tests after a version bump
Browse files Browse the repository at this point in the history
FIRST_COMMENT_NO_SPACES rule renamed to FIRST_COMMENT_NO_BLANK_LINE
in saveourtool/diktat#759.

Update explicit version to 1.0.1.

Remove copyright header rules because we do not want DiKTat tests to
fail every New Year.
  • Loading branch information
lutovich committed Jan 4, 2022
1 parent af4d87a commit 9fb30cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-2022 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -90,8 +90,7 @@ void integration_default_diktat() throws IOException {
"}");
setFile("configuration.gradle.kts").toResource("kotlin/diktat/basic.dirty");
BuildResult result = gradleRunner().withArguments("spotlessApply").buildAndFail();
assertThat(result.getOutput()).contains("[HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple "
+ "or no classes should contain description of what is inside of this file: there are 0 declared classes and/or objects");
assertThat(result.getOutput()).contains("[AVOID_NESTED_FUNCTIONS] try to avoid using nested functions");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 DiffPlug
* Copyright 2021-2022 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,7 +38,10 @@ void testDiktat() throws Exception {
@Test
void testDiktatWithVersion() throws Exception {

writePomWithKotlinSteps("<diktat><version>0.4.0</version></diktat>");
writePomWithKotlinSteps(
"<diktat>",
" <version>1.0.1</version>",
"</diktat>");

String path = "src/main/kotlin/Main.kt";
setFile(path).toResource("kotlin/diktat/main.dirty");
Expand All @@ -51,7 +54,11 @@ void testDiktatConfig() throws Exception {

String configPath = "src/main/kotlin/diktat-analysis.yml";
File conf = setFile(configPath).toResource("kotlin/diktat/diktat-analysis.yml");
writePomWithKotlinSteps("<diktat><version>0.4.0</version><configFile>" + conf.getAbsolutePath() + "</configFile></diktat>");
writePomWithKotlinSteps(
"<diktat>",
" <version>1.0.1</version>",
" <configFile>" + conf.getAbsolutePath() + "</configFile>",
"</diktat>");

String path = "src/main/kotlin/Main.kt";
setFile(path).toResource("kotlin/diktat/main.dirty");
Expand Down
9 changes: 1 addition & 8 deletions testlib/src/main/resources/kotlin/diktat/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@
enabled: 'true'
- name: HEADER_WRONG_FORMAT
enabled: true
- name: HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE
enabled: true
- name: HEADER_MISSING_OR_WRONG_COPYRIGHT
enabled: true
configuration:
isCopyrightMandatory: false
copyrightText: 'Copyright (c) Your Company Name Here. 2010-2021'
- name: HEADER_NOT_BEFORE_PACKAGE
enabled: true
- name: FILE_IS_TOO_LONG
Expand Down Expand Up @@ -182,7 +175,7 @@
- name: WRONG_NEWLINES_AROUND_KDOC
enabled: true
# Inspection that checks if there is no blank lines before first comment
- name: FIRST_COMMENT_NO_SPACES
- name: FIRST_COMMENT_NO_BLANK_LINE
enabled: true
# Inspection that checks if there are blank lines between code and comment and between code start token and comment's text
- name: COMMENT_WHITE_SPACE
Expand Down

0 comments on commit 9fb30cd

Please sign in to comment.