intervals, int value) {
- for (Interval interval : intervals) {
- if(interval.compareTo(value) == 0) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void finishLocalSetup() {
- }
-}
diff --git a/scripts/tools/checkstyle/NoEmbeddedPlusPlusCheck.java b/scripts/tools/checkstyle/NoEmbeddedPlusPlusCheck.java
deleted file mode 100644
index 9860618b209..00000000000
--- a/scripts/tools/checkstyle/NoEmbeddedPlusPlusCheck.java
+++ /dev/null
@@ -1,146 +0,0 @@
-import java.util.BitSet;
-
-import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-import com.puppycrawl.tools.checkstyle.utils.TokenUtil;
-
-import static com.puppycrawl.tools.checkstyle.api.TokenTypes.*;
-
-/**
- * This class implements a checkstyle rule which asserts that increment and
- * decrement expressions do only occur as individual commands.
- *
- * This is meant to avoid rather unreadable code like
- *
- *
- * for (int k = left; ++left <= right; k = ++left)
- *
- *
- * (taken from JDK's DualPivotQuicksort.java).
- *
- * Check
- *
- * The check scans all occurrences of pre- and postincrements and checks their
- * parents and grandparents in the AST. First parent is checked (see
- * "admissibleParents" in configuration below). If the parent is EXPR, then
- * the grandparent AST type is also checked.
- *
- * Configuration
- *
- * The check can be configured from the style file as follows:
- *
- *
- * <module name="NoEmbeddedPlusPlus">
- * <property name="admissibleParents" value="EXPR"/>
- * <property name="admissibleGrandParents"
- * value="SLIST, ELIST, LITERAL_WHILE,
- * LITERAL_FOR, LITERAL_IF"/>
- * <message key="parent"
- * value="Unallowed increment/decrement operation."/>
- * <message key="grandParent"
- * value="Unallowed increment/decrement operation."/>
- * </module>
- *
- *
- * This lists also the default values.
- *
- * @author Mattias Ulbrich
- * @version 1
- * @since May 2017
- */
-public class NoEmbeddedPlusPlusCheck extends AbstractCheck {
-
- private static final int[] DEFAULT_TOKENS =
- { DEC, INC, POST_DEC, POST_INC };
-
- private static final int[] ADMISSIBLE_PARENTS =
- { EXPR };
-
- private static final int[] ADMISSIBLE_GRAND_PARENTS =
- { SLIST, ELIST, LITERAL_WHILE, LITERAL_FOR, LITERAL_IF };
-
- private static final String DEFAULT_PARENT_MESSAGE =
- "Unallowed increment/decrement operation.";
-
- private static final String DEFAULT_GRAND_PARENT_MESSAGE =
- "Unallowed increment/decrement operation.";
-
- private BitSet admissibleParents = new BitSet();
- private BitSet admissibleGrandParents = new BitSet();
- private String parentMessage = DEFAULT_PARENT_MESSAGE;
- private String grandParentMessage = DEFAULT_GRAND_PARENT_MESSAGE;
-
- public NoEmbeddedPlusPlusCheck() {
- setBits(this.admissibleParents, ADMISSIBLE_PARENTS);
- setBits(this.admissibleGrandParents, ADMISSIBLE_GRAND_PARENTS);
- }
-
- private void setBits(BitSet bitset, int[] bits) {
- for (int bit : bits) {
- bitset.set(bit);
- }
- }
-
- @Override
- public void visitToken(DetailAST ast) {
-
- DetailAST parent = ast.getParent();
-
- if(parent != null) {
- int id = parent.getType();
- if(!admissibleParents.get(id)) {
- log(ast.getLineNo(), ast.getColumnNo(),
- parentMessage);
- }
-
- if(id == TokenTypes.EXPR) {
- int gid = parent.getParent().getType();
- if(!admissibleGrandParents.get(gid)) {
- log(ast.getLineNo(), ast.getColumnNo(),
- grandParentMessage);
- }
- }
- }
-
- }
-
- @Override
- public int[] getDefaultTokens() {
- return DEFAULT_TOKENS;
- }
-
- public void setAdmissibleParents(String... parentTokens) {
- admissibleParents.clear();
- for (int i = 0; i < parentTokens.length; i++) {
- admissibleParents.set(TokenUtil.getTokenId(parentTokens[i]));
- }
- }
-
- public void setParentMessage(String parentMessage) {
- this.parentMessage = parentMessage;
- }
-
- public void setGrandAdmissibleParents(String... parentTokens) {
- admissibleGrandParents.clear();
- for (int i = 0; i < parentTokens.length; i++) {
- admissibleGrandParents.set(TokenUtil.getTokenId(parentTokens[i]));
- }
- }
-
-
- public void setGrandParentMessage(String grandParentMessage) {
- this.grandParentMessage = grandParentMessage;
- }
-
- @Override
- public int[] getRequiredTokens() {
- return getDefaultTokens();
- }
-
- @Override
- public int[] getAcceptableTokens() {
- return getDefaultTokens();
- }
-
-}
diff --git a/scripts/tools/checkstyle/checkstyle-10.6.0-all.jar b/scripts/tools/checkstyle/checkstyle-10.6.0-all.jar
deleted file mode 100644
index 22bb2171aa1..00000000000
Binary files a/scripts/tools/checkstyle/checkstyle-10.6.0-all.jar and /dev/null differ
diff --git a/scripts/tools/checkstyle/publishAudit.pl b/scripts/tools/checkstyle/publishAudit.pl
deleted file mode 100755
index 52ae2eb952b..00000000000
--- a/scripts/tools/checkstyle/publishAudit.pl
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/perl -w
-
-
-#
-# THIS PROGRAM IS OUTDATED.
-#
-# Please refer to the python program publishAudit.py
-# composed by Alexander Weigl.
-#
-#
-
-
-
-# workflow:
-# - runIncrementalCheckstyle.sh | tee report.txt
-# - publishAudit.pl report.txt
-
-use LWP::UserAgent;
-use Data::Dumper;
-use HTTP::Request::Common;
-
-$rawReport = shift @ARGV;
-$server = "https://git.key-project.org/";
-$url = $ENV{"CI_PROJECT_URL"};
-$pid = $ENV{"CI_PROJECT_ID"};
-$token = $ENV{"CI_COMMENT_TOKEN"};
-$sha = $ENV{"CI_COMMIT_SHA"};
-$bid = $ENV{"CI_BUILD_ID"};
-
-open(my $raw, "<", $rawReport);
-my $URL = "hhh";
-my %report = ();
-while(<$raw>) {
-
- if(/\[(.*?)\] (.*\/(.*?)):(\d+)(?::\d+)?: (.*)/) {
- $report{$1} .= "* [$3:$4](../blob/$sha/$2#L$4): $5\n";
- }
-}
-close($raw);
-
-sub report {
- (my $type, my $msg) = @_;
-
- my $result = "";
- if($msg) {
- $result .= "#" unless $type eq "ERROR"; # Errors have a larger heading ...
- $result .= "## $type messages\n\n";
- $result .= $msg . "\n";
- }
- return $result;
-}
-
-my $note = "Checkstyle has been run on this commit in [job $bid]($url/builds/$bid). ";
-$note .= "Here is its report:\n\n";
-if(%report) {
- $note .= "";
- $note .= &report("ERROR", $report{"ERROR"});
- $note .= &report("WARNING", $report{"WARN"});
- $note .= &report("INFO", $report{"INFO"});
- $note .= " ";
-} else {
- $note .= "*No issues. Good.*";
-}
-
-my $ua = LWP::UserAgent->new();
-my $response = $ua->post(
- "$server/api/v4/projects/$pid/repository/commits/$sha/comments",
- { private_token => $token, note => $note });
-my $content = $response->as_string();
-
-print Dumper($content);
-
-if($report{"ERROR"}) {
- exit 1;
-} else {
- exit 0;
-}
diff --git a/scripts/tools/checkstyle/publishAudit.py b/scripts/tools/checkstyle/publishAudit.py
deleted file mode 100755
index 3054bf2a9ac..00000000000
--- a/scripts/tools/checkstyle/publishAudit.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/python3
-
-import sys, os, re, urllib
-
-# workflow:
-# - runIncrementalCheckstyle.sh | tee report.txt
-# - publishAudit.py report.txt
-
-# The original was written in perl and is available under publishAudit.pl
-
-# Written by Alexander Weigl
-# Refactored in May 2018, by Mattias Ulbrich
-
-def getenv(*args):
- "relaxed access to environment"
- return map(lambda x: os.environ.get(x, ""), args)
-
-rawReport = sys.argv[1]
-SERVER = "https://git.key-project.org/"
-URL, PID, TOKEN, SHA, BID, JID, MR_IID = getenv("CI_PROJECT_URL", "CI_PROJECT_ID",
- "CI_COMMENT_TOKEN", "CI_COMMIT_SHA",
- "CI_BUILD_ID", "CI_JOB_ID", "CI_MERGE_REQUEST_IID")
-
-everythingIsFine = True
-
-with open(rawReport) as raw:
- report = {'ERROR':0, 'WARN':0, 'INFO':0}
-
- regex = re.compile(r'\[(?P.*?)\] (?P.*\/(?P.*?)):(?P\d+)(:\d+)?: (?P.*)')
-
- for line in raw:
- m = regex.match(line)
- if m:
- everythingIsFine = False
- old = report[m.group('level')]
- report[m.group('level')] = old + 1
-
-def r2s(header, count, red=False):
- "report to string"
- if count > 0:
- markup = "**" if red else ""
- return "- " + markup + str(count) + " " + header + markup + "\n"
- else:
- return ""
-
-if everythingIsFine:
- note = """Checkstyle has been run on this commit in [job %s](%s/builds/%s).
- *No issues. Good job*
- """ % (BID, URL, BID)
-else:
- note = """Checkstyle has been run on this commit in [job %s](%s/builds/%s).
-
-It found the following issues:
-%s
-
-Its report can be [downloaded here](%s/-/jobs/%s/artifacts/raw/report.txt).
-*Please* resolve as many issues as possible before merging the code back into the master branch.
-You can produce a report locally by executing `key/key/scripts/tools/checkstyle/runIncrementalCheckstyle.sh` in your local repository
-""" % (BID, URL, BID,
- r2s("ERROR messages", report['ERROR'], red=True) +
- r2s("warning messages", report['WARN']) +
- r2s("info messages", report['INFO']),
- URL, BID)
-
-print(note)
-
-import requests
-commitReportUrl = "%s/api/v4/projects/%s/repository/commits/%s/comments" % (SERVER,PID,SHA)
-mergeRequestReportUrl = "%s/api/v4/projects/%s/merge_requests/%s/notes" %(SERVER, PID, MR_IID)
-
-if MR_IID != "":
- reportUrl = mergeRequestReportUrl
-else:
- reportUrl = commitReportUrl
-
-print("Send report to", reportUrl)
-resp = requests.post(reportUrl, data={ b'private_token': TOKEN, b'note':note })
-print(note)
-sys.exit(int(bool(report["ERROR"])))
diff --git a/scripts/tools/checkstyle/runIncrementalCheckstyle.sh b/scripts/tools/checkstyle/runIncrementalCheckstyle.sh
deleted file mode 100755
index 7047b2854cc..00000000000
--- a/scripts/tools/checkstyle/runIncrementalCheckstyle.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env bash
-
-cd `dirname $0`
-
-HOME_DIR=`readlink -f ../../..`
-DIFF_FILE=$HOME_DIR/checkstyle-diff.txt
-
-MERGE_BASE=`git merge-base HEAD origin/main`
-OPTIONS=""
-
-javac -cp checkstyle-10.6.0-all.jar -d . -sourcepath $HOME_DIR \
- GitDiffFilter.java \
- NoEmbeddedPlusPlusCheck.java
-
-for arg in "$@"
-do
- case $arg in
- --xml)
- OPTIONS="-f xml "
- ;;
-
- --base=*)
- MERGE_BASE=${arg#*=}
- ;;
-
- --out=*)
- OPTIONS="-o ${arg#*=}"
- esac
-done
-
-git diff -U0 $MERGE_BASE > $DIFF_FILE
-
-# Uncomment the incremental check in the checkstyle configuration
-sed -e 's//\1/' key_checks.xml > key_checks_incremental.xml
-
-java -ea -cp .:checkstyle-10.6.0-all.jar \
- -Dhome.dir=$HOME_DIR/ \
- -Ddiff.file=$DIFF_FILE \
- com.puppycrawl.tools.checkstyle.Main \
- -c key_checks_incremental.xml \
- $OPTIONS \
- $HOME_DIR/*/*/src/main/java \
- $HOME_DIR/*/src/main/java
diff --git a/scripts/tools/checkstyle/translateAudit.py b/scripts/tools/checkstyle/translateAudit.py
deleted file mode 100755
index cf4964e5978..00000000000
--- a/scripts/tools/checkstyle/translateAudit.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python3
-
-import sys
-import os
-import re
-import json
-
-from hashlib import sha224
-
-# workflow:
-# - runIncrementalCheckstyle.sh | tee report.txt
-# - publishAudit.py report.txt
-
-# The original was written in perl and is available under publishAudit.pl
-
-# Written by Alexander Weigl
-# Refactored in May 2018, by Mattias Ulbrich
-
-def getenv(*args):
- "relaxed access to environment"
- return map(lambda x: os.environ.get(x, ""), args)
-
-
-
-REGEX = re.compile(r'\[(?P.*?)\] (?P.*\/(?P.*?)):(?P\d+)(:\d+)?: (?P.*)')
-
-#info, minor, major, blocker,critical
-LEVEL_TO_SEVERITY = {
- 'INFO': 'info',
- 'WARN': 'minor',
- 'ERROR': 'major'
-}
-
-def main(filename):
- with open(filename) as raw:
- statistics = {'ERROR':0, 'WARN':0, 'INFO':0}
- reports = list()
-
- for line in raw:
- m = REGEX.match(line)
- if m:
- old = statistics[m.group('level')]
- statistics[m.group('level')] = old + 1
-
- fingerprint = sha224(line.encode()).hexdigest()
-
- #see https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool
- entry = {
- 'description': m.group('msg'),
- 'fingerprint': fingerprint,
- 'severity': LEVEL_TO_SEVERITY[m.group('level')],
- 'location.path': os.path.join(m.group('path'),m.group('file')),
- 'location.lines.begin': m.group('line')
- }
- reports.append(entry)
-
- json.dump(reports, sys.stdout, indent=4)
-
- everythingIsFine = statistics['ERROR'] > 0 or statistics['WARN'] > 0
-
- sys.exit(statistics["ERROR"])
-
-######################################################
-if __name__=='__main__':
- main(sys.argv[1])
-
-
-