GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [modelica] Follow-up fixes for Modelica language module by atrosinenko · Pull Request #2169 · pmd/pmd

[modelica] Follow-up fixes for Modelica language module #2169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
adangel merged 1 commit into pmd:master from atrosinenko:modelica-followup-fixes
Dec 18, 2019

Uh oh!

There was an error while loading. Please reload this page.

Merged

[modelica] Follow-up fixes for Modelica language module #2169

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
6224bd3
[modelica] Follow-up fixes for Modelica language module
atrosinenko Dec 17, 2019
File filter
Filter by extension


Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

4 changes: 0 additions & 4 deletions 4 pmd-modelica/pom.xml
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions 4 pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ast/ASTClassDefinition.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ public class ASTClassDefinition extends AbstractModelicaNode {
private ModelicaClassSpecialization specialization;
private ModelicaClassSpecifierNode specifier;

public ASTClassDefinition(int id) {
ASTClassDefinition(int id) {
super(id);
}

public ASTClassDefinition(ModelicaParser p, int id) {
ASTClassDefinition(ModelicaParser p, int id) {
super(p, id);
}

Expand Down
4 changes: 2 additions & 2 deletions 4 pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ast/ASTElementList.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
public class ASTElementList extends AbstractModelicaNode {
private Visibility visibility;

public ASTElementList(int id) {
ASTElementList(int id) {
super(id);
}

public ASTElementList(ModelicaParser p, int id) {
ASTElementList(ModelicaParser p, int id) {
super(p, id);
}

Expand Down
3 changes: 2 additions & 1 deletion 3 pmd-modelica/src/main/java/net/sourceforge/pmd/lang/modelica/ast/ASTStoredDefinition.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

package net.sourceforge.pmd.lang.modelica.ast;

import net.sourceforge.pmd.lang.ast.RootNode;
import net.sourceforge.pmd.lang.modelica.resolver.CompositeName;

/**
* A representation of a Modelica source code file.
*/
public class ASTStoredDefinition extends AbstractModelicaNode {
public class ASTStoredDefinition extends AbstractModelicaNode implements RootNode {
private boolean hasBOM = false;

ASTStoredDefinition(int id) {
Expand Down
56 changes: 56 additions & 0 deletions 56 pmd-modelica/src/main/resources/category/modelica/bestpractices.xml
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Rules which enforce generally accepted best practices.
<rule name="ClassStartNameEqualsEndName"
language="modelica"
message="Class ends with an end clause with a different name"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_modelica_bestpractices.html#classstartnameequalsendname"
class="net.sourceforge.pmd.lang.rule.XPathRule">
<description>
Having a class starting with some name and some *different*
Expand All @@ -27,27 +28,82 @@ Rules which enforce generally accepted best practices.
</value>
</property>
</properties>
<example>
<![CDATA[
model SomeName
Real x;
equation
x = 1;
end SomeOtherName /* should be SomeName */;
]]>
</example>
</rule>

<rule name="ConnectUsingNonConnector"
language="modelica"
message="Arguments passed to `connect` should be connectors, not `{0}`"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_modelica_bestpractices.html#connectusingnonconnector"
class="net.sourceforge.pmd.lang.modelica.rule.ConnectUsingNonConnector">
<description>
Modelica specification requires passing connectors to the `connect` clause,
while some implementations tolerate using it on plain variables, etc..
</description>
<priority>2</priority>
<example>
<![CDATA[
package Example
connector Conn
Real x;
Real y;
end Conn;

model Test
input Conn c1;
output Conn c2;
input Real x1;
output Real x2;
equation
connect(c1, c2); // OK
connect(x1, x2); // error, x1 and x2 are not (both) connectors
// x1 = x2; // OK
end Test;
end Example;
]]>
</example>
</rule>

<rule name="AmbiguousResolution"
language="modelica"
message="Type resolution is ambiguous: {0}"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_modelica_bestpractices.html#ambiguousresolution"
class="net.sourceforge.pmd.lang.modelica.rule.AmbiguousResolutionRule">
<description>
There is multiple candidates for this type resolution. While generally this is not an error,
this may indicate a bug.
</description>
<priority>3</priority>
<example>
<![CDATA[
package Test
package Inc1
model X
end X;
model Y
end Y;
end Inc1;
package Inc2
model Y
end Y;
model Z
end Z;
end Inc2;
model B
import Test.Inc1.*;
import Test.Inc2.*;
Y y; // Class Y is imported twice
end B;
end Test;
]]>
</example>
</rule>
</ruleset>
6 changes: 2 additions & 4 deletions 6 ...esources/net/sourceforge/pmd/lang/modelica/rule/bestpractices/xml/AmbiguousResolution.xml
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ end Test;
]]></code>
</test-code>
<test-code>
<description>Invalid example: class Y is both placed to the scope by extending and import</description>
<description>Invalid example: class Y is imported twice</description>
<expected-problems>1</expected-problems>
<code><![CDATA[
package Test
Expand All @@ -64,8 +64,7 @@ package Test
end Test;
]]></code>
</test-code>
<!--
<test-code>
<test-code regressionTest="false">
<description>Invalid example: suspicious reference to X</description>
<expected-problems>1</expected-problems>
<code><![CDATA[
Expand All @@ -78,5 +77,4 @@ package Test
end Test;
]]></code>
</test-code>
-->
</test-data>
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.