Skip to content

Commit

Permalink
Releasing 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenLooman committed Dec 9, 2022
1 parent 767c8e8 commit fe44a96
Show file tree
Hide file tree
Showing 219 changed files with 6,338 additions and 3,563 deletions.
18 changes: 17 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
Changes
=======

0.5.5 (unreleased)
0.6.0 (2022-09-12)

- Drop UnaryOperator, replaced by the proper method calls
- Minor refactoring of CLI options
- Improve MagikIndexer to determine whether a method really returns something and setting the resulting type of the method accordingly (undefined result when no new-method-doc is available, or an empty result)
- Don't overwrite already known methods in JsonTypeKeeperReader
- Add JsonTypeKeeperWriter
- Support methods returning a parameter with the `_parameter(..)` type/ParameterReferenceType
- Fix MagikGrammer better support EOLs in certain cases
- Fix showing procedure doc on hover
- Extend hover provider, now supports packages, conditions
- Support conditions
- Changes to MagikGrammar
- Rewrite parts of references to types in TypeKeeper/types. Fixes mem leaks, references to invalid/old types. MagikPreIndexer can now also be removed and methods without a type definition can be indexed
- Methods support recording used globals, called methods, used slots, used conditions. This allows for finding references and possibly method renaming in the future
- Various bug fixes
- Various new features


0.5.4 (2022-11-07)
Expand Down
2 changes: 1 addition & 1 deletion magik-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>nl.ramsolutions</groupId>
<artifactId>magik-tools</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>0.6.0</version>
</parent>

<artifactId>magik-checks</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ private CheckList() {
}

/**
* Get the list of {{MagikCheck}}s.
* @return List of with {{MagikCheck}}s
* Get the list of {@link MagikCheck}s.
* @return List of {@link MagikCheck}s.
*/
public static List<Class<?>> getChecks() {
return List.of(
Expand Down Expand Up @@ -91,8 +91,8 @@ public static List<Class<?>> getChecks() {
}

/**
* Get {{MagikCheck}}s which are disabled by default.
* @return List of {{MagikCheck}}s.
* Get {@link MagikCheck}s which are disabled by default.
* @return List of {@link MagikCheck}s.
*/
public static List<Class<?>> getDisabledByDefaultChecks() {
return getChecks().stream()
Expand All @@ -101,8 +101,8 @@ public static List<Class<?>> getDisabledByDefaultChecks() {
}

/**
* Get {{MagikCheck}}s which are templated.
* @return List of {{MagikCheck}}s.
* Get {@link MagikCheck}s which are templated.
* @return List of {@link MagikCheck}s.
*/
public static List<Class<?>> getTemplatedChecks() {
return getChecks().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public MagikIssue(final Location location, final String message, final MagikChec
}

/**
* Get the {{Location}} of the issue.
* @return {{Location}}.
* Get the {@link Location} of the issue.
* @return {@link Location}.
*/
public Location location() {
return this.location;
Expand Down Expand Up @@ -77,8 +77,8 @@ public String message() {
}

/**
* Get the {{MagikCheck}} giving the issue.
* @return {{MagikCheck}} giving the issue.
* Get the {@link MagikCheck} giving the issue.
* @return {@link MagikCheck} giving the issue.
*/
public MagikCheck check() {
return this.check;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ private Map<Token, List<Token>> extractCommentBlocks(final AstNode node) {

if (startToken == null) {
startToken = token;
} else if (lastToken.getLine() != token.getLine() - 1
|| lastToken.getColumn() != token.getColumn()) {
} else if (lastToken != null
&& (lastToken.getLine() != token.getLine() - 1
|| lastToken.getColumn() != token.getColumn())) {
// Block broken, either due to line not connecting or indent changed.

// Save current block.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.sonar.sslr.api.Token;
import java.util.Set;
import nl.ramsolutions.sw.magik.MagikFile;
import nl.ramsolutions.sw.magik.api.ExtendedTokenType;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
Expand Down Expand Up @@ -112,10 +111,6 @@ protected void walkPostMagik(final AstNode node) {

@Override
public void walkToken(final Token token) {
if (token.getType() == ExtendedTokenType.SYNTAX_ERROR) {
return;
}

this.previousToken = this.currentToken;
this.currentToken = this.nextToken;
this.nextToken = token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ private void checkDefinition(final AstNode node) {
this.addIssue(node, message);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import nl.ramsolutions.sw.magik.api.MagikGrammar;
import nl.ramsolutions.sw.magik.checks.DisabledByDefault;
import nl.ramsolutions.sw.magik.checks.MagikCheck;
Expand All @@ -18,7 +17,7 @@
/**
* Check if method docs are valid, according to SW style.
*/
@DisabledByDefault // This conflicts with {{MethodDocCheck}}!
@DisabledByDefault
@Rule(key = SwMethodDocCheck.CHECK_KEY)
public class SwMethodDocCheck extends MagikCheck {

Expand All @@ -31,7 +30,7 @@ public class SwMethodDocCheck extends MagikCheck {
@Override
protected void walkPreMethodDefinition(final AstNode node) {
final String methodDoc = this.extractDoc(node);
if (methodDoc == null) {
if (methodDoc.isBlank()) {
final String message = String.format(MESSAGE, "all");
this.addIssue(node, message);
return;
Expand Down Expand Up @@ -73,7 +72,6 @@ private Set<String> getMethodParameters(final AstNode node) {
return parameters;
}

@CheckForNull
private String extractDoc(final AstNode node) {
return MagikCommentExtractor.extractDocComments(node)
.map(Token::getValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class UndefinedVariableCheck extends MagikCheck {
@Override
protected void walkPostMagik(final AstNode node) {
final GlobalScope globalScope = this.getMagikFile().getGlobalScope();
globalScope.getScopeEntriesInScope().stream()
globalScope.getSelfAndDescendantScopes().stream()
.flatMap(scope -> scope.getScopeEntriesInScope().stream())
.filter(scopeEntry -> scopeEntry.isType(ScopeEntry.Type.GLOBAL))
.filter(scopeEntry -> this.isPrefixed(scopeEntry.getIdentifier()))
.forEach(scopeEntry -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MagikCheckTestBase {
/**
* VSCode runs from module directory, mvn runs from project directory.
*
* @return Proper {{Path}} to file.
* @return Proper {@link Path} to file.
*/
protected Path getPath(final Path relativePath) {
final Path path = Path.of(".").toAbsolutePath().getParent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ void testNotTooComplex() {
final MagikCheck check = new MethodComplexityCheck();
final String code = ""
+ "_method a.b\n"
+ " _if a"
+ " _then"
+ " _if a\n"
+ " _then\n"
+ " _endif\n"
+ "_endmethod\n";
final List<MagikIssue> issues = this.runCheck(code, check);
Expand Down
2 changes: 1 addition & 1 deletion magik-debug-adapter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>nl.ramsolutions</groupId>
<artifactId>magik-tools</artifactId>
<version>0.5.5-SNAPSHOT</version>
<version>0.6.0</version>
</parent>

<artifactId>magik-debug-adapter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ MagikBreakpoint addBreakpoint(final Source source, final SourceBreakpoint source
if (methodNode == null) {
method = "<not_in_method>";
} else {
method = helper.getPakkageExemplarMethodName();
method = helper.getFullExemplarMethodName();
methodLine = methodNode.getTokenLine();
if (methodLine == line) {
line = 0;
Expand Down Expand Up @@ -259,7 +259,7 @@ void clearFunctionBreakpoints() throws IOException, InterruptedException, Execut
* Add multiple function breakpoints.
*
* @param functionBreakpoints Breakpoints to be set.
* @return List of {{MagikBreakpoint}}s.
* @return List of {@link MagikBreakpoint}s.
* @throws ExecutionException -
* @throws InterruptedException -
* @throws IOException -
Expand All @@ -277,8 +277,8 @@ List<MagikBreakpoint> addFunctionBreakpoints(final FunctionBreakpoint[] function
/**
* Add a function breakpoint.
*
* @param functionBreakpoint {{FunctionBreakpoint}} to add.
* @return Created {{MagikBreakpoint}}.
* @param functionBreakpoint {@link FunctionBreakpoint} to add.
* @return Created {@link MagikBreakpoint}.
* @throws IOException -
* @throws ExecutionException -
* @throws InterruptedException -
Expand Down Expand Up @@ -366,7 +366,7 @@ MagikBreakpoint getBreakpoint(final long breakpointId) {

// region: Event handling
/**
* Handle a {{BreakpointEvent}}.
* Handle a {@link BreakpointEvent}.
* @param breakpointEvent event.
*/
void handleBreakpointEvent(final BreakpointEvent breakpointEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ private Lsp4jConversion() {
}

/**
* Convert a slap {{ThreadInfoResponse}} to a lsp4j {{Thread}}.
* Convert a slap {@link ThreadInfoResponse} to a lsp4j {@link Thread}.
* @param threadId ID of the thread.
* @param threadInfo Slap thread info.
* @return lsp4j {{Thread}}.
* @return lsp4j {@link Thread}.
*/
public static Thread toLsp4j(final long threadId, final ThreadInfoResponse threadInfo) {
final Thread thread = new Thread();
Expand All @@ -37,9 +37,9 @@ public static Thread toLsp4j(final long threadId, final ThreadInfoResponse threa
}

/**
* Convert a slap {{BreakpointSetResponse}} to a lsp4j {{Breakpoint}}.
* Convert a slap {@link BreakpointSetResponse} to a lsp4j {@link Breakpoint}.
* @param breakpointSet Slap breakpoint set.
* @return lsp4j {{Breakpoint}}.
* @return lsp4j {@link Breakpoint}.
*/
public static Breakpoint toLsp4j(final BreakpointSetResponse breakpointSet, final Source source) {
final Breakpoint breakpoint = new Breakpoint();
Expand All @@ -50,11 +50,11 @@ public static Breakpoint toLsp4j(final BreakpointSetResponse breakpointSet, fina
}

/**
* Convert a slap {{ThreadStackResponse.StackElement}} to lsp4j {{StackFrame}}.
* Convert a slap {@link ThreadStackResponse.StackElement} to lsp4j {@link StackFrame}.
* @param threadId Thread ID.
* @param stackElement Stack element.
* @param path Path.
* @return lsp4j {{StackFrame}}.
* @return lsp4j {@link StackFrame}.
*/
public static StackFrame toLsp4j(
final long threadId, final ThreadStackResponse.StackElement stackElement, final @Nullable Path path) {
Expand All @@ -73,10 +73,10 @@ public static StackFrame toLsp4j(
}

/**
* Convert {{MagikBreakpoint}}s to LSP4j {{Breakpoint}}s.
* Convert {@link MagikBreakpoint}s to LSP4j {@link Breakpoint}s.
* @param source Source of file.
* @param magikBreakpoints MagikBreakpoints.
* @return Array of converted LSP4j {{Breakpoint}}s.
* @return Array of converted LSP4j {@link Breakpoint}s.
*/
public static Breakpoint[] toLsp4j(final Source source, final List<MagikBreakpoint> magikBreakpoints) {
return magikBreakpoints.stream()
Expand All @@ -92,9 +92,9 @@ public static Breakpoint[] toLsp4j(final Source source, final List<MagikBreakpoi
}

/**
* Convert {{MagikVariable}}s to LSP4j {{Variable}}s.
* Convert {@link MagikVariable}s to LSP4j {@link Variable}s.
* @param magikVariables MagikVariables.
* @return List of converted LSP4j {{Variable}}s.
* @return List of converted LSP4j {@link Variable}s.
*/
public static Variable[] toLsp4j(final List<MagikVariable> magikVariables) {
return magikVariables.stream()
Expand Down
Loading

0 comments on commit fe44a96

Please sign in to comment.