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 28867b6 commit a47192f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
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
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 a47192f

Please sign in to comment.