Skip to content

Commit

Permalink
Merge branch 'release/V2.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
gquerret committed Sep 9, 2022
2 parents 083c3a4 + 123ebbd commit 853027c
Show file tree
Hide file tree
Showing 46 changed files with 438 additions and 249 deletions.
16 changes: 8 additions & 8 deletions coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>coverage-report</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>

<name>JaCoCo report</name>
<description>Fake module for code coverage report in SonarQube</description>
Expand All @@ -20,37 +20,37 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion database-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>

<name>OpenEdge database definition lexer and parser</name>
<description>OpenEdge dump files parser</description>
Expand Down
2 changes: 1 addition & 1 deletion listing-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>

<name>OpenEdge listing so-called parser</name>
<description>OpenEdge listing files parser</description>
Expand Down
6 changes: 3 additions & 3 deletions openedge-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>

<name>OpenEdge checks</name>
<description>OpenEdge checks</description>
Expand Down Expand Up @@ -55,12 +55,12 @@
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
Expand Down
8 changes: 4 additions & 4 deletions openedge-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
<packaging>sonar-plugin</packaging>

<name>OpenEdge plugin for SonarQube</name>
Expand Down Expand Up @@ -60,17 +60,17 @@
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public void execute(InputFile file, ParseUnit unit) {
private void handleFunctionBlock(InputFile file, JPNode node) {
List<JPNode> ch = node.getDirectChildren();
boolean containsForward = ch.stream().map(JPNode::getNodeType).anyMatch(type -> type == ABLNodeType.FORWARDS);
boolean containsSuper = ch.stream().map(JPNode::getNodeType).anyMatch(type -> type == ABLNodeType.SUPER);
boolean containsIn = ch.stream().map(JPNode::getNodeType).anyMatch(type -> type == ABLNodeType.IN);
boolean containsMap = ch.stream().map(JPNode::getNodeType).anyMatch(type -> type == ABLNodeType.MAP);
if (containsForward || containsSuper || containsMap) {
if (containsForward || containsIn || containsMap) {
// Last child should be PERIOD
JPNode lastCh = ch.get(ch.size() - 1);
if (lastCh.getNodeType() != ABLNodeType.PERIOD) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public class OpenEdgeComponents {

private boolean initialized = false;
private String analytics = "";
private int ncLoc = 0;

public OpenEdgeComponents() {
this(null, null, null, null);
Expand Down Expand Up @@ -169,6 +170,14 @@ public String getAnalytics() {
return analytics;
}

public void setNcLoc(int ncLoc) {
this.ncLoc = ncLoc;
}

public int getNcLoc() {
return ncLoc;
}

public Map<ActiveRule, OpenEdgeProparseCheck> getProparseRules() {
return Collections.unmodifiableMap(ppChecksMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class OpenEdgeProparseSensor implements Sensor {
private int numXREF;
private int numListings;
private int numFailures;
private int ncLocs;
private int ncLoc;

// Timing statistics
private Map<String, Long> ruleTime = new HashMap<>();
Expand Down Expand Up @@ -183,7 +183,6 @@ public void execute(SensorContext context) {

computeAnalytics(context);
logStatistics();
context.addContextProperty("sonar.oe.ncloc", Integer.toString(ncLocs));
generateProparseDebugIndex();
}

Expand Down Expand Up @@ -213,7 +212,7 @@ private void parseIncludeFile(SensorContext context, InputFile file, IProparseEn
// Saving LOC and COMMENTS metrics
context.newMeasure().on(file).forMetric((Metric) CoreMetrics.NCLOC).withValue(
lexUnit.getMetrics().getLoc()).save();
ncLocs += lexUnit.getMetrics().getLoc();
ncLoc += lexUnit.getMetrics().getLoc();
context.newMeasure().on(file).forMetric((Metric) CoreMetrics.COMMENT_LINES).withValue(
lexUnit.getMetrics().getComments()).save();
}
Expand Down Expand Up @@ -417,16 +416,18 @@ private void updateParseTime(long elapsedTime) {
}

private void computeAnalytics(SensorContext context) {
// Store value in OpenEdgeComponents object
components.setAnalytics(String.format(
"files=%1$d,failures=%2$d,parseTime=%3$d,maxParseTime=%4$d,version=\"%5$s\",ncloc=%6$d,oeversion=\"%7$s\"",
numFiles, numFailures, parseTime, maxParseTime, context.runtime().getApiVersion().toString(), ncLocs,
settings.getOpenEdgePluginVersion()));
// Store values in OpenEdgeComponents instance. Used by client-side sensor in rules package.
components.setAnalytics(
String.format("files=%1$d,failures=%2$d,parseTime=%3$d,maxParseTime=%4$d,ncloc=%5$d,oeversion=\"%6$s\"",
numFiles, numFailures, parseTime, maxParseTime, ncLoc, settings.getOpenEdgePluginVersion()));
components.setNcLoc(ncLoc);
// And make the value available the value available to Compute Engine task
context.addContextProperty("sonar.oe.ncloc", Integer.toString(ncLoc));
}

private void logStatistics() {
LOG.info("{} files proparse'd, {} XREF files, {} listing files, {} failure(s), {} NCLOCs", numFiles, numXREF,
numListings, numFailures, ncLocs);
numListings, numFailures, ncLoc);
LOG.info("AST Generation | time={} ms", parseTime);
LOG.info("XREF Parsing | time={} ms", xmlParseTime);
LOG.info("Rules | time={} ms", ruleTime.values().stream().reduce(0L, Long::sum));
Expand Down Expand Up @@ -501,7 +502,7 @@ private void computeCpd(SensorContext context, InputFile file, ParseUnit unit) {
private void computeSimpleMetrics(SensorContext context, InputFile file, ParseUnit unit) {
// Saving LOC, COMMENTS and DIRECTIVES metrics
context.newMeasure().on(file).forMetric((Metric) CoreMetrics.NCLOC).withValue(unit.getMetrics().getLoc()).save();
ncLocs += unit.getMetrics().getLoc();
ncLoc += unit.getMetrics().getLoc();
context.newMeasure().on(file).forMetric((Metric) CoreMetrics.COMMENT_LINES).withValue(
unit.getMetrics().getComments()).save();
context.newMeasure().on(file).forMetric((Metric) OpenEdgeMetrics.DIRECTIVES).withValue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void test5() {
assertEquals(context.allIssues().size(), 1);
Iterator<Issue> iter = context.allIssues().iterator();
Issue issue1 = iter.next();
assertEquals(issue1.primaryLocation().textRange().start().line(), 10);
assertEquals(issue1.primaryLocation().textRange().start().line(), 11);
}

@Test
Expand Down
3 changes: 2 additions & 1 deletion openedge-plugin/src/test/resources/clumsy05.p
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ end function.
function f2 returns int forwards.
function f3 returns int in super.
function f4 returns int map to xxx in this-procedure.
function f5 returns int ():
def var hdl as handle. function f5 returns int in hdl.
function f6 returns int ():
message 'hello'.
end
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>eu.rssw</groupId>
<artifactId>sonar-openedge</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
<packaging>pom</packaging>

<name>OpenEdge plugin for SonarQube</name>
Expand Down
2 changes: 1 addition & 1 deletion profiler-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>

<name>OpenEdge profiler output lexer and parser</name>
<description>OpenEdge profiler files parser</description>
Expand Down
4 changes: 2 additions & 2 deletions proparse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>

<name>Proparse</name>
<description>ABL code parser</description>
Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.16.1</version>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
Expand Down
15 changes: 8 additions & 7 deletions proparse/src/main/antlr4/imports/BaseTokenTypes.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ Program_tail=182
Property_getter=183
Property_setter=184
Record_name=185
System_handle=186
Type_name=187
Typeless_token=188
User_func=189
Widget_ref=190
With_columns=191
With_down=192
Record_search=186
System_handle=187
Type_name=188
Typeless_token=189
User_func=190
Widget_ref=191
With_columns=192
With_down=193


AACBIT=201
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ blockOption:
;

blockPreselect:
PRESELECT forRecordSpec
PRESELECT multiRecordSearch
;

statement:
Expand Down Expand Up @@ -498,12 +498,12 @@ eventList:

functionArgs:
// Use funargs /only/ if it is the child of a root-node keyword.
LEFTPAREN expression ( COMMA expression )* RIGHTPAREN
LEFTPAREN parameter ( COMMA parameter )* RIGHTPAREN
;

optionalFunctionArgs:
// Use optfunargs /only/ if it is the child of a root-node keyword.
LEFTPAREN ( expression ( COMMA expression )* )? RIGHTPAREN
LEFTPAREN ( parameter ( COMMA parameter )* )? RIGHTPAREN
;

// ... or value phrases
Expand Down Expand Up @@ -1216,7 +1216,7 @@ connectStatement:

constructorStatement:
CONSTRUCTOR
( PUBLIC | PROTECTED | PRIVATE | STATIC )?
( PUBLIC | PROTECTED | PRIVATE | STATIC | PACKAGEPRIVATE | PACKAGEPROTECTED )?
tn=typeName2 functionParams blockColon
codeBlock
constructorEnd statementEnd
Expand Down Expand Up @@ -1355,7 +1355,7 @@ createWidgetPoolStatement:
;

canFindFunction:
CANFIND LEFTPAREN findWhich? recordPhrase RIGHTPAREN
CANFIND LEFTPAREN recordSearch RIGHTPAREN
;

currentValueFunction:
Expand Down Expand Up @@ -2121,23 +2121,27 @@ finallyEnd:
;

findStatement:
FIND findWhich? recordPhrase ( NOWAIT | NOPREFETCH | NOERROR )* statementEnd
FIND recordSearch ( NOWAIT | NOPREFETCH | NOERROR )* statementEnd
;

fontExpression:
FONT expression
;

forStatement:
FOR forRecordSpec blockOption* forstate_sub
FOR multiRecordSearch blockOption* forstate_sub
;

forstate_sub:
blockColon codeBlock blockEnd
;

forRecordSpec:
findWhich? recordPhrase (COMMA findWhich? recordPhrase)*
multiRecordSearch:
recordSearch (COMMA recordSearch)*
;

recordSearch:
findWhich? recordPhrase
;

formatExpression:
Expand Down Expand Up @@ -2826,7 +2830,7 @@ onAction:
;

openQueryStatement:
OPEN QUERY identifier ( FOR | PRESELECT ) forRecordSpec
OPEN QUERY identifier ( FOR | PRESELECT ) multiRecordSearch
openQueryOption*
statementEnd
;
Expand Down
Loading

0 comments on commit 853027c

Please sign in to comment.