Skip to content

Commit

Permalink
Revert change
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaanspeck committed Nov 18, 2024
1 parent 5d11933 commit 4b864c0
Show file tree
Hide file tree
Showing 38 changed files with 127 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down Expand Up @@ -59,7 +60,7 @@ class CommentedCodeCheckTest extends MagikCheckTestBase {
""",
})
void testValid(final String code) {
final CommentedCodeCheck check = new CommentedCodeCheck();
final MagikCheck check = new CommentedCodeCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand Down Expand Up @@ -117,14 +118,14 @@ void testValid(final String code) {
""",
})
void testInvalid(final String code) {
final CommentedCodeCheck check = new CommentedCodeCheck();
final MagikCheck check = new CommentedCodeCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}

@Test
void testInvalid2() {
final CommentedCodeCheck check = new CommentedCodeCheck();
final MagikCheck check = new CommentedCodeCheck();
final String code =
"""
_method a.b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -45,7 +46,7 @@ class DuplicateMethodInFileCheckTest extends MagikCheckTestBase {
""",
})
void testValid(final String code) {
final DuplicateMethodInFileCheck check = new DuplicateMethodInFileCheck();
final MagikCheck check = new DuplicateMethodInFileCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand Down Expand Up @@ -85,7 +86,7 @@ void testValid(final String code) {
""",
})
void testInvalid(final String code) {
final DuplicateMethodInFileCheck check = new DuplicateMethodInFileCheck();
final MagikCheck check = new DuplicateMethodInFileCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -47,7 +48,7 @@ class EmptyBlockCheckTest extends MagikCheckTestBase {
""",
})
void testValid(final String code) {
final EmptyBlockCheck check = new EmptyBlockCheck();
final MagikCheck check = new EmptyBlockCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand Down Expand Up @@ -97,7 +98,7 @@ void testValid(final String code) {
""",
})
void testInvalid(final String code) {
final EmptyBlockCheck check = new EmptyBlockCheck();
final MagikCheck check = new EmptyBlockCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.api.Test;

Expand All @@ -16,7 +17,7 @@ void testNotInLoadList() throws IllegalArgumentException, IOException {
final Path path =
Path.of(
"magik-checks/src/test/resources/test_product/test_module/source/not_in_load_list.magik");
final FileNotInLoadListCheck check = new FileNotInLoadListCheck();
final MagikCheck check = new FileNotInLoadListCheck();
final List<MagikIssue> issues = this.runCheck(path, check);
assertThat(issues).isNotEmpty();
}
Expand All @@ -26,7 +27,7 @@ void testInLoadList() throws IllegalArgumentException, IOException {
final Path path =
Path.of(
"magik-checks/src/test/resources/test_product/test_module/source/in_load_list.magik");
final FileNotInLoadListCheck check = new FileNotInLoadListCheck();
final MagikCheck check = new FileNotInLoadListCheck();
final List<MagikIssue> issues = this.runCheck(path, check);
assertThat(issues).isEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -17,7 +18,7 @@ class ForbiddenCallCheckTest extends MagikCheckTestBase {
"sw:do_something(1)",
})
void testValid(final String code) {
final ForbiddenCallCheck check = new ForbiddenCallCheck();
final MagikCheck check = new ForbiddenCallCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand All @@ -26,7 +27,7 @@ void testValid(final String code) {
@ValueSource(
strings = {"show(1)", "sw:show(1)", "a.sys!slot(:a)", "a.sys!perform(:|xyz()|, x, y, z)"})
void testInvalid(final String code) {
final ForbiddenCallCheck check = new ForbiddenCallCheck();
final MagikCheck check = new ForbiddenCallCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down Expand Up @@ -44,7 +45,7 @@ class FormattingCheckTest extends MagikCheckTestBase {
""",
})
void testProper(final String code) {
final FormattingCheck check = new FormattingCheck();
final MagikCheck check = new FormattingCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand All @@ -62,14 +63,14 @@ void testProper(final String code) {
"$\n$",
})
void testImproper(final String code) {
final FormattingCheck check = new FormattingCheck();
final MagikCheck check = new FormattingCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}

@Test
void testFile() throws IllegalArgumentException, IOException {
final FormattingCheck check = new FormattingCheck();
final MagikCheck check = new FormattingCheck();
final Path path =
Path.of(
"magik-checks/src/test/resources/test_product/test_module/source/in_load_list.magik");
Expand Down Expand Up @@ -139,14 +140,14 @@ void testSpaceIndentLineStrtWithSpaces() {
})
@SuppressWarnings("java:S4144")
void testMultipleWhitelines(final String code) {
final FormattingCheck check = new FormattingCheck();
final MagikCheck check = new FormattingCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}

@Test
void testMultipleWhitelinesMethodDoc() {
final FormattingCheck check = new FormattingCheck();
final MagikCheck check = new FormattingCheck();
final String code =
"""
_method object.method(param)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -39,7 +40,7 @@ class HidesVariableCheckTest extends MagikCheckTestBase {
""",
})
void testValid(final String code) {
final HidesVariableCheck check = new HidesVariableCheck();
final MagikCheck check = new HidesVariableCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand Down Expand Up @@ -89,7 +90,7 @@ void testValid(final String code) {
""",
})
void testInvalid(final String code) {
final HidesVariableCheck check = new HidesVariableCheck();
final MagikCheck check = new HidesVariableCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -59,7 +60,7 @@ class ImportMissingDefinitionCheckTest extends MagikCheckTestBase {
""",
})
void testImportValid(final String code) {
final ImportMissingDefinitionCheck check = new ImportMissingDefinitionCheck();
final MagikCheck check = new ImportMissingDefinitionCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand All @@ -84,7 +85,7 @@ void testImportValid(final String code) {
""",
})
void testImportInvalid(final String code) {
final ImportMissingDefinitionCheck check = new ImportMissingDefinitionCheck();
final MagikCheck check = new ImportMissingDefinitionCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -20,7 +21,7 @@ class LhsRhsComparatorCheckTest extends MagikCheckTestBase {
"a >= b",
})
void testValid(final String code) {
final LhsRhsComparatorEqualCheck check = new LhsRhsComparatorEqualCheck();
final MagikCheck check = new LhsRhsComparatorEqualCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand All @@ -35,7 +36,7 @@ void testValid(final String code) {
"a >= a",
})
void testInvalid(final String code) {
final LhsRhsComparatorEqualCheck check = new LhsRhsComparatorEqualCheck();
final MagikCheck check = new LhsRhsComparatorEqualCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.api.Test;

Expand All @@ -12,7 +13,7 @@ class LineLengthCheckTest extends MagikCheckTestBase {

@Test
void testLineNotTooLong1() {
final LineLengthCheck check = new LineLengthCheck();
final MagikCheck check = new LineLengthCheck();
final String code =
"""
# this is ok
Expand All @@ -24,7 +25,7 @@ void testLineNotTooLong1() {

@Test
void testLineNotTooLong2() {
final LineLengthCheck check = new LineLengthCheck();
final MagikCheck check = new LineLengthCheck();
final String code =
"""
l_23456789012345678901234567890
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand Down Expand Up @@ -40,7 +41,7 @@ class LocalImportProcedureCheckTest extends MagikCheckTestBase {
""",
})
void testValid(final String code) {
final LocalImportProcedureCheck check = new LocalImportProcedureCheck();
final MagikCheck check = new LocalImportProcedureCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}
Expand All @@ -59,7 +60,7 @@ void testValid(final String code) {
""",
})
void testInvalid(final String code) {
final LocalImportProcedureCheck check = new LocalImportProcedureCheck();
final MagikCheck check = new LocalImportProcedureCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).hasSize(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -41,7 +42,7 @@ void testTooComplex() {

@Test
void testNotTooComplex() {
final MethodComplexityCheck check = new MethodComplexityCheck();
final MagikCheck check = new MethodComplexityCheck();
final String code =
"""
_method a.b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -73,7 +74,7 @@ void testProcedureOk() {

@Test
void testSyntaxError() {
final MethodLineCountCheck check = new MethodLineCountCheck();
final MagikCheck check = new MethodLineCountCheck();
final String code =
"""
_method a.b
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import java.util.List;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import nl.ramsolutions.sw.magik.checks.MagikIssue;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
Expand Down Expand Up @@ -40,14 +41,14 @@ class NoSelfUseCheckTest extends MagikCheckTestBase {
""",
})
void testValid(final String code) {
final NoSelfUseCheck check = new NoSelfUseCheck();
final MagikCheck check = new NoSelfUseCheck();
final List<MagikIssue> issues = this.runCheck(code, check);
assertThat(issues).isEmpty();
}

@Test
void testInvalid() {
final NoSelfUseCheck check = new NoSelfUseCheck();
final MagikCheck check = new NoSelfUseCheck();
final String code =
"""
_method a.b
Expand Down
Loading

0 comments on commit 4b864c0

Please sign in to comment.