From d0f805be9d8aa8b63329517908d27f8cf6c2a4c5 Mon Sep 17 00:00:00 2001
From: didierC
Date: Sat, 15 Feb 2025 09:41:19 +0100
Subject: [PATCH 1/8] Upgrade JDK 17, maven plugins and correct license comment
---
pom.xml | 149 ++--
src/etc/header.txt | 2 +-
.../plugins/shellcheck/ShellCheckPlugin.java | 4 +-
.../shellcheck/checks/CheckRepository.java | 4 +-
.../highlighting/HighlightingData.java | 4 +-
.../highlighting/ShellHighlighting.java | 4 +-
.../highlighting/ShellLocation.java | 4 +-
.../shellcheck/languages/ShellLanguage.java | 4 +-
.../languages/ShellQualityProfile.java | 4 +-
.../shellcheck/lexer/AbstractBashLexer.java | 4 +-
.../plugins/shellcheck/lexer/BashLexer.java | 4 +-
.../shellcheck/lexer/BashLexerBase.java | 773 +++++++++---------
.../shellcheck/lexer/HeredocLexingState.java | 4 +-
.../shellcheck/lexer/HeredocSharedImpl.java | 4 +-
.../plugins/shellcheck/lexer/ShellLexer.java | 4 +-
.../shellcheck/lexer/StringLexingstate.java | 4 +-
.../sonar/plugins/shellcheck/lexer/Token.java | 4 +-
.../plugins/shellcheck/lexer/TokenType.java | 4 +-
.../shellcheck/measures/LineCountData.java | 4 +-
.../shellcheck/measures/LineCountParser.java | 4 +-
.../shellcheck/measures/LineCounter.java | 4 +-
.../rules/ShellCheckRulesDefinition.java | 4 +-
.../shellcheck/rules/ShellCheckSensor.java | 4 +-
.../settings/ShellCheckSettings.java | 4 +-
.../plugins/shellcheck/util/FileSystem.java | 4 +-
.../shellcheck/ShellCheckPluginTest.java | 4 +-
.../sonar/plugins/shellcheck/Utils.java | 4 +-
.../checks/CheckRepositoryTest.java | 4 +-
.../highlighting/HighlightingDataTest.java | 4 +-
.../highlighting/ShellHighlightingTest.java | 4 +-
.../highlighting/ShellLocationTest.java | 4 +-
.../languages/ShellLanguageTest.java | 4 +-
.../languages/ShellQualityProfileTest.java | 4 +-
.../shellcheck/lexer/BashLexerTest.java | 4 +-
.../lexer/HeredocLexingStateTest.java | 4 +-
.../lexer/HeredocSharedImplTest.java | 4 +-
.../lexer/StringLexingstateTest.java | 4 +-
.../plugins/shellcheck/lexer/TokenTest.java | 4 +-
.../measures/LineCountDataTest.java | 4 +-
.../shellcheck/measures/LineCounterTest.java | 4 +-
.../rules/ShellCheckRulesDefinitionTest.java | 4 +-
.../rules/ShellCheckSensorNoRuleTest.java | 4 +-
.../rules/ShellCheckSensorTest.java | 4 +-
.../settings/ShellCheckSettingsTest.java | 4 +-
.../shellcheck/util/FileSystemTest.java | 4 +-
45 files changed, 559 insertions(+), 533 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2703c0a..549aebf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,9 +1,11 @@
-
+
4.0.0
com.github.sbaudoin
sonar-shellcheck-plugin
- 2.5.0
+ 3.0.0-SNAPSHOT
sonar-plugin
ShellCheck Analyzer
@@ -12,16 +14,18 @@
2018
- UTF-8
https://oss.sonatype.org/service/local/staging/deploy/maven2
https://oss.sonatype.org/content/repositories/snapshots
+
7.1
- 1.8
- 2.7
- 2.19.1
1.7.1
0.8.6
**/lexer/BashLexerBase.java
+
+ UTF-8
+ 8
+ 8
+ 8
@@ -138,21 +142,77 @@
org.apache.maven.plugins
maven-javadoc-plugin
+ 3.11.2
- org.codehaus.mojo
- cobertura-maven-plugin
- ${cobertura-maven-plugin.version}
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.13.0
org.apache.maven.plugins
maven-surefire-plugin
- ${maven-surefire-plugin.version}
+ 3.5.2
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.12
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.3.1
+
+
+ com.mycila
+ license-maven-plugin
+ 4.6
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+ 3.2.7
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 3.1.1
+
+
+ com.github.spotbugs
+ spotbugs-maven-plugin
+ 4.9.0
+
+
+ de.jflex
+ jflex-maven-plugin
+ 1.9.1
+
+
+ org.sonarsource.sonar-packaging-maven-plugin
+ sonar-packaging-maven-plugin
+ 1.17
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.7.0
org.apache.maven.plugins
- maven-project-info-reports-plugin
- 2.9
+ maven-deploy-plugin
+ 3.1.3
+
+
+ org.apache.maven.plugins
+ maven-install-plugin
+ 3.1.3
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.3.1
@@ -160,23 +220,12 @@
org.sonarsource.sonar-packaging-maven-plugin
sonar-packaging-maven-plugin
- 1.17
true
shellcheck
com.github.sbaudoin.sonar.plugins.shellcheck.ShellCheckPlugin
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.6.0
-
- ${jdk.min.version}
- ${jdk.min.version}
- ${project.build.sourceEncoding}
-
-
org.apache.maven.plugins
maven-surefire-plugin
@@ -191,7 +240,6 @@
org.apache.maven.plugins
maven-source-plugin
- 3.0.1
@@ -201,40 +249,22 @@
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.10.4
+ com.mycila
+ license-maven-plugin
-
- https://docs.oracle.com/javase/8/docs/api/
-
- ${jdk.min.version}
-
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
- com.mycila.maven-license-plugin
- maven-license-plugin
- 1.10.b1
-
-
+
+
+
+
+ src/**/*.java
+
+ true
+
+
false
true
- false
-
- src/**/*.java
-
- true
true
true
- UTF-8
@@ -248,7 +278,6 @@
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
sign-artifacts
@@ -262,7 +291,6 @@
org.apache.maven.plugins
maven-release-plugin
- 2.5.3
true
false
@@ -273,7 +301,6 @@
org.sonatype.plugins
nexus-staging-maven-plugin
- 1.6.7
true
ossrh
@@ -283,6 +310,7 @@
+
audit
@@ -291,7 +319,6 @@
org.jacoco
jacoco-maven-plugin
- ${jacoco.version}
prepare-agent
@@ -309,9 +336,8 @@
- org.codehaus.mojo
- findbugs-maven-plugin
- 3.0.4
+ com.github.spotbugs
+ spotbugs-maven-plugin
@@ -323,7 +349,6 @@
de.jflex
jflex-maven-plugin
- 1.7.0
@@ -343,4 +368,4 @@
-
+
\ No newline at end of file
diff --git a/src/etc/header.txt b/src/etc/header.txt
index 91d33ac..73a6a9e 100644
--- a/src/etc/header.txt
+++ b/src/etc/header.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2018-2021, Sylvain Baudoin
+Copyright (c) 2018-2025, Sylvain Baudoin
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
index 85e5703..c7004a1 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java
index e1bd34c..90cd674 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingData.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingData.java
index 0085506..4884aa3 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingData.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingData.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java
index 9af3103..7404a89 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocation.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocation.java
index 630d876..fe85bab 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocation.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocation.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java
index 2b767b5..3fb3511 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfile.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfile.java
index fd35efa..70bdf39 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfile.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfile.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/AbstractBashLexer.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/AbstractBashLexer.java
index 6b0c07f..7218741 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/AbstractBashLexer.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/AbstractBashLexer.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexer.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexer.java
index fd3a5bb..76258fe 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexer.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexer.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerBase.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerBase.java
index 2239208..a0a88ba 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerBase.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerBase.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/* The following code was generated by JFlex 1.7.0 */
/*
@@ -23,7 +24,7 @@
/**
- * This class is a scanner generated by
+ * This class is a scanner generated by
* JFlex 1.7.0
* from the specification file {@code src/main/jflex/bash.jflex}
*/
@@ -65,16 +66,16 @@ public abstract class BashLexerBase extends AbstractBashLexer {
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
- private static final int ZZ_LEXSTATE[] = {
- 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
- 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15,
+ private static final int ZZ_LEXSTATE[] = {
+ 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
+ 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15,
16, 16, 17, 17, 18, 18, 18, 18, 19, 19, 20, 20
};
- /**
+ /**
* Translates characters to character classes
*/
- private static final String ZZ_CMAP_PACKED =
+ private static final String ZZ_CMAP_PACKED =
"\11\0\1\4\1\1\1\0\1\4\1\2\22\0\1\40\1\6\1\10"+
"\1\5\1\7\1\76\1\21\1\11\1\46\1\32\1\22\1\24\1\51"+
"\1\35\1\16\1\75\1\25\7\31\2\20\1\100\1\34\1\73\1\45"+
@@ -208,12 +209,12 @@ public abstract class BashLexerBase extends AbstractBashLexer {
"\21\14\u1144\0\ua6d7\14\51\0\u1035\14\13\0\336\14\2\0\u1682\14\u295e\0"+
"\u021e\14\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\uffff\0\u05f0\0";
- /**
+ /**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
- /**
+ /**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
@@ -282,7 +283,7 @@ private static int zzUnpackAction(String packed, int offset, int [] result) {
}
- /**
+ /**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
@@ -364,7 +365,7 @@ private static int zzUnpackRowMap(String packed, int offset, int [] result) {
return j;
}
- /**
+ /**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
@@ -1097,7 +1098,7 @@ public BashLexerBase(java.io.Reader in) {
}
- /**
+ /**
* Unpacks the compressed character translation table.
*
* @param packed the packed character translation table
@@ -1388,9 +1389,9 @@ else if (zzAtEOF)
zzEndReadL = zzEndRead;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
- if (eof)
+ if (eof)
zzPeek = false;
- else
+ else
zzPeek = zzBufferL[zzMarkedPosL] == '\n';
}
if (zzPeek) yyline--;
@@ -1461,12 +1462,12 @@ else if (zzAtEOF) {
}
else {
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 1:
+ case 1:
{ return token(TokenType.BAD_CHARACTER);
- }
+ }
// fall through
case 186: break;
- case 2:
+ case 2:
{ if (yystate() == X_HERE_STRING) {
closeHereStringIfAvailable();
return token(TokenType.LINE_FEED);
@@ -1482,121 +1483,121 @@ else if (zzAtEOF) {
}
return token(TokenType.LINE_FEED);
- }
+ }
// fall through
case 187: break;
- case 3:
+ case 3:
{ return token(TokenType.BACKSLASH);
- }
+ }
// fall through
case 188: break;
- case 4:
+ case 4:
{ return token(TokenType.WHITESPACE);
- }
+ }
// fall through
case 189: break;
- case 5:
+ case 5:
{ return token(TokenType.COMMENT);
- }
+ }
// fall through
case 190: break;
- case 6:
+ case 6:
{ return token(TokenType.BANG_TOKEN);
- }
+ }
// fall through
case 191: break;
- case 7:
+ case 7:
{ return token(TokenType.DOLLAR);
- }
+ }
// fall through
case 192: break;
- case 8:
+ case 8:
{ stringParsingState().enterString(); if (yystate() == X_HERE_STRING && !isInHereStringContent()) enterHereStringContent();
goToState(X_STRINGMODE); return token(TokenType.STRING_BEGIN);
- }
+ }
// fall through
case 193: break;
- case 9:
+ case 9:
{ return token(TokenType.WORD);
- }
+ }
// fall through
case 194: break;
- case 10:
+ case 10:
{ return token(TokenType.INTEGER_LITERAL);
- }
+ }
// fall through
case 195: break;
- case 11:
+ case 11:
{ closeHereStringIfAvailable(); return token(TokenType.AMP);
- }
+ }
// fall through
case 196: break;
- case 12:
+ case 12:
{ return token(TokenType.AT);
- }
+ }
// fall through
case 197: break;
- case 13:
+ case 13:
{ return token(TokenType.RIGHT_PAREN);
- }
+ }
// fall through
case 198: break;
- case 14:
+ case 14:
{ if (yystate() == S_BACKQUOTE) backToPreviousState(); else goToState(S_BACKQUOTE); return token(TokenType.BACKQUOTE);
- }
+ }
// fall through
case 199: break;
- case 15:
+ case 15:
{ closeHereStringIfAvailable(); return token(TokenType.SEMI);
- }
+ }
// fall through
case 200: break;
- case 16:
+ case 16:
{ return token(TokenType.PIPE);
- }
+ }
// fall through
case 201: break;
- case 17:
+ case 17:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); goToState(S_ARITH_SQUARE_MODE); return token(TokenType.EXPR_ARITH_SQUARE);
- }
+ }
// fall through
case 202: break;
- case 18:
+ case 18:
{ return token(TokenType.EQ);
- }
+ }
// fall through
case 203: break;
- case 19:
+ case 19:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); stringParsingState().enterSubshell(); goToState(S_SUBSHELL); return token(TokenType.LEFT_PAREN);
- }
+ }
// fall through
case 204: break;
- case 20:
+ case 20:
{ return token(TokenType.LEFT_CURLY);
- }
+ }
// fall through
case 205: break;
- case 21:
+ case 21:
{ if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return token(TokenType.HEREDOC_LINE); return token(TokenType.RIGHT_CURLY);
- }
+ }
// fall through
case 206: break;
- case 22:
+ case 22:
{ return token(TokenType.GREATER_THAN);
- }
+ }
// fall through
case 207: break;
- case 23:
+ case 23:
{ return token(TokenType.LESS_THAN);
- }
+ }
// fall through
case 208: break;
- case 24:
+ case 24:
{ return token(TokenType.COND_OP_NOT);
- }
+ }
// fall through
case 209: break;
- case 25:
+ case 25:
{ if (isEmptyConditionalCommand()) {
setEmptyConditionalCommand(false);
backToPreviousState();
@@ -1605,160 +1606,160 @@ else if (zzAtEOF) {
setEmptyConditionalCommand(false);
return token(TokenType.WORD);
}
- }
+ }
// fall through
case 210: break;
- case 26:
+ case 26:
{ return token(TokenType.COND_OP);
- }
+ }
// fall through
case 211: break;
- case 27:
+ case 27:
{ return token(TokenType.LEFT_PAREN);
- }
+ }
// fall through
case 212: break;
- case 28:
+ case 28:
{ return token(TokenType.ARITH_BASE_CHAR);
- }
+ }
// fall through
case 213: break;
- case 29:
+ case 29:
{ return token(TokenType.ARITH_NEGATE);
- }
+ }
// fall through
case 214: break;
- case 30:
+ case 30:
{ return token(TokenType.ARITH_BITWISE_XOR);
- }
+ }
// fall through
case 215: break;
- case 31:
+ case 31:
{ return token(TokenType.RIGHT_SQUARE);
- }
+ }
// fall through
case 216: break;
- case 32:
+ case 32:
{ return token(TokenType.ARITH_NUMBER);
- }
+ }
// fall through
case 217: break;
- case 33:
+ case 33:
{ return token(TokenType.ARITH_BITWISE_AND);
- }
+ }
// fall through
case 218: break;
- case 34:
+ case 34:
{ return token(TokenType.ARITH_MULT);
- }
+ }
// fall through
case 219: break;
- case 35:
+ case 35:
{ return token(TokenType.ARITH_PLUS);
- }
+ }
// fall through
case 220: break;
- case 36:
+ case 36:
{ decOpenParenthesisCount(); return token(TokenType.RIGHT_PAREN);
- }
+ }
// fall through
case 221: break;
- case 37:
+ case 37:
{ return token(TokenType.ARITH_MINUS);
- }
+ }
// fall through
case 222: break;
- case 38:
+ case 38:
{ return token(TokenType.LEFT_SQUARE);
- }
+ }
// fall through
case 223: break;
- case 39:
+ case 39:
{ incOpenParenthesisCount(); return token(TokenType.LEFT_PAREN);
- }
+ }
// fall through
case 224: break;
- case 40:
+ case 40:
{ return token(TokenType.COMMA);
- }
+ }
// fall through
case 225: break;
- case 41:
+ case 41:
{ return token(TokenType.ARITH_BITWISE_NEGATE);
- }
+ }
// fall through
case 226: break;
- case 42:
+ case 42:
{ return token(TokenType.ARITH_GT);
- }
+ }
// fall through
case 227: break;
- case 43:
+ case 43:
{ return token(TokenType.ARITH_LT);
- }
+ }
// fall through
case 228: break;
- case 44:
+ case 44:
{ return token(TokenType.ARITH_DIV);
- }
+ }
// fall through
case 229: break;
- case 45:
+ case 45:
{ return token(TokenType.ARITH_MOD);
- }
+ }
// fall through
case 230: break;
- case 46:
+ case 46:
{ return token(TokenType.ARITH_QMARK);
- }
+ }
// fall through
case 231: break;
- case 47:
+ case 47:
{ return token(TokenType.ARITH_COLON);
- }
+ }
// fall through
case 232: break;
- case 48:
+ case 48:
{ backToPreviousState(); return token(TokenType.EXPR_ARITH_SQUARE_END);
- }
+ }
// fall through
case 233: break;
- case 49:
+ case 49:
{ return token(TokenType.EXPR_ARITH_SQUARE);
- }
+ }
// fall through
case 234: break;
- case 50:
+ case 50:
{ backToPreviousState(); return token(TokenType.RIGHT_SQUARE);
- }
+ }
// fall through
case 235: break;
- case 51:
+ case 51:
{ backToPreviousState(); return token(TokenType.RIGHT_PAREN);
- }
+ }
// fall through
case 236: break;
- case 52:
+ case 52:
{ backToPreviousState(); if (stringParsingState().isInSubshell()) stringParsingState().leaveSubshell(); return token(TokenType.RIGHT_PAREN);
- }
+ }
// fall through
case 237: break;
- case 53:
+ case 53:
{ backToPreviousState(); goToState(S_ARITH_ARRAY_MODE); return token(TokenType.LEFT_SQUARE);
- }
+ }
// fall through
case 238: break;
- case 54:
+ case 54:
{ goToState(S_ARITH_ARRAY_MODE); return token(TokenType.LEFT_SQUARE);
- }
+ }
// fall through
case 239: break;
- case 55:
+ case 55:
{ return token(TokenType.STRING_DATA);
- }
+ }
// fall through
case 240: break;
- case 56:
+ case 56:
{ if (!stringParsingState().isInSubstring() && stringParsingState().isSubstringAllowed()) {
stringParsingState().enterString();
goToState(X_STRINGMODE);
@@ -1768,10 +1769,10 @@ else if (zzAtEOF) {
stringParsingState().leaveString();
backToPreviousState();
return token(TokenType.STRING_END);
- }
+ }
// fall through
case 241: break;
- case 57:
+ case 57:
{ if (yystate() == S_BACKQUOTE) {
backToPreviousState();
}
@@ -1779,142 +1780,142 @@ else if (zzAtEOF) {
goToState(S_BACKQUOTE);
}
return token(TokenType.BACKQUOTE);
- }
+ }
// fall through
case 242: break;
- case 58:
+ case 58:
{ setParamExpansionHash(isParamExpansionWord()); return token(TokenType.PARAM_EXPANSION_OP_HASH);
- }
+ }
// fall through
case 243: break;
- case 59:
+ case 59:
{ return token(TokenType.PARAM_EXPANSION_OP_EXCL);
- }
+ }
// fall through
case 244: break;
- case 60:
+ case 60:
{ setParamExpansionOther(true); return token(TokenType.PARAM_EXPANSION_OP_UPPERCASE_FIRST);
- }
+ }
// fall through
case 245: break;
- case 61:
+ case 61:
{ setParamExpansionOther(true); return token(TokenType.PARAM_EXPANSION_OP_DOT);
- }
+ }
// fall through
case 246: break;
- case 62:
+ case 62:
{ setParamExpansionWord(true); return token(TokenType.WORD);
- }
+ }
// fall through
case 247: break;
- case 63:
+ case 63:
{ return token(TokenType.PARAM_EXPANSION_OP_STAR);
- }
+ }
// fall through
case 248: break;
- case 64:
+ case 64:
{ return token(TokenType.PARAM_EXPANSION_OP_AT);
- }
+ }
// fall through
case 249: break;
- case 65:
+ case 65:
{ return token(TokenType.PARAM_EXPANSION_OP_PLUS);
- }
+ }
// fall through
case 250: break;
- case 66:
+ case 66:
{ return token(TokenType.PARAM_EXPANSION_OP_MINUS);
- }
+ }
// fall through
case 251: break;
- case 67:
+ case 67:
{ if (!isParamExpansionOther() && (!isParamExpansionWord() || !isParamExpansionHash())) {
// If we expect an array reference scan the next tokens as arithmetic expression
goToState(S_ARITH_ARRAY_MODE);
}
return token(TokenType.LEFT_SQUARE);
- }
+ }
// fall through
case 252: break;
- case 68:
+ case 68:
{ return token(TokenType.PARAM_EXPANSION_OP_EQ);
- }
+ }
// fall through
case 253: break;
- case 69:
+ case 69:
{ setParamExpansionWord(false); setParamExpansionHash(false); setParamExpansionOther(false);
return token(TokenType.LEFT_CURLY);
- }
+ }
// fall through
case 254: break;
- case 70:
+ case 70:
{ setParamExpansionWord(false); setParamExpansionHash(false); setParamExpansionOther(false);
backToPreviousState();
closeHereStringIfAvailable();
return token(TokenType.RIGHT_CURLY);
- }
+ }
// fall through
case 255: break;
- case 71:
+ case 71:
{ setParamExpansionOther(true); return token(TokenType.PARAM_EXPANSION_OP_LOWERCASE_FIRST);
- }
+ }
// fall through
case 256: break;
- case 72:
+ case 72:
{ goToState(S_PARAM_EXPANSION_PATTERN); return token(TokenType.PARAM_EXPANSION_OP_SLASH);
- }
+ }
// fall through
case 257: break;
- case 73:
+ case 73:
{ setParamExpansionOther(true); return token(TokenType.PARAM_EXPANSION_OP_PERCENT);
- }
+ }
// fall through
case 258: break;
- case 74:
+ case 74:
{ setParamExpansionOther(true); return token(TokenType.PARAM_EXPANSION_OP_QMARK);
- }
+ }
// fall through
case 259: break;
- case 75:
+ case 75:
{ return token(TokenType.PARAM_EXPANSION_OP_COLON);
- }
+ }
// fall through
case 260: break;
- case 76:
+ case 76:
{ backToPreviousState(); return token(TokenType.PARAM_EXPANSION_PATTERN);
- }
+ }
// fall through
case 261: break;
- case 77:
+ case 77:
{ yypushback(1); backToPreviousState();
- }
+ }
// fall through
case 262: break;
- case 78:
+ case 78:
{ backToPreviousState(); goToState(S_PARAM_EXPANSION_REPLACEMENT); return token(TokenType.PARAM_EXPANSION_OP_SLASH);
- }
+ }
// fall through
case 263: break;
- case 79:
+ case 79:
{ backToPreviousState(); return token(TokenType.WORD);
- }
+ }
// fall through
case 264: break;
- case 80:
+ case 80:
{ heredocState().pushMarker(yytext(), yystate() == X_HEREDOC_MARKER_IGNORE_TABS);
backToPreviousState();
return token(TokenType.HEREDOC_MARKER_START);
- }
+ }
// fall through
case 265: break;
- case 81:
+ case 81:
{ return token(TokenType.LINE_FEED);
- }
+ }
// fall through
case 266: break;
- case 82:
+ case 82:
{ //support end marker followed by a backtick if nested in a backtick command
CharSequence markerText = yytext();
boolean dropLastChar = false;
@@ -1937,23 +1938,23 @@ else if (zzAtEOF) {
}
return token(TokenType.HEREDOC_LINE);
- }
+ }
// fall through
case 267: break;
- case 83:
+ case 83:
{ if (!heredocState().isEmpty()) {
return token(TokenType.HEREDOC_LINE);
}
return token(TokenType.LINE_FEED);
- }
+ }
// fall through
case 268: break;
- case 84:
+ case 84:
{ return token(TokenType.HEREDOC_LINE);
- }
+ }
// fall through
case 269: break;
- case 85:
+ case 85:
{ if (heredocState().isNextMarker(yytext())) {
boolean ignoreTabs = heredocState().isIgnoringTabs();
@@ -1964,233 +1965,233 @@ else if (zzAtEOF) {
}
return token(TokenType.HEREDOC_LINE);
- }
+ }
// fall through
case 270: break;
- case 86:
+ case 86:
{ if (isInHereStringContent()) { leaveHereStringContent(); backToPreviousState(); } return token(TokenType.WHITESPACE);
- }
+ }
// fall through
case 271: break;
- case 87:
+ case 87:
{ if (!isInHereStringContent()) enterHereStringContent(); return token(TokenType.WORD);
- }
+ }
// fall through
case 272: break;
- case 88:
+ case 88:
{ return token(TokenType.LINE_CONTINUATION);
- }
+ }
// fall through
case 273: break;
- case 89:
+ case 89:
{ return token(TokenType.SHEBANG);
- }
+ }
// fall through
case 274: break;
- case 90:
+ case 90:
{ return token(TokenType.VARIABLE);
- }
+ }
// fall through
case 275: break;
- case 91:
+ case 91:
{ yypushback(1); goToState(S_ARITH_SQUARE_MODE); return token(TokenType.DOLLAR);
- }
+ }
// fall through
case 276: break;
- case 92:
+ case 92:
{ if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return token(TokenType.HEREDOC_LINE); goToState(S_PARAM_EXPANSION); yypushback(1); return token(TokenType.DOLLAR);
- }
+ }
// fall through
case 277: break;
- case 93:
+ case 93:
{ if (yystate() == X_HERE_STRING && !isInHereStringContent()) enterHereStringContent(); return token(TokenType.STRING2);
- }
+ }
// fall through
case 278: break;
- case 94:
+ case 94:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzMarkedPos, -1);
{ return token(TokenType.ASSIGNMENT_WORD);
- }
+ }
// fall through
case 279: break;
- case 95:
+ case 95:
{ return token(TokenType.FILEDESCRIPTOR);
- }
+ }
// fall through
case 280: break;
- case 96:
+ case 96:
{ closeHereStringIfAvailable(); return token(TokenType.AND_AND);
- }
+ }
// fall through
case 281: break;
- case 97:
+ case 97:
{ if (isBash4()) {
return token(TokenType.REDIRECT_AMP_GREATER);
} else {
yypushback(1);
return token(TokenType.AMP);
}
- }
+ }
// fall through
case 282: break;
- case 98:
+ case 98:
{ return token(TokenType.ADD_EQ);
- }
+ }
// fall through
case 283: break;
- case 99:
+ case 99:
{ if (isBash4()) {
return token(TokenType.PIPE_AMP);
} else {
yypushback(1);
return token(TokenType.PIPE);
}
- }
+ }
// fall through
case 284: break;
- case 100:
+ case 100:
{ closeHereStringIfAvailable(); return token(TokenType.OR_OR);
- }
+ }
// fall through
case 285: break;
- case 101:
+ case 101:
{ goToState(S_TEST); setEmptyConditionalCommand(false); return token(TokenType.EXPR_CONDITIONAL);
- }
+ }
// fall through
case 286: break;
- case 102:
+ case 102:
{ return token(TokenType.IF_KEYWORD);
- }
+ }
// fall through
case 287: break;
- case 103:
+ case 103:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); goToState(S_ARITH); return token(TokenType.EXPR_ARITH);
- }
+ }
// fall through
case 288: break;
- case 104:
+ case 104:
{ return token(TokenType.DO_KEYWORD);
- }
+ }
// fall through
case 289: break;
- case 105:
+ case 105:
{ return token(TokenType.FI_KEYWORD);
- }
+ }
// fall through
case 290: break;
- case 106:
+ case 106:
{ return token(TokenType.REDIRECT_GREATER_BAR);
- }
+ }
// fall through
case 291: break;
- case 107:
+ case 107:
{ return token(TokenType.SHIFT_RIGHT);
- }
+ }
// fall through
case 292: break;
- case 108:
+ case 108:
{ return token(TokenType.REDIRECT_LESS_GREATER);
- }
+ }
// fall through
case 293: break;
- case 109:
+ case 109:
{ goToState(X_HEREDOC_MARKER);
return token(TokenType.HEREDOC_MARKER_TAG);
- }
+ }
// fall through
case 294: break;
- case 110:
+ case 110:
{ backToPreviousState(); setEmptyConditionalCommand(false); return token(TokenType.EXPR_CONDITIONAL_END);
- }
+ }
// fall through
case 295: break;
- case 111:
+ case 111:
{ return token(TokenType.COND_OP_EQ_EQ);
- }
+ }
// fall through
case 296: break;
- case 112:
+ case 112:
{ return token(TokenType.COND_OP_REGEX);
- }
+ }
// fall through
case 297: break;
- case 113:
+ case 113:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzStartRead, 1);
{ goToState(S_DOLLAR_PREFIXED); return token(TokenType.DOLLAR);
- }
+ }
// fall through
case 298: break;
- case 114:
+ case 114:
{ return token(TokenType.AND_AND);
- }
+ }
// fall through
case 299: break;
- case 115:
+ case 115:
{ return token(TokenType.OR_OR);
- }
+ }
// fall through
case 300: break;
- case 116:
+ case 116:
{ return token(TokenType.ARITH_NE);
- }
+ }
// fall through
case 301: break;
- case 117:
+ case 117:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzStartRead, 1);
{ if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return token(TokenType.HEREDOC_LINE); goToState(S_DOLLAR_PREFIXED); return token(TokenType.DOLLAR);
- }
+ }
// fall through
case 302: break;
- case 118:
+ case 118:
{ return token(TokenType.ARITH_ASS_BIT_XOR);
- }
+ }
// fall through
case 303: break;
- case 119:
+ case 119:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzMarkedPos, -1);
{ goToState(S_ARRAY); return token(TokenType.ASSIGNMENT_WORD);
- }
+ }
// fall through
case 304: break;
- case 120:
+ case 120:
{ return token(TokenType.ARITH_ASS_BIT_AND);
- }
+ }
// fall through
case 305: break;
- case 121:
+ case 121:
{ return token(TokenType.ARITH_EXPONENT);
- }
+ }
// fall through
case 306: break;
- case 122:
+ case 122:
{ return token(TokenType.ARITH_ASS_MUL);
- }
+ }
// fall through
case 307: break;
- case 123:
+ case 123:
{ return token(TokenType.ARITH_PLUS_PLUS);
- }
+ }
// fall through
case 308: break;
- case 124:
+ case 124:
{ return token(TokenType.ARITH_ASS_PLUS);
- }
+ }
// fall through
case 309: break;
- case 125:
+ case 125:
{ return token(TokenType.ARITH_OCTAL_NUMBER);
- }
+ }
// fall through
case 310: break;
- case 126:
+ case 126:
{ if (openParenthesisCount() > 0) {
decOpenParenthesisCount();
yypushback(1);
@@ -2201,60 +2202,60 @@ else if (zzAtEOF) {
return token(TokenType.EXPR_ARITH_END);
}
- }
+ }
// fall through
case 311: break;
- case 127:
+ case 127:
{ return token(TokenType.ARITH_MINUS_MINUS);
- }
+ }
// fall through
case 312: break;
- case 128:
+ case 128:
{ return token(TokenType.ARITH_ASS_MINUS);
- }
+ }
// fall through
case 313: break;
- case 129:
+ case 129:
{ return token(TokenType.ARITH_ASS_BIT_OR);
- }
+ }
// fall through
case 314: break;
- case 130:
+ case 130:
{ return token(TokenType.ARITH_EQ);
- }
+ }
// fall through
case 315: break;
- case 131:
+ case 131:
{ return token(TokenType.ARITH_GE);
- }
+ }
// fall through
case 316: break;
- case 132:
+ case 132:
{ return token(TokenType.ARITH_SHIFT_RIGHT);
- }
+ }
// fall through
case 317: break;
- case 133:
+ case 133:
{ return token(TokenType.ARITH_LE);
- }
+ }
// fall through
case 318: break;
- case 134:
+ case 134:
{ return token(TokenType.ARITH_SHIFT_LEFT);
- }
+ }
// fall through
case 319: break;
- case 135:
+ case 135:
{ return token(TokenType.ARITH_ASS_DIV);
- }
+ }
// fall through
case 320: break;
- case 136:
+ case 136:
{ return token(TokenType.ARITH_ASS_MOD);
- }
+ }
// fall through
case 321: break;
- case 137:
+ case 137:
{ goToState(S_CASE_PATTERN);
if (isBash4()) {
return token(TokenType.CASE_END);
@@ -2263,76 +2264,76 @@ else if (zzAtEOF) {
yypushback(1);
return token(TokenType.SEMI);
}
- }
+ }
// fall through
case 322: break;
- case 138:
+ case 138:
{ goToState(S_CASE_PATTERN); return token(TokenType.CASE_END);
- }
+ }
// fall through
case 323: break;
- case 139:
+ case 139:
{ if (!isInCaseBody()) { setInCaseBody(true); goToState(S_CASE_PATTERN); }; return token(TokenType.WORD);
- }
+ }
// fall through
case 324: break;
- case 140:
+ case 140:
{ setParamExpansionHash(isParamExpansionWord()); return token(TokenType.PARAM_EXPANSION_OP_HASH_HASH);
- }
+ }
// fall through
case 325: break;
- case 141:
+ case 141:
{ setParamExpansionOther(true); return token(TokenType.PARAM_EXPANSION_OP_UPPERCASE_ALL);
- }
+ }
// fall through
case 326: break;
- case 142:
+ case 142:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzStartRead, 1);
{ return token(TokenType.LEFT_SQUARE);
- }
+ }
// fall through
case 327: break;
- case 143:
+ case 143:
{ setParamExpansionOther(true); return token(TokenType.PARAM_EXPANSION_OP_LOWERCASE_ALL);
- }
+ }
// fall through
case 328: break;
- case 144:
+ case 144:
{ goToState(S_PARAM_EXPANSION_PATTERN); return token(TokenType.PARAM_EXPANSION_OP_SLASH_SLASH);
- }
+ }
// fall through
case 329: break;
- case 145:
+ case 145:
{ return token(TokenType.PARAM_EXPANSION_OP_COLON_PLUS);
- }
+ }
// fall through
case 330: break;
- case 146:
+ case 146:
{ return token(TokenType.PARAM_EXPANSION_OP_COLON_MINUS);
- }
+ }
// fall through
case 331: break;
- case 147:
+ case 147:
{ return token(TokenType.PARAM_EXPANSION_OP_COLON_EQ);
- }
+ }
// fall through
case 332: break;
- case 148:
+ case 148:
{ return token(TokenType.PARAM_EXPANSION_OP_COLON_QMARK);
- }
+ }
// fall through
case 333: break;
- case 149:
+ case 149:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzMarkedPos, -1);
{ backToPreviousState(); goToState(S_PARAM_EXPANSION_DELIMITER); return token(TokenType.PARAM_EXPANSION_PATTERN);
- }
+ }
// fall through
case 334: break;
- case 150:
+ case 150:
{ if (heredocState().isNextMarker(yytext())) {
boolean ignoreTabs = heredocState().isIgnoringTabs();
@@ -2345,146 +2346,146 @@ else if (zzAtEOF) {
return token(yystate() == X_HEREDOC && heredocState().isExpectingEvaluatingHeredoc() && !"$".equals(yytext().toString())
? TokenType.VARIABLE
: TokenType.HEREDOC_LINE);
- }
+ }
// fall through
case 335: break;
- case 151:
+ case 151:
{ if (!isInHereStringContent()) enterHereStringContent(); return token(TokenType.VARIABLE);
- }
+ }
// fall through
case 336: break;
- case 152:
+ case 152:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzMarkedPos, -2);
{ return token(TokenType.ASSIGNMENT_WORD);
- }
+ }
// fall through
case 337: break;
- case 153:
+ case 153:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzMarkedPos, -2);
{ goToState(S_ASSIGNMENT_LIST); return token(TokenType.ASSIGNMENT_WORD);
- }
+ }
// fall through
case 338: break;
- case 154:
+ case 154:
{ if (isBash4()) {
return token(TokenType.REDIRECT_AMP_GREATER_GREATER);
} else {
yypushback(2);
return token(TokenType.AMP);
}
- }
+ }
// fall through
case 339: break;
- case 155:
+ case 155:
{ goToState(S_TEST_COMMAND); return token(TokenType.BRACKET_KEYWORD);
- }
+ }
// fall through
case 340: break;
- case 156:
+ case 156:
{ yypushback(1); goToState(S_TEST); setEmptyConditionalCommand(true); return token(TokenType.EXPR_CONDITIONAL);
- }
+ }
// fall through
case 341: break;
- case 157:
+ case 157:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); yypushback(2); goToState(S_SUBSHELL); return token(TokenType.LEFT_PAREN);
- }
+ }
// fall through
case 342: break;
- case 158:
+ case 158:
{ return token(TokenType.LET_KEYWORD);
- }
+ }
// fall through
case 343: break;
- case 159:
+ case 159:
{ return token(TokenType.FOR_KEYWORD);
- }
+ }
// fall through
case 344: break;
- case 160:
+ case 160:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzStartRead, 2);
{ return token(TokenType.REDIRECT_GREATER_AMP);
- }
+ }
// fall through
case 345: break;
- case 161:
+ case 161:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzStartRead, 2);
{ return token(TokenType.REDIRECT_LESS_AMP);
- }
+ }
// fall through
case 346: break;
- case 162:
+ case 162:
{ goToState(X_HEREDOC_MARKER_IGNORE_TABS);
return token(TokenType.HEREDOC_MARKER_TAG);
- }
+ }
// fall through
case 347: break;
- case 163:
+ case 163:
{ goToState(X_HERE_STRING); return token(TokenType.REDIRECT_HERE_STRING);
- }
+ }
// fall through
case 348: break;
- case 164:
+ case 164:
{ backToPreviousState(); return token(TokenType.BRACKET_KEYWORD_END);
- }
+ }
// fall through
case 349: break;
- case 165:
+ case 165:
{ return token(TokenType.ARITH_HEX_NUMBER);
- }
+ }
// fall through
case 350: break;
- case 166:
+ case 166:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzStartRead, 2);
{ yypushback(1); return token(TokenType.ARITH_MINUS);
- }
+ }
// fall through
case 351: break;
- case 167:
+ case 167:
{ return token(TokenType.ARITH_ASS_SHIFT_RIGHT);
- }
+ }
// fall through
case 352: break;
- case 168:
+ case 168:
{ return token(TokenType.ARITH_ASS_SHIFT_LEFT);
- }
+ }
// fall through
case 353: break;
- case 169:
+ case 169:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzStartRead, 1);
{ backToPreviousState(); goToState(S_ASSIGNMENT_LIST); return token(TokenType.RIGHT_SQUARE);
- }
+ }
// fall through
case 354: break;
- case 170:
+ case 170:
{ goToState(S_CASE_PATTERN);
if (!isBash4()) {
yypushback(1);
}
return token(TokenType.CASE_END);
- }
+ }
// fall through
case 355: break;
- case 171:
+ case 171:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, zzEndRead - zzStartRead, zzMarkedPos, -3);
{ goToState(S_ASSIGNMENT_LIST); return token(TokenType.ASSIGNMENT_WORD);
- }
+ }
// fall through
case 356: break;
- case 172:
+ case 172:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 21;
int zzFPos = zzStartRead;
@@ -2496,7 +2497,7 @@ else if (zzAtEOF) {
zzFPos += Character.charCount(zzInput);
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
}
- if (zzFState != -1) { zzFinL[zzFPos++] = ((zzAttrL[zzFState] & 1) == 1); }
+ if (zzFState != -1) { zzFinL[zzFPos++] = ((zzAttrL[zzFState] & 1) == 1); }
while (zzFPos <= zzMarkedPos) {
zzFinL[zzFPos++] = false;
}
@@ -2511,72 +2512,72 @@ else if (zzAtEOF) {
zzMarkedPos = zzFPos;
}
{ goToState(S_ARRAY); return token(TokenType.ASSIGNMENT_WORD);
- }
+ }
// fall through
case 357: break;
- case 173:
+ case 173:
{ return token(TokenType.TIME_KEYWORD);
- }
+ }
// fall through
case 358: break;
- case 174:
+ case 174:
{ return token(TokenType.TRAP_KEYWORD);
- }
+ }
// fall through
case 359: break;
- case 175:
+ case 175:
{ return token(TokenType.THEN_KEYWORD);
- }
+ }
// fall through
case 360: break;
- case 176:
+ case 176:
{ return token(TokenType.ELIF_KEYWORD);
- }
+ }
// fall through
case 361: break;
- case 177:
+ case 177:
{ return token(TokenType.ELSE_KEYWORD);
- }
+ }
// fall through
case 362: break;
- case 178:
+ case 178:
{ setInCaseBody(false); goToState(S_CASE); return token(TokenType.CASE_KEYWORD);
- }
+ }
// fall through
case 363: break;
- case 179:
+ case 179:
{ return token(TokenType.DONE_KEYWORD);
- }
+ }
// fall through
case 364: break;
- case 180:
+ case 180:
{ backToPreviousState(); return token(TokenType.ESAC_KEYWORD);
- }
+ }
// fall through
case 365: break;
- case 181:
+ case 181:
{ backToPreviousState(); yypushback(yylength());
- }
+ }
// fall through
case 366: break;
- case 182:
+ case 182:
{ return token(TokenType.UNTIL_KEYWORD);
- }
+ }
// fall through
case 367: break;
- case 183:
+ case 183:
{ return token(TokenType.WHILE_KEYWORD);
- }
+ }
// fall through
case 368: break;
- case 184:
+ case 184:
{ return token(TokenType.SELECT_KEYWORD);
- }
+ }
// fall through
case 369: break;
- case 185:
+ case 185:
{ return token(TokenType.FUNCTION_KEYWORD);
- }
+ }
// fall through
case 370: break;
default:
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingState.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingState.java
index af8a3f7..3725f30 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingState.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingState.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java
index ebc1924..3b187e0 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/ShellLexer.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/ShellLexer.java
index 352915b..0b84ec1 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/ShellLexer.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/ShellLexer.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstate.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstate.java
index 4aee3ce..248778f 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstate.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstate.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java
index 784c54b..786e4b3 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenType.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenType.java
index dd5da69..405aec9 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenType.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenType.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountData.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountData.java
index 967bebe..e658913 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountData.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountData.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java
index 58e3572..2645518 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java
index bf96bea..3dab46b 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java
index 42d366e..ba0dbda 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java
index d647a27..0996d2f 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java
index 6cddb32..cf89a82 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java
index b57c4f7..ca125d4 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
index d549877..f9351ed 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/Utils.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/Utils.java
index 22e8888..880685e 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/Utils.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/Utils.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java
index 33c3534..bf37351 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java
index c9674b9..a76e632 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
index b6a12b5..b5cad09 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocationTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocationTest.java
index 030854b..cf92f7f 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocationTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellLocationTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguageTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguageTest.java
index ed346b2..4474cd7 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguageTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguageTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfileTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfileTest.java
index ca5c6bc..ca03a17 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfileTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellQualityProfileTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerTest.java
index 3d18b77..1c829f7 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/BashLexerTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingStateTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingStateTest.java
index f399afb..e20ad67 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingStateTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocLexingStateTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImplTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImplTest.java
index 2a46301..8322378 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImplTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImplTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstateTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstateTest.java
index 66b637b..0c59a6e 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstateTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/StringLexingstateTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenTest.java
index 29152a5..da0fbbe 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/TokenTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java
index d561668..4c1bf02 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
index 810941a..dd563d4 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java
index 1f790f2..0ae19c3 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
index a43a904..bf2e35a 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
index 3188c76..93e96ae 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettingsTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettingsTest.java
index 0aa0cb5..0c946ac 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettingsTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettingsTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java
index 1c368d2..3f9677d 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2018-2021, Sylvain Baudoin
+/*
+ * Copyright (c) 2018-2025, Sylvain Baudoin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
From 2e8fe01a30e676451ce20c1d6edfb52e95d4303d Mon Sep 17 00:00:00 2001
From: didierC
Date: Sat, 15 Feb 2025 09:52:32 +0100
Subject: [PATCH 2/8] update commons-lang dependencies to commons-lang3
---
pom.xml | 6 +++---
.../sonar/plugins/shellcheck/languages/ShellLanguage.java | 3 ++-
.../sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java | 2 +-
.../sonar/plugins/shellcheck/measures/LineCountParser.java | 4 +++-
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 549aebf..7b0a51c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,9 +69,9 @@
1.6.0.219
- commons-lang
- commons-lang
- 2.6
+ org.apache.commons
+ commons-lang3
+ 3.17.0
org.json
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java
index 3fb3511..4933438 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/languages/ShellLanguage.java
@@ -16,7 +16,8 @@
package com.github.sbaudoin.sonar.plugins.shellcheck.languages;
import com.github.sbaudoin.sonar.plugins.shellcheck.settings.ShellCheckSettings;
-import org.apache.commons.lang.StringUtils;
+
+import org.apache.commons.lang3.StringUtils;
import org.sonar.api.config.Configuration;
import org.sonar.api.resources.AbstractLanguage;
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java
index 3b187e0..ec0c999 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/HeredocSharedImpl.java
@@ -15,7 +15,7 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.lexer;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
/**
* Shared code for the Heredoc handling.
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java
index 2645518..2fd3b82 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountParser.java
@@ -18,7 +18,7 @@
import com.github.sbaudoin.sonar.plugins.shellcheck.highlighting.ShellLocation;
import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.BashLexer;
import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.TokenType;
-import org.apache.commons.lang.StringUtils;
+
import java.io.BufferedReader;
import java.io.IOException;
@@ -28,6 +28,8 @@
import java.util.List;
import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
+
/**
* Counting lines, comment lines and blank lines in Shell scripts
*/
From 5747bff48209584511a12f4ae8db398f1d645f7c Mon Sep 17 00:00:00 2001
From: didierC
Date: Sat, 15 Feb 2025 10:32:08 +0100
Subject: [PATCH 3/8] migrate from powermock to mockito
No more compatible with SonarQube 8.0
---
pom.xml | 16 ++--
.../plugins/shellcheck/ShellCheckPlugin.java | 13 +--
.../shellcheck/ShellCheckPluginTest.java | 47 +----------
.../highlighting/ShellHighlightingTest.java | 80 ++++++++++---------
.../shellcheck/measures/LineCounterTest.java | 10 +--
.../rules/ShellCheckSensorNoRuleTest.java | 6 +-
.../rules/ShellCheckSensorTest.java | 8 +-
7 files changed, 70 insertions(+), 110 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7b0a51c..093d9ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,6 @@
https://oss.sonatype.org/content/repositories/snapshots
7.1
- 1.7.1
0.8.6
**/lexer/BashLexerBase.java
@@ -91,15 +90,9 @@
test
- org.powermock
- powermock-module-junit4
- ${powermock.version}
- test
-
-
- org.powermock
- powermock-api-mockito
- ${powermock.version}
+ org.mockito
+ mockito-core
+ 5.15.2
test
@@ -230,8 +223,11 @@
org.apache.maven.plugins
maven-surefire-plugin
+ --add-opens java.base/java.util=ALL-UNNAMED --add-opens
+ java.base/java.lang=ALL-UNNAMED
1
false
+
**/*Test.java
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
index c7004a1..c4e4edd 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
@@ -33,16 +33,9 @@ public class ShellCheckPlugin implements Plugin {
@Override
public void define(Context context) {
Optional addLanguage = Optional.empty();
- try {
- if (System.getenv().get(ADD_SHELL_LANGUAGE_ENV_VAR) != null) {
- addLanguage = Optional.of(Boolean.parseBoolean(System.getenv().get(ADD_SHELL_LANGUAGE_ENV_VAR)));
- }
- } catch (AccessControlException exc) {
- // Do nothing on purpose: in SQ 8.0, we do not have access to system env variables
- // and we deal with that with a new SQ configuration property read below
- }
- // If no env variable found, read from SQ conf
- if (!addLanguage.isPresent()) {
+ if (System.getenv().get(ADD_SHELL_LANGUAGE_ENV_VAR) != null) {
+ addLanguage = Optional.of(Boolean.parseBoolean(System.getenv().get(ADD_SHELL_LANGUAGE_ENV_VAR)));
+ } else {
addLanguage = context.getBootConfiguration().getBoolean(ADD_SHELL_LANGUAGE_CONF_PROP);
}
// Install language unless instructed otherwise
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
index f9351ed..fea98b6 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
@@ -15,30 +15,17 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.EnvironmentVariables;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
import org.sonar.api.Plugin;
-import org.sonar.api.SonarQubeSide;
import org.sonar.api.SonarRuntime;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.internal.PluginContextImpl;
-import org.sonar.api.internal.SonarRuntimeImpl;
-import org.sonar.api.utils.Version;
-
-import java.security.AccessControlException;
-import static org.junit.Assert.assertEquals;
-import static org.powermock.api.mockito.PowerMockito.mockStatic;
-import static org.powermock.api.mockito.PowerMockito.when;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({ShellCheckPlugin.class})
-@PowerMockIgnore("jdk.internal.reflect.*")
public class ShellCheckPluginTest {
@Rule
public final EnvironmentVariables environmentVariables = new EnvironmentVariables();
@@ -99,32 +86,6 @@ public void testExtensionCounts7() {
assertEquals(6, context.getExtensions().size());
}
- // Special test for SQ 8.0
- // @see https://community.sonarsource.com/t/cannot-access-environment-variables-from-a-plugin-in-sonarqube-8/15743/6
- @Test
- public void testExtensionCounts8() {
- mockStatic(System.class);
- when(System.getenv()).thenThrow(new AccessControlException("Forbidden access"));
-
- MapSettings settings = new MapSettings().setProperty(ShellCheckPlugin.ADD_SHELL_LANGUAGE_CONF_PROP, "false");
- Plugin.Context context = getContext(settings);
- new ShellCheckPlugin().define(context);
- assertEquals(6, context.getExtensions().size());
- }
-
- // Special test for SQ 8.0
- // @see https://community.sonarsource.com/t/cannot-access-environment-variables-from-a-plugin-in-sonarqube-8/15743/6
- @Test
- public void testExtensionCounts9() {
- mockStatic(System.class);
- when(System.getenv()).thenThrow(new AccessControlException("Forbidden access"));
-
- MapSettings settings = new MapSettings().setProperty(ShellCheckPlugin.ADD_SHELL_LANGUAGE_CONF_PROP, "true");
- Plugin.Context context = getContext(settings);
- new ShellCheckPlugin().define(context);
- assertEquals(7, context.getExtensions().size());
- }
-
@Test
public void testExtensionCounts10() {
environmentVariables.set(ShellCheckPlugin.ADD_SHELL_LANGUAGE_ENV_VAR, "True");
@@ -163,7 +124,7 @@ public void testExtensionCounts13() {
private Plugin.Context getContext(MapSettings settings) {
- SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(Version.create(7, 1), SonarQubeSide.SERVER);
+ SonarRuntime runtime = mock(SonarRuntime.class);
PluginContextImpl.Builder contextBuilder = new PluginContextImpl.Builder();
contextBuilder.setSonarRuntime(runtime);
if (settings != null) {
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
index b5cad09..61d4174 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
@@ -15,30 +15,28 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.highlighting;
-import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
-import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.BashLexer;
-import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.Token;
-import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.TokenType;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
import org.junit.Rule;
import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.reflect.Whitebox;
+import org.mockito.MockedConstruction;
+import org.mockito.Mockito;
import org.sonar.api.batch.sensor.highlighting.TypeOfText;
import org.sonar.api.utils.log.LogTester;
import org.sonar.api.utils.log.LoggerLevel;
-import java.io.IOException;
-import java.util.List;
-
-import static org.junit.Assert.*;
-import static org.powermock.api.mockito.PowerMockito.*;
+import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
+import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.BashLexer;
+import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.Token;
+import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.TokenType;
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(ShellHighlighting.class)
-@PowerMockIgnore("jdk.internal.reflect.*")
public class ShellHighlightingTest {
@Rule
public LogTester logTester = new LogTester();
@@ -55,22 +53,31 @@ public void testConstructors() throws Exception {
ShellHighlighting sh = new ShellHighlighting(Utils.getInputFile("test1.sh").contents());
assertEquals(5, sh.getHighlightingData().size());
- whenNew(BashLexer.class).withAnyArguments().thenThrow(new IOException("Boom!"));
- logTester.clear();
- new ShellHighlighting("foo");
- assertTrue(logTester.logs(LoggerLevel.WARN).size() > 0);
- assertEquals("Could not scan Shell script and highlight code", logTester.logs(LoggerLevel.WARN).get(0));
+ try (MockedConstruction mockBashLexer = Mockito.mockConstruction(BashLexer.class,
+ (mock, context) -> {
+ when(mock.scan()).thenThrow(new IOException("Boom!"));
+ })) {
+ logTester.clear();
+ new ShellHighlighting("foo");
+ assertTrue(logTester.logs(LoggerLevel.WARN).size() > 0);
+ assertEquals("Could not scan Shell script and highlight code", logTester.logs(LoggerLevel.WARN).get(0));
+
+ }
}
@Test
public void test0LengthToken() throws Exception {
- ShellHighlighting sh = new ShellHighlighting("");
- Token token = new Token(TokenType.HEREDOC_LINE, 14, 0, 2, 5);
- try {
- Whitebox.invokeMethod(sh, "addHighlighting", token, null);
- fail("Expected exception not thrown");
- } catch (IllegalArgumentException e) {
- assertEquals("Cannot highlight an empty token", e.getMessage());
+ Token badToken = new Token(TokenType.HEREDOC_LINE, 14, 0, 2, 5);
+ try (MockedConstruction mockBashLexer = Mockito.mockConstruction(BashLexer.class,
+ (mock, context) -> {
+ when(mock.scan()).thenReturn(Arrays.asList(badToken));
+ })) {
+ try {
+ new ShellHighlighting("");
+ fail("Expected exception not thrown");
+ } catch (IllegalArgumentException e) {
+ assertEquals("Cannot highlight an empty token", e.getMessage());
+ }
}
}
@@ -101,13 +108,15 @@ public void testHighlightAllTokenTypes() throws IOException {
assertHighlightingData(sh.getHighlightingData().get(9), 8, 7, 8, 11, TypeOfText.CONSTANT);
assertHighlightingData(sh.getHighlightingData().get(10), 8, 11, 8, 12, TypeOfText.STRING);
- // WORD + HEREDOC_MARKER_TAG + HEREDOC_MARKER_START + HEREDOC_CONTENT + HEREDOC_MARKER_END
+ // WORD + HEREDOC_MARKER_TAG + HEREDOC_MARKER_START + HEREDOC_CONTENT +
+ // HEREDOC_MARKER_END
assertHighlightingData(sh.getHighlightingData().get(11), 10, 6, 10, 8, TypeOfText.STRUCTURED_COMMENT);
assertHighlightingData(sh.getHighlightingData().get(12), 10, 9, 10, 12, TypeOfText.STRUCTURED_COMMENT);
assertHighlightingData(sh.getHighlightingData().get(13), 11, 1, 13, 1, TypeOfText.STRUCTURED_COMMENT);
assertHighlightingData(sh.getHighlightingData().get(14), 13, 1, 13, 4, TypeOfText.STRUCTURED_COMMENT);
- // IF_KEYWORD + EXPR_CONDITIONAL + VARIABLE + COND_OP + WORD + EXPR_CONDITIONAL_END
+ // IF_KEYWORD + EXPR_CONDITIONAL + VARIABLE + COND_OP + WORD +
+ // EXPR_CONDITIONAL_END
assertHighlightingData(sh.getHighlightingData().get(15), 15, 1, 15, 3, TypeOfText.KEYWORD);
assertHighlightingData(sh.getHighlightingData().get(16), 15, 6, 15, 8, TypeOfText.CONSTANT);
assertHighlightingData(sh.getHighlightingData().get(17), 15, 9, 15, 12, TypeOfText.KEYWORD_LIGHT);
@@ -140,7 +149,7 @@ public void testHighlightLineBreaks() {
ShellHighlighting sh = new ShellHighlighting(script);
List data = sh.getHighlightingData();
assertEquals(4, data.size());
- assertHighlightingData(data.get(0), 1, 1, (i < 2)?2:3, 1, TypeOfText.COMMENT);
+ assertHighlightingData(data.get(0), 1, 1, (i < 2) ? 2 : 3, 1, TypeOfText.COMMENT);
assertHighlightingData(data.get(1), 3, 6, 3, 7, TypeOfText.STRING);
assertHighlightingData(data.get(2), 3, 7, 3, 19, TypeOfText.STRING);
assertHighlightingData(data.get(3), 3, 19, 3, 20, TypeOfText.STRING);
@@ -148,8 +157,7 @@ public void testHighlightLineBreaks() {
ShellHighlighting sh = new ShellHighlighting("#!/bin/bash\n" +
"\n" +
- "echo \"Hello\rworld!\"\n"
- );
+ "echo \"Hello\rworld!\"\n");
List data = sh.getHighlightingData();
assertEquals(4, data.size());
assertHighlightingData(data.get(0), 1, 1, 2, 1, TypeOfText.COMMENT);
@@ -158,8 +166,8 @@ public void testHighlightLineBreaks() {
assertHighlightingData(data.get(3), 4, 7, 4, 8, TypeOfText.STRING);
}
-
- private void assertHighlightingData(HighlightingData hd, int startLine, int startColumnIndex, int endLine, int endColumnIndex, TypeOfText typeOfText) {
+ private void assertHighlightingData(HighlightingData hd, int startLine, int startColumnIndex, int endLine,
+ int endColumnIndex, TypeOfText typeOfText) {
assertEquals(startLine, hd.getStartLine());
assertEquals(startColumnIndex, hd.getStartColumnIndex());
assertEquals(endLine, hd.getEndLine());
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
index dd563d4..c667ea8 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
@@ -19,6 +19,7 @@
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.mockito.Mockito;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.internal.SonarRuntimeImpl;
@@ -35,10 +36,9 @@
import java.util.Optional;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.spy;
-import static org.powermock.api.mockito.PowerMockito.when;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class LineCounterTest {
private FileLinesContextFactory fileLinesContextFactory;
@@ -67,7 +67,7 @@ public void testNormal() throws IOException {
public void testIOException() throws IOException {
SensorContextTester context = Utils.getSensorContext();
InputFile inputFile = Utils.getInputFile("test1.sh");
- InputFile spy = spy(inputFile);
+ InputFile spy = Mockito.spy(inputFile);
when(spy.contents()).thenThrow(new IOException("Cannot read file"));
LineCounter.analyse(context, fileLinesContextFactory, spy);
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
index bf2e35a..31e88d3 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
@@ -32,9 +32,9 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class ShellCheckSensorNoRuleTest {
@Rule
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
index 93e96ae..d346841 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
@@ -49,9 +49,11 @@
import static com.github.sbaudoin.sonar.plugins.shellcheck.Utils.issueExists;
import static com.github.sbaudoin.sonar.plugins.shellcheck.Utils.setShellRights;
import static org.junit.Assert.*;
-import static org.mockito.Matchers.any;
-import static org.powermock.api.mockito.PowerMockito.*;
-import static org.powermock.api.mockito.PowerMockito.doThrow;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
public class ShellCheckSensorTest {
private static final String RULE_ID1 = "SC2037";
From 99672bc13ce956bf27e48bbf93b34415e33aeab1 Mon Sep 17 00:00:00 2001
From: didierC
Date: Sat, 15 Feb 2025 12:18:19 +0100
Subject: [PATCH 4/8] Make jacoco works
---
pom.xml | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/pom.xml b/pom.xml
index 093d9ea..fff3cdb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -18,7 +18,6 @@
https://oss.sonatype.org/content/repositories/snapshots
7.1
- 0.8.6
**/lexer/BashLexerBase.java
UTF-8
@@ -101,12 +100,6 @@
2.0.1
test
-
- org.jacoco
- org.jacoco.agent
- ${jacoco.version}
- test
-
com.github.stefanbirkner
system-rules
@@ -223,11 +216,8 @@
org.apache.maven.plugins
maven-surefire-plugin
- --add-opens java.base/java.util=ALL-UNNAMED --add-opens
- java.base/java.lang=ALL-UNNAMED
1
false
-
**/*Test.java
@@ -317,19 +307,40 @@
jacoco-maven-plugin
- prepare-agent
+ pre-unit-test
prepare-agent
+
+ true
+ surefireArgLine
+
- default-report
+ post-unit-test
test
report
+
+
+ *.jar
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ ${surefireArgLine}
+ 1
+ false
+
+ **/*Test.java
+
+
com.github.spotbugs
From cecb7844fc333944fc048680789e80a23f8d2bd8 Mon Sep 17 00:00:00 2001
From: didierC
Date: Sat, 15 Feb 2025 12:47:55 +0100
Subject: [PATCH 5/8] Migrate from com.github.stefanbirkner.system-rules to
uk.org.webcompere.system-stubs-junit4
---
pom.xml | 6 +++---
.../sonar/plugins/shellcheck/ShellCheckPluginTest.java | 5 +++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index fff3cdb..d4fef3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,9 +101,9 @@
test
- com.github.stefanbirkner
- system-rules
- 1.19.0
+ uk.org.webcompere
+ system-stubs-junit4
+ 2.1.7
test
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
index fea98b6..6af7020 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
@@ -20,15 +20,16 @@
import org.junit.Rule;
import org.junit.Test;
-import org.junit.contrib.java.lang.system.EnvironmentVariables;
import org.sonar.api.Plugin;
import org.sonar.api.SonarRuntime;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.internal.PluginContextImpl;
+import uk.org.webcompere.systemstubs.rules.EnvironmentVariablesRule;
+
public class ShellCheckPluginTest {
@Rule
- public final EnvironmentVariables environmentVariables = new EnvironmentVariables();
+ public final EnvironmentVariablesRule environmentVariables = new EnvironmentVariablesRule();
@Test
From a35fe10b35582c248ad2a80a21f8eda5ba41531e Mon Sep 17 00:00:00 2001
From: didierC
Date: Sat, 15 Feb 2025 20:05:50 +0100
Subject: [PATCH 6/8] Upgrade Sonar dependencies Corrects tests Change Logger
Delete code for older SonarQube version
https://sonarsource.atlassian.net/browse/SONAR-11064
---
pom.xml | 36 ++++--
.../plugins/shellcheck/ShellCheckPlugin.java | 8 +-
.../shellcheck/checks/CheckRepository.java | 7 +-
.../highlighting/ShellHighlighting.java | 15 +--
.../sonar/plugins/shellcheck/lexer/Token.java | 4 +-
.../shellcheck/measures/LineCounter.java | 16 +--
.../rules/ShellCheckRulesDefinition.java | 15 ++-
.../shellcheck/rules/ShellCheckSensor.java | 6 +-
.../settings/ShellCheckSettings.java | 13 +-
.../plugins/shellcheck/util/FileSystem.java | 14 ++-
.../shellcheck/ShellCheckPluginTest.java | 2 +-
.../checks/CheckRepositoryTest.java | 6 +-
.../highlighting/HighlightingDataTest.java | 5 -
.../highlighting/ShellHighlightingTest.java | 8 +-
.../measures/LineCountDataTest.java | 14 +--
.../shellcheck/measures/LineCounterTest.java | 68 ++++-------
.../rules/ShellCheckRulesDefinitionTest.java | 19 ++-
.../rules/ShellCheckSensorNoRuleTest.java | 12 +-
.../rules/ShellCheckSensorTest.java | 113 +++++++++---------
.../shellcheck/util/FileSystemTest.java | 27 +++--
20 files changed, 205 insertions(+), 203 deletions(-)
diff --git a/pom.xml b/pom.xml
index d4fef3d..64229c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,9 @@
https://oss.sonatype.org/service/local/staging/deploy/maven2
https://oss.sonatype.org/content/repositories/snapshots
- 7.1
+ 11.0.0.2664
+ 25.2.0.102705
+
**/lexer/BashLexerBase.java
UTF-8
@@ -56,15 +58,15 @@
- org.sonarsource.sonarqube
+ org.sonarsource.api.plugin
sonar-plugin-api
- ${sonar.apiVersion}
+ ${sonar.plugin.api.version}
provided
org.sonarsource.analyzer-commons
sonar-analyzer-commons
- 1.6.0.219
+ 2.16.0.3141
org.apache.commons
@@ -74,13 +76,7 @@
org.json
json
- 20180813
-
-
- org.sonarsource.sonarqube
- sonar-testing-harness
- ${sonar.apiVersion}
- test
+ 20250107
junit
@@ -106,6 +102,24 @@
2.1.7
test
+
+ org.sonarsource.sonarqube
+ sonar-testing-harness
+ ${sonar.version}
+ test
+
+
+ org.sonarsource.sonarqube
+ sonar-plugin-api-impl
+ ${sonar.version}
+ test
+
+
+ org.sonarsource.api.plugin
+ sonar-plugin-api-test-fixtures
+ ${sonar.plugin.api.version}
+ test
+
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
index c4e4edd..80d3ac6 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPlugin.java
@@ -15,15 +15,15 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck;
+import java.util.Optional;
+
+import org.sonar.api.Plugin;
+
import com.github.sbaudoin.sonar.plugins.shellcheck.languages.ShellLanguage;
import com.github.sbaudoin.sonar.plugins.shellcheck.languages.ShellQualityProfile;
import com.github.sbaudoin.sonar.plugins.shellcheck.rules.ShellCheckRulesDefinition;
import com.github.sbaudoin.sonar.plugins.shellcheck.rules.ShellCheckSensor;
import com.github.sbaudoin.sonar.plugins.shellcheck.settings.ShellCheckSettings;
-import org.sonar.api.Plugin;
-
-import java.security.AccessControlException;
-import java.util.Optional;
public class ShellCheckPlugin implements Plugin {
public static final String ADD_SHELL_LANGUAGE_ENV_VAR = "SHELLCHECK_LANGUAGE_ADD";
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java
index 90cd674..e1493da 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepository.java
@@ -16,9 +16,10 @@
package com.github.sbaudoin.sonar.plugins.shellcheck.checks;
import com.github.sbaudoin.sonar.plugins.shellcheck.util.FileSystem;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
import java.io.IOException;
import java.net.URISyntaxException;
@@ -33,7 +34,7 @@ public class CheckRepository {
public static final String REPOSITORY_NAME = "ShellCheck";
public static final String RULES_DEFINITION_FOLDER = "org/sonar/l10n/shellcheck/rules/shellcheck";
- private static final Logger LOGGER = Loggers.get(CheckRepository.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(CheckRepository.class);
private static final List RULE_KEYS = new ArrayList<>();
static {
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java
index 7404a89..0d01f4a 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlighting.java
@@ -15,22 +15,23 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.highlighting;
-import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.BashLexer;
-import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.Token;
-import org.sonar.api.batch.sensor.highlighting.TypeOfText;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.sonar.api.batch.sensor.highlighting.TypeOfText;
+
+import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.BashLexer;
+import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.Token;
+
/**
* Class in charge of Shell code highlighting in SonarQube
*/
public class ShellHighlighting {
- private static final Logger LOGGER = Loggers.get(ShellHighlighting.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ShellHighlighting.class);
private List highlighting = new ArrayList<>();
private String code;
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java
index 786e4b3..bbdaada 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/lexer/Token.java
@@ -20,7 +20,7 @@
/**
* This class represents the tokens identified by Shell lexers
*/
-public class Token implements Serializable, Comparable {
+public class Token implements Serializable, Comparable {
/**
* The token type
*/
@@ -88,7 +88,7 @@ public String toString() {
}
@Override
- public int compareTo(Object o) {
+ public int compareTo(Token o) {
Token t = (Token) o;
if (this.start != t.start) {
return (this.start - t.start);
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java
index 3dab46b..c0bb245 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounter.java
@@ -15,25 +15,24 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.measures;
+import java.io.IOException;
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.FileLinesContext;
import org.sonar.api.measures.FileLinesContextFactory;
import org.sonar.api.measures.Metric;
-import org.sonar.api.utils.Version;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
-
-import java.io.IOException;
-import java.io.Serializable;
/**
* Class used to count the code and comment lines of a Shell script and save these "facts"
* into SonarQube as measures
*/
public class LineCounter {
- private static final Logger LOGGER = Loggers.get(LineCounter.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(LineCounter.class);
/**
* Hide constructor
@@ -73,9 +72,6 @@ public static void analyse(SensorContext context, FileLinesContextFactory fileLi
private static void saveMeasures(InputFile script, LineCountData data, FileLinesContext fileLinesContext, SensorContext context) {
for (int line = 1; line <= data.linesNumber(); line++) {
fileLinesContext.setIntValue(CoreMetrics.NCLOC_DATA_KEY, line, data.linesOfCodeLines().contains(line) ? 1 : 0);
- if (Version.create(7, 3).isGreaterThanOrEqual(context.getSonarQubeVersion())) {
- fileLinesContext.setIntValue(CoreMetrics.COMMENT_LINES_DATA_KEY, line, data.effectiveCommentLines().contains(line) ? 1 : 0);
- }
}
fileLinesContext.save();
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java
index ba0dbda..bee6c54 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinition.java
@@ -17,6 +17,8 @@
import com.github.sbaudoin.sonar.plugins.shellcheck.checks.CheckRepository;
import com.github.sbaudoin.sonar.plugins.shellcheck.languages.ShellLanguage;
+
+import org.sonar.api.SonarRuntime;
import org.sonar.api.server.rule.RulesDefinition;
import org.sonarsource.analyzer.commons.RuleMetadataLoader;
@@ -24,11 +26,20 @@
import java.util.List;
public class ShellCheckRulesDefinition implements RulesDefinition {
+
+ private final SonarRuntime sonarRuntime;
+
+ public ShellCheckRulesDefinition(SonarRuntime sonarRuntime) {
+ this.sonarRuntime = sonarRuntime;
+ }
+
@Override
public void define(RulesDefinition.Context context) {
- RulesDefinition.NewRepository repository = context.createRepository(CheckRepository.REPOSITORY_KEY, ShellLanguage.KEY).setName(CheckRepository.REPOSITORY_NAME);
+ RulesDefinition.NewRepository repository = context
+ .createRepository(CheckRepository.REPOSITORY_KEY, ShellLanguage.KEY)
+ .setName(CheckRepository.REPOSITORY_NAME);
- RuleMetadataLoader metadataLoader = new RuleMetadataLoader(CheckRepository.RULES_DEFINITION_FOLDER);
+ RuleMetadataLoader metadataLoader = new RuleMetadataLoader(CheckRepository.RULES_DEFINITION_FOLDER, this.sonarRuntime);
List keys = new ArrayList<>();
CheckRepository.getRuleKeys().forEach(keys::add);
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java
index 0996d2f..34e1c07 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensor.java
@@ -24,6 +24,8 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.FilePredicate;
import org.sonar.api.batch.fs.InputFile;
@@ -35,8 +37,6 @@
import org.sonar.api.batch.sensor.issue.NewIssueLocation;
import org.sonar.api.measures.FileLinesContextFactory;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
import java.io.*;
import java.util.*;
@@ -45,7 +45,7 @@
* SonarQube sensor class responsible for analyzing Shell scripts with ShellCheck
*/
public class ShellCheckSensor implements Sensor {
- private static final Logger LOGGER = Loggers.get(ShellCheckSensor.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ShellCheckSensor.class);
/**
* The underlying file system that will give access to the files to be analyzed
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java
index cf89a82..12d1756 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/settings/ShellCheckSettings.java
@@ -15,13 +15,12 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.settings;
-import org.sonar.api.PropertyType;
-import org.sonar.api.config.PropertyDefinition;
-import org.sonar.api.resources.Qualifiers;
+import static java.util.Arrays.asList;
import java.util.List;
-import static java.util.Arrays.asList;
+import org.sonar.api.PropertyType;
+import org.sonar.api.config.PropertyDefinition;
public class ShellCheckSettings {
public static final String SHELLCHECK_PATH_KEY = "sonar.shellcheck.shellcheck.path";
@@ -45,14 +44,14 @@ public static List getProperties() {
.defaultValue(FILE_SUFFIXES_DEFAULT_VALUE)
.multiValues(true)
.category("Shell")
- .onQualifiers(Qualifiers.PROJECT)
+ .onConfigScopes(PropertyDefinition.ConfigScope.PROJECT)
.build(),
PropertyDefinition.builder(SHELLCHECK_PATH_KEY)
.name("Path to shellcheck")
.description("Path to the shellcheck executable. Leave it empty if the command is in the system path.")
.defaultValue(SHELLCHECK_PATH_DEFAULT_VALUE)
.category(SHELLCHECK_CATEGORY)
- .onQualifiers(Qualifiers.PROJECT)
+ .onConfigScopes(PropertyDefinition.ConfigScope.PROJECT)
.build(),
PropertyDefinition.builder(SKIP_KEY)
.type(PropertyType.BOOLEAN)
@@ -60,7 +59,7 @@ public static List getProperties() {
.description("If set to true, ShellCheck will not be executed for this project.")
.defaultValue(SKIP_DEFAULT_VALUE)
.category(SHELLCHECK_CATEGORY)
- .onQualifiers(Qualifiers.PROJECT)
+ .onConfigScopes(PropertyDefinition.ConfigScope.PROJECT)
.build()
);
}
diff --git a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java
index ca125d4..f6cabe1 100644
--- a/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java
+++ b/src/main/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystem.java
@@ -15,23 +15,29 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.util;
-import org.sonar.api.utils.log.Logger;
-import org.sonar.api.utils.log.Loggers;
import java.io.Closeable;
import java.io.IOException;
import java.net.URI;
-import java.nio.file.*;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileSystemAlreadyExistsException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.NotDirectoryException;
+import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Stream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* A class used to make the default {@code FileSystem} be closable like the other file systems without raising an exception
*/
public final class FileSystem implements Closeable {
- private static final Logger LOGGER = Loggers.get(FileSystem.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(FileSystem.class);
private boolean defaultFileSystem = false;
private java.nio.file.FileSystem fs;
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
index 6af7020..a2a242e 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/ShellCheckPluginTest.java
@@ -129,7 +129,7 @@ private Plugin.Context getContext(MapSettings settings) {
PluginContextImpl.Builder contextBuilder = new PluginContextImpl.Builder();
contextBuilder.setSonarRuntime(runtime);
if (settings != null) {
- contextBuilder.setBootConfiguration(settings.asConfig());
+ contextBuilder.setBootConfiguration(settings.asConfig());
}
return contextBuilder.build();
}
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java
index bf37351..a14be48 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/checks/CheckRepositoryTest.java
@@ -17,9 +17,9 @@
import org.junit.Rule;
import org.junit.Test;
+import org.slf4j.event.Level;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
+import org.sonar.api.testfixtures.log.LogTester;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -36,6 +36,6 @@ public void testGetRuleKey() {
@Test
public void testGetRuleKeys() {
assertEquals(1, CheckRepository.getRuleKeys().size());
- assertTrue(logTester.logs(LoggerLevel.WARN).contains("Rule rule2 defined but not described (.html file missing)"));
+ assertTrue(logTester.logs(Level.WARN).contains("Rule rule2 defined but not described (.html file missing)"));
}
}
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java
index a76e632..1b3d47d 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/HighlightingDataTest.java
@@ -51,11 +51,6 @@ public NewHighlighting onFile(InputFile inputFile) {
return null;
}
- @Override
- public NewHighlighting highlight(int startOffset, int endOffset, TypeOfText typeOfText) {
- return null;
- }
-
@Override
public NewHighlighting highlight(TextRange range, TypeOfText typeOfText) {
return null;
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
index 61d4174..efa62cc 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/highlighting/ShellHighlightingTest.java
@@ -28,9 +28,9 @@
import org.junit.Test;
import org.mockito.MockedConstruction;
import org.mockito.Mockito;
+import org.slf4j.event.Level;
import org.sonar.api.batch.sensor.highlighting.TypeOfText;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
+import org.sonar.api.testfixtures.log.LogTester;
import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
import com.github.sbaudoin.sonar.plugins.shellcheck.lexer.BashLexer;
@@ -59,8 +59,8 @@ public void testConstructors() throws Exception {
})) {
logTester.clear();
new ShellHighlighting("foo");
- assertTrue(logTester.logs(LoggerLevel.WARN).size() > 0);
- assertEquals("Could not scan Shell script and highlight code", logTester.logs(LoggerLevel.WARN).get(0));
+ assertTrue(logTester.logs(Level.WARN).size() > 0);
+ assertEquals("Could not scan Shell script and highlight code", logTester.logs(Level.WARN).get(0));
}
}
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java
index 4c1bf02..aea3510 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCountDataTest.java
@@ -15,21 +15,21 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.measures;
-import junit.framework.TestCase;
-
import java.util.Arrays;
import java.util.HashSet;
+import junit.framework.TestCase;
+
public class LineCountDataTest extends TestCase {
public void testAll() {
LineCountData lcd = new LineCountData(1, null, null);
- assertEquals(new Integer(1), lcd.linesNumber());
+ assertEquals(Integer.valueOf(1), lcd.linesNumber());
assertNull(lcd.effectiveCommentLines());
assertNull(lcd.linesOfCodeLines());
- lcd = new LineCountData(5, new HashSet(Arrays.asList(1, 2)), new HashSet(Arrays.asList(3, 4)));
- assertEquals(new Integer(5), lcd.linesNumber());
- assertEquals(new HashSet(Arrays.asList(3, 4)), lcd.effectiveCommentLines());
- assertEquals(new HashSet(Arrays.asList(1, 2)), lcd.linesOfCodeLines());
+ lcd = new LineCountData(5, new HashSet(Arrays.asList(1, 2)), new HashSet(Arrays.asList(3, 4)));
+ assertEquals(Integer.valueOf(5), lcd.linesNumber());
+ assertEquals(new HashSet(Arrays.asList(3, 4)), lcd.effectiveCommentLines());
+ assertEquals(new HashSet(Arrays.asList(1, 2)), lcd.linesOfCodeLines());
}
}
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
index c667ea8..0ef907b 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/measures/LineCounterTest.java
@@ -15,30 +15,28 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.measures;
-import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.Mockito;
+import org.slf4j.event.Level;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
-import org.sonar.api.internal.SonarRuntimeImpl;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.FileLinesContext;
import org.sonar.api.measures.FileLinesContextFactory;
-import org.sonar.api.utils.Version;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
+import org.sonar.api.testfixtures.log.LogTester;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
public class LineCounterTest {
private FileLinesContextFactory fileLinesContextFactory;
@@ -59,8 +57,12 @@ public void testNormal() throws IOException {
SensorContextTester context = Utils.getSensorContext();
String filePath = "test4.sh";
LineCounter.analyse(context, fileLinesContextFactory, Utils.getInputFile(filePath));
- assertEquals(new Integer(13), context.measure(getComponentKey(filePath), CoreMetrics.NCLOC).value());
- assertEquals(new Integer(2), context.measure(getComponentKey(filePath), CoreMetrics.COMMENT_LINES).value());
+ // Check the number 4 line in script containing code. be careful +1 is smowhere
+ assertEquals(Integer.valueOf(1), ((MyFileLinesContext)fileLinesContext).getIntValue(CoreMetrics.NCLOC_DATA_KEY, 5));
+ // Check the number 4 line in script containing comment. be careful +1 is smowhere
+ assertEquals(Integer.valueOf(0), ((MyFileLinesContext)fileLinesContext).getIntValue(CoreMetrics.NCLOC_DATA_KEY, 1));
+ assertEquals(Integer.valueOf(13), context.measure(getComponentKey(filePath), CoreMetrics.NCLOC).value());
+ assertEquals(Integer.valueOf(2), context.measure(getComponentKey(filePath), CoreMetrics.COMMENT_LINES).value());
}
@Test
@@ -71,34 +73,10 @@ public void testIOException() throws IOException {
when(spy.contents()).thenThrow(new IOException("Cannot read file"));
LineCounter.analyse(context, fileLinesContextFactory, spy);
- assertEquals(1, logTester.logs(LoggerLevel.WARN).size());
- assertEquals("Unable to count lines for file " + inputFile.filename() + ", ignoring measures", logTester.logs(LoggerLevel.WARN).get(0));
+ assertEquals(1, logTester.logs(Level.WARN).size());
+ assertEquals("Unable to count lines for file " + inputFile.filename() + ", ignoring measures", logTester.logs(Level.WARN).get(0));
}
- @Test
- public void testAnalyseWithOldVersion() throws IOException {
- SensorContextTester context = Utils.getSensorContext();
- String filePath = "test4.sh";
- InputFile inputFile = Utils.getInputFile(filePath);
-
- // Version taken from the Maven dependency
- LineCounter.analyse(context, fileLinesContextFactory, Utils.getInputFile(filePath));
- assertEquals(new Integer(1), fileLinesContext.getIntValue(CoreMetrics.COMMENT_LINES_DATA_KEY, 2));
- }
-
- @Test
- public void testAnalyseWithNewVersion() throws IOException {
- SensorContextTester context = Utils.getSensorContext();
- context.setRuntime(SonarRuntimeImpl.forSonarQube(Version.create(7, 5), context.runtime().getSonarQubeSide()));
- String filePath = "test4.sh";
- InputFile inputFile = Utils.getInputFile(filePath);
-
- // With version 7.5, the COMMENT_LINES_DATA metrics should not be set
- LineCounter.analyse(context, fileLinesContextFactory, Utils.getInputFile(filePath));
- assertEquals(new Integer(-1), fileLinesContext.getIntValue(CoreMetrics.COMMENT_LINES_DATA_KEY, 2));
- }
-
-
private String getComponentKey(String filePath) {
return Utils.MODULE_KEY + ":src/test/resources/" + filePath;
}
@@ -119,7 +97,6 @@ public void setIntValue(String metricKey, int line, int value) {
}
}
- @Override
public Integer getIntValue(String metricKey, int line) {
if (intValues.containsKey(metricKey)) {
return intValues.get(metricKey).getOrDefault(line, -1);
@@ -133,11 +110,6 @@ public void setStringValue(String metricKey, int line, String value) {
}
- @Override
- public String getStringValue(String metricKey, int line) {
- return null;
- }
-
@Override
public void save() {
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java
index 0ae19c3..025f343 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckRulesDefinitionTest.java
@@ -15,17 +15,26 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.rules;
-import com.github.sbaudoin.sonar.plugins.shellcheck.checks.CheckRepository;
-import com.github.sbaudoin.sonar.plugins.shellcheck.languages.ShellLanguage;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertNotEquals;
+
+import org.sonar.api.SonarRuntime;
+import org.sonar.api.batch.sensor.internal.SensorContextTester;
+import org.sonar.api.internal.SonarRuntimeImpl;
import org.sonar.api.server.rule.RulesDefinition;
import org.sonar.api.server.rule.RulesDefinition.Rule;
+import org.sonar.api.utils.Version;
-import static org.junit.Assert.assertNotEquals;
+import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
+import com.github.sbaudoin.sonar.plugins.shellcheck.checks.CheckRepository;
+import com.github.sbaudoin.sonar.plugins.shellcheck.languages.ShellLanguage;
+
+import junit.framework.TestCase;
public class ShellCheckRulesDefinitionTest extends TestCase {
public void testDefine() {
- ShellCheckRulesDefinition rulesDefinition = new ShellCheckRulesDefinition();
+ SensorContextTester sensorContext = Utils.getSensorContext();
+ SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(7, 5), sensorContext.runtime().getSonarQubeSide(), sensorContext.runtime().getEdition());
+ ShellCheckRulesDefinition rulesDefinition = new ShellCheckRulesDefinition(sonarRuntime);
RulesDefinition.Context context = new RulesDefinition.Context();
rulesDefinition.define(context);
RulesDefinition.Repository repository = context.repository(CheckRepository.REPOSITORY_KEY);
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
index 31e88d3..9486abb 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorNoRuleTest.java
@@ -20,13 +20,13 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.slf4j.event.Level;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.measures.FileLinesContext;
import org.sonar.api.measures.FileLinesContextFactory;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
+import org.sonar.api.testfixtures.log.LogTester;
import java.io.IOException;
@@ -65,10 +65,10 @@ public void testNoActiveRule() throws IOException {
ShellCheckSensor sensor = new ShellCheckSensor(fs, fileLinesContextFactory);
sensor.execute(context);
- assertEquals(3, logTester.logs(LoggerLevel.INFO).size());
- assertTrue(logTester.logs(LoggerLevel.INFO).get(0).startsWith("No active rules found for this plugin, skipping analysis of test"));
- assertTrue(logTester.logs(LoggerLevel.INFO).get(1).startsWith("No active rules found for this plugin, skipping analysis of test"));
- assertTrue(logTester.logs(LoggerLevel.INFO).get(2).startsWith("No active rules found for this plugin, skipping analysis of test"));
+ assertEquals(3, logTester.logs(Level.INFO).size());
+ assertTrue(logTester.logs(Level.INFO).get(0).startsWith("No active rules found for this plugin, skipping analysis of test"));
+ assertTrue(logTester.logs(Level.INFO).get(1).startsWith("No active rules found for this plugin, skipping analysis of test"));
+ assertTrue(logTester.logs(Level.INFO).get(2).startsWith("No active rules found for this plugin, skipping analysis of test"));
assertEquals(0, context.allIssues().size());
}
}
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
index d346841..f77fc7c 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/rules/ShellCheckSensorTest.java
@@ -15,18 +15,35 @@
*/
package com.github.sbaudoin.sonar.plugins.shellcheck.rules;
-import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
-import com.github.sbaudoin.sonar.plugins.shellcheck.checks.CheckRepository;
-import com.github.sbaudoin.sonar.plugins.shellcheck.languages.ShellLanguage;
-import com.github.sbaudoin.sonar.plugins.shellcheck.settings.ShellCheckSettings;
+import static com.github.sbaudoin.sonar.plugins.shellcheck.Utils.issueExists;
+import static com.github.sbaudoin.sonar.plugins.shellcheck.Utils.setShellRights;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.function.Predicate;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
+import org.slf4j.event.Level;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.rule.ActiveRules;
import org.sonar.api.batch.rule.internal.ActiveRulesBuilder;
+import org.sonar.api.batch.rule.internal.NewActiveRule;
import org.sonar.api.batch.sensor.SensorDescriptor;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.batch.sensor.issue.Issue;
@@ -35,31 +52,18 @@
import org.sonar.api.measures.FileLinesContext;
import org.sonar.api.measures.FileLinesContextFactory;
import org.sonar.api.rule.RuleKey;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
+import org.sonar.api.testfixtures.log.LogTester;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.function.Predicate;
-
-import static com.github.sbaudoin.sonar.plugins.shellcheck.Utils.issueExists;
-import static com.github.sbaudoin.sonar.plugins.shellcheck.Utils.setShellRights;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
+import com.github.sbaudoin.sonar.plugins.shellcheck.Utils;
+import com.github.sbaudoin.sonar.plugins.shellcheck.checks.CheckRepository;
+import com.github.sbaudoin.sonar.plugins.shellcheck.languages.ShellLanguage;
+import com.github.sbaudoin.sonar.plugins.shellcheck.settings.ShellCheckSettings;
public class ShellCheckSensorTest {
private static final String RULE_ID1 = "SC2037";
private static final String RULE_ID2 = "SC2086";
- private final RuleKey ruleKey1 = RuleKey.of(CheckRepository.REPOSITORY_KEY, RULE_ID1);
- private final RuleKey ruleKey2 = RuleKey.of(CheckRepository.REPOSITORY_KEY, RULE_ID2);
+ private final NewActiveRule ruleKey1 = new NewActiveRule.Builder().setRuleKey(RuleKey.of(CheckRepository.REPOSITORY_KEY, RULE_ID1)).build();
+ private final NewActiveRule ruleKey2 = new NewActiveRule.Builder().setRuleKey(RuleKey.of(CheckRepository.REPOSITORY_KEY, RULE_ID2)).build();
private SensorContextTester context;
private ShellCheckSensor sensor;
@@ -68,7 +72,7 @@ public class ShellCheckSensorTest {
public TemporaryFolder temporaryFolder = new TemporaryFolder();
@Rule
- public LogTester logTester = new LogTester();
+ public LogTester logTester = new LogTester().setLevel(Level.DEBUG);
@Before
public void init() throws Exception {
@@ -79,10 +83,8 @@ public void init() throws Exception {
context.setFileSystem(fs);
ActiveRules activeRules = new ActiveRulesBuilder()
- .create(ruleKey1)
- .activate()
- .create(ruleKey2)
- .activate()
+ .addRule(ruleKey1)
+ .addRule(ruleKey2)
.build();
context.setActiveRules(activeRules);
@@ -106,8 +108,8 @@ public void testshellCheckVersion() throws IOException {
// Have to set an invalid path because Travis' build container embeds ShellCheck
context.settings().appendProperty(ShellCheckSettings.SHELLCHECK_PATH_KEY, "invalid-command");
sensor.execute(context);
- assertEquals(1, logTester.logs(LoggerLevel.WARN).size());
- assertEquals("Cannot get ShellCheck version", logTester.logs(LoggerLevel.WARN).get(0));
+ assertEquals(1, logTester.logs(Level.WARN).size());
+ assertEquals("Cannot get ShellCheck version", logTester.logs(Level.WARN).get(0));
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
context.settings().setProperty(ShellCheckSettings.SHELLCHECK_PATH_KEY, "src\\test\\resources\\scripts\\shellcheck-version.cmd");
@@ -116,12 +118,12 @@ public void testshellCheckVersion() throws IOException {
setShellRights("src/test/resources/scripts/shellcheck-version.sh");
}
- List l = logTester.logs(LoggerLevel.INFO);
+ logTester.logs(Level.INFO);
sensor.execute(context);
- assertEquals(3, logTester.logs(LoggerLevel.INFO).size());
- assertEquals("ShellCheck version:", logTester.logs(LoggerLevel.INFO).get(0));
- assertEquals("ShellCheck - shell script analysis tool", logTester.logs(LoggerLevel.INFO).get(1));
- assertEquals("version: my-version", logTester.logs(LoggerLevel.INFO).get(2));
+ assertEquals(3, logTester.logs(Level.INFO).size());
+ assertEquals("ShellCheck version:", logTester.logs(Level.INFO).get(0));
+ assertEquals("ShellCheck - shell script analysis tool", logTester.logs(Level.INFO).get(1));
+ assertEquals("version: my-version", logTester.logs(Level.INFO).get(2));
}
@Test
@@ -158,8 +160,8 @@ public void testExecuteWithShellCheckErrorOutput() throws IOException {
sensor.execute(context);
- assertEquals(3, logTester.logs(LoggerLevel.WARN).size());
- logTester.logs(LoggerLevel.WARN).stream().forEach(log -> assertTrue(log.startsWith("Errors happened during analysis:")));
+ assertEquals(3, logTester.logs(Level.WARN).size());
+ logTester.logs(Level.WARN).stream().forEach(log -> assertTrue(log.startsWith("Errors happened during analysis:")));
}
@Test
@@ -230,9 +232,9 @@ public void testExecuteWithShellCheckLongOutput() throws IOException {
Collection issues = context.allIssues();
assertEquals(3, issues.size());
- assertTrue(issueExists(issues, ruleKey1, script1, 3, "To assign the output of a command, use var=\\$\\(cmd\\) \\."));
- assertTrue(issueExists(issues, ruleKey2, script1, 5, "Double quote to prevent globbing and word splitting."));
- assertTrue(issueExists(issues, ruleKey2, script1, 6, "Double quote to prevent globbing and word splitting."));
+ assertTrue(issueExists(issues, ruleKey1.ruleKey(), script1, 3, "To assign the output of a command, use var=\\$\\(cmd\\) \\."));
+ assertTrue(issueExists(issues, ruleKey2.ruleKey(), script1, 5, "Double quote to prevent globbing and word splitting."));
+ assertTrue(issueExists(issues, ruleKey2.ruleKey(), script1, 6, "Double quote to prevent globbing and word splitting."));
}
@Test
@@ -244,8 +246,8 @@ public void testGetShellCheckPath() {
@Test
public void testExecuteCommand() {
- ArrayList stdOut = new ArrayList();
- ArrayList stdErr = new ArrayList();
+ ArrayList stdOut = new ArrayList();
+ ArrayList stdErr = new ArrayList();
try {
sensor.executeCommand(Arrays.asList("invalid-command", "bar"), stdOut, stdErr);
@@ -292,9 +294,9 @@ public void testSaveIssues() throws IOException {
Collection issues = context.allIssues();
assertEquals(3, issues.size());
- assertTrue(issueExists(issues, ruleKey1, shellScript, 3, "To assign the output of a command, use var=\\$\\(cmd\\) \\."));
- assertTrue(issueExists(issues, ruleKey2, shellScript, 5, "Double quote to prevent globbing and word splitting."));
- assertTrue(issueExists(issues, ruleKey2, shellScript, 6, "Double quote to prevent globbing and word splitting."));
+ assertTrue(issueExists(issues, ruleKey1.ruleKey(), shellScript, 3, "To assign the output of a command, use var=\\$\\(cmd\\) \\."));
+ assertTrue(issueExists(issues, ruleKey2.ruleKey(), shellScript, 5, "Double quote to prevent globbing and word splitting."));
+ assertTrue(issueExists(issues, ruleKey2.ruleKey(), shellScript, 6, "Double quote to prevent globbing and word splitting."));
}
@Test(expected = IllegalArgumentException.class)
@@ -312,14 +314,14 @@ public void testSaveIssue() throws IOException {
// Try to save issue for an unknown rule
logTester.clear();
sensor.saveIssue(context, shellScript, 2, "foo", "An error here");
- assertTrue(logTester.logs(LoggerLevel.DEBUG).contains("Rule foo ignored, not found in repository"));
+ assertTrue(logTester.logs(Level.DEBUG).contains("Rule foo ignored, not found in repository"));
// Save issue for a known rule
logTester.clear();
sensor.saveIssue(context, shellScript, 2, RULE_ID1, "An error here");
assertEquals(1, context.allIssues().size());
Issue issue = (Issue)context.allIssues().toArray()[0];
- assertEquals(ruleKey1, issue.ruleKey());
+ assertEquals(ruleKey1.ruleKey(), issue.ruleKey());
IssueLocation location = issue.primaryLocation();
assertEquals(shellScript.key(), location.inputComponent().key());
assertEquals(2, location.textRange().start().line());
@@ -350,8 +352,8 @@ public void testSkip() throws IOException {
Collection issues = context.allIssues();
assertEquals(0, issues.size());
- assertEquals(1, logTester.logs(LoggerLevel.INFO).size());
- assertEquals("Plugin disabled by configuration for this project: the code will not be analyzed but will be highlighted.", logTester.logs(LoggerLevel.INFO).get(0));
+ assertEquals(1, logTester.logs(Level.INFO).size());
+ assertEquals("Plugin disabled by configuration for this project: the code will not be analyzed but will be highlighted.", logTester.logs(Level.INFO).get(0));
}
@@ -392,22 +394,17 @@ public SensorDescriptor createIssuesForRuleRepositories(String... repositoryKeys
}
@Override
- public SensorDescriptor requireProperty(String... propertyKey) {
- return this;
- }
-
- @Override
- public SensorDescriptor requireProperties(String... propertyKeys) {
+ public SensorDescriptor global() {
return this;
}
@Override
- public SensorDescriptor global() {
+ public SensorDescriptor onlyWhenConfiguration(Predicate predicate) {
return this;
}
@Override
- public SensorDescriptor onlyWhenConfiguration(Predicate predicate) {
+ public SensorDescriptor processesFilesIndependently() {
return this;
}
}
diff --git a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java
index 3f9677d..299ce40 100644
--- a/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java
+++ b/src/test/java/com/github/sbaudoin/sonar/plugins/shellcheck/util/FileSystemTest.java
@@ -17,8 +17,8 @@
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.utils.log.LogTester;
-import org.sonar.api.utils.log.LoggerLevel;
+import org.slf4j.event.Level;
+import org.sonar.api.testfixtures.log.LogTester;
import java.io.IOException;
import java.lang.reflect.Field;
@@ -54,26 +54,27 @@ public void testConstructor() throws NoSuchFieldException, IllegalAccessExceptio
// Test with an invalid URI
fs = new FileSystem(Paths.get("src").toUri());
- assertEquals(1, logTester.logs(LoggerLevel.WARN).size());
- assertTrue(logTester.logs(LoggerLevel.WARN).get(0).startsWith("Using default FS because of an error: "));
+ assertEquals(1, logTester.logs(Level.WARN).size());
+ assertTrue(logTester.logs(Level.WARN).get(0).startsWith("Using default FS because of an error: "));
assertTrue((Boolean)defaultFS.get(fs));
assertEquals(FileSystems.getDefault(), fsField.get(fs));
logTester.clear();
FileSystem fs2 = new FileSystem(new URI("file:///"));
- assertEquals(1, logTester.logs(LoggerLevel.WARN).size());
- assertTrue(logTester.logs(LoggerLevel.WARN).get(0).startsWith("FS already exists for URI: "));
+ assertEquals(1, logTester.logs(Level.WARN).size());
+ assertTrue(logTester.logs(Level.WARN).get(0).startsWith("FS already exists for URI: "));
assertEquals(fsField.get(fs), fsField.get(fs2));
}
@Test
public void testReadDirectory() throws URISyntaxException, IOException {
- FileSystem fs = new FileSystem(new URI("file:///"));
- Path root = Paths.get("src", "test", "resources", "org", "sonar", "l10n", "shellcheck", "rules", "shellcheck");
- List content = fs.readDirectory(root.toUri()).collect(Collectors.toList());
- assertEquals(3, content.size());
- assertTrue(content.contains(root.resolve("rule1.html").toAbsolutePath()));
- assertTrue(content.contains(root.resolve("rule1.json").toAbsolutePath()));
- assertTrue(content.contains(root.resolve("rule2.json").toAbsolutePath()));
+ try (FileSystem fs = new FileSystem(new URI("file:///"))) {
+ Path root = Paths.get("src", "test", "resources", "org", "sonar", "l10n", "shellcheck", "rules", "shellcheck");
+ List content = fs.readDirectory(root.toUri()).collect(Collectors.toList());
+ assertEquals(3, content.size());
+ assertTrue(content.contains(root.resolve("rule1.html").toAbsolutePath()));
+ assertTrue(content.contains(root.resolve("rule1.json").toAbsolutePath()));
+ assertTrue(content.contains(root.resolve("rule2.json").toAbsolutePath()));
+ }
}
}
From e4c3a17b4853b86d4261a6500e00edbb94908c17 Mon Sep 17 00:00:00 2001
From: didierC
Date: Sun, 16 Feb 2025 00:23:02 +0100
Subject: [PATCH 7/8] Upgrade it test
---
it/Dockerfile-auditor | 40 +++++++++++++++++++++++++---
it/audit.sh | 53 ++++++++++---------------------------
it/docker-compose.yml | 11 ++++----
it/it.sh | 48 +++++++++++++++++++++++++--------
it/sonar-project.properties | 2 --
5 files changed, 93 insertions(+), 61 deletions(-)
mode change 100644 => 100755 it/it.sh
diff --git a/it/Dockerfile-auditor b/it/Dockerfile-auditor
index fd17dfa..e969c74 100644
--- a/it/Dockerfile-auditor
+++ b/it/Dockerfile-auditor
@@ -1,4 +1,38 @@
-ARG JDK_VERSION=8
-FROM openjdk:${JDK_VERSION}
-COPY it /usr/src/myapp/it
+ARG SCANNER_VERSION=latest
+FROM sonarsource/sonar-scanner-cli:${SCANNER_VERSION} AS builder
+
+FROM eclipse-temurin:21-jre-alpine
+
+ARG SONAR_SCANNER_HOME=/opt/sonar-scanner
+ENV HOME=/tmp \
+ SONAR_SCANNER_HOME=${SONAR_SCANNER_HOME} \
+ XDG_CONFIG_HOME=/tmp \
+ SONAR_USER_HOME=${SONAR_SCANNER_HOME}/.sonar \
+ PATH=${SONAR_SCANNER_HOME}/bin:${PATH} \
+ SRC_PATH=/usr/src \
+ SCANNER_WORKDIR_PATH=/tmp/.scannerwork \
+ LANG=C.UTF-8 \
+ LC_ALL=C.UTF-8 \
+ PYTHONUNBUFFERED=1
+
WORKDIR /usr/src/myapp/it
+
+USER root
+# Copy Scanner installation from builder image
+COPY --from=builder /opt/sonar-scanner /opt/sonar-scanner
+
+
+RUN apk update --no-cache && \
+ apk add --update --no-cache -q curl gcc jq libffi-dev musl-dev openssl-dev python3 py3-requests shellcheck
+
+RUN set -eux && \
+ addgroup --gid 1000 scanner-cli && \
+ adduser --uid 1000 --ingroup scanner-cli --disabled-password --no-create-home --gecos "" scanner-cli && \
+ chown -R scanner-cli:scanner-cli "${SONAR_SCANNER_HOME}" "${SRC_PATH}" && \
+ mkdir -p "${SRC_PATH}" "${SONAR_USER_HOME}" "${SONAR_USER_HOME}/cache" "${SCANNER_WORKDIR_PATH}" && \
+ chown -R scanner-cli:scanner-cli "${SONAR_SCANNER_HOME}" "${SRC_PATH}" "${SCANNER_WORKDIR_PATH}" && \
+ chmod -R 555 "${SONAR_SCANNER_HOME}" && \
+ chmod -R 754 "${SRC_PATH}" "${SONAR_USER_HOME}" "${SCANNER_WORKDIR_PATH}"
+
+USER scanner-cli
+COPY it /usr/src/myapp/it
diff --git a/it/audit.sh b/it/audit.sh
index 06bac8e..43cac0b 100644
--- a/it/audit.sh
+++ b/it/audit.sh
@@ -1,26 +1,12 @@
-#!/bin/bash -e
-
-# Install requirements
-echo "Installing ShellCheck..."
-if grep -q Debian /etc/issue
-then
- apt-get -qq update
- apt-get -qq install -y shellcheck > /dev/null
-else
- apk update
- apk add -q shellcheck
-fi
-
-# Install sonar-runner
-echo "Installing Sonar scanner..."
-cd /tmp
-wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SCANNER_VERSION.zip
-unzip -q sonar-scanner-cli-$SCANNER_VERSION.zip
-export PATH=/tmp/sonar-scanner-$SCANNER_VERSION/bin:$PATH
+#!/bin/sh -e
# Configure sonar-runner
-echo "sonar.host.url=http://sonarqube:9000" > /tmp/sonar-scanner-$SCANNER_VERSION/conf/sonar-scanner.properties
+export SONAR_HOST_URL="http://sonarqube:9000"
+# Generate Analysis token
+echo "Generating analysis token..."
+export SONAR_TOKEN=$(curl -su "admin:admin" -XPOST "$SONAR_HOST_URL/api/user_tokens/generate?name=analysis_token&type=GLOBAL_ANALYSIS_TOKEN" | jq -r '.token')
+echo $SONAR_TOKEN
# Audit code
echo "Launching scanner..."
cd /usr/src/myapp/it
@@ -43,20 +29,14 @@ sleep 10
# Check audit result
echo "Checking result..."
-if grep -q Debian /etc/issue
-then
- apt-get -qq install -y python3-pip > /dev/null
-else
- apk add -q curl gcc musl-dev libffi-dev openssl-dev py3 py3-dev
-fi
-pip3 install -q requests
python3 << EOF
from __future__ import print_function
import requests
import sys
-r = requests.get('http://sonarqube:9000/api/measures/component?component=my:project&metricKeys=ncloc,comment_lines,lines,files,directories,violations', auth=('admin', 'admin'))
+r = requests.get('http://sonarqube:9000/api/measures/component?component=my:project&metricKeys=ncloc,comment_lines,lines,files,violations', auth=('admin', 'admin'))
if r.status_code != 200:
+ print('Invalid server response: ' + str(r.status_code), file=sys.stderr)
sys.exit(1)
data = r.json()
@@ -70,20 +50,15 @@ for measure in data['component']['measures']:
if measure['metric'] == 'lines' and measure['value'] == '8':
print('lines metrics OK')
lines = True
-# if measure['metric'] == 'ncloc' and measure['value'] == '87':
-# print('ncloc metrics OK')
-# ncloc = True
- ncloc = True
+ if measure['metric'] == 'ncloc' and measure['value'] == '3':
+ print('ncloc metrics OK')
+ ncloc = True
if measure['metric'] == 'files' and measure['value'] == '1':
print('files metrics OK')
files = True
- if measure['metric'] == 'directories' and measure['value'] == '1':
- print('directories metrics OK')
- directories = True
-# if measure['metric'] == 'comment_lines' and measure['value'] == '1':
-# print('comment_lines metrics OK')
-# comment_lines = True
- comment_lines = True
+ if measure['metric'] == 'comment_lines' and measure['value'] == '1':
+ print('comment_lines metrics OK')
+ comment_lines = True
if measure['metric'] == 'violations' and measure['value'] == '3':
print('violations metrics OK')
violations = True
diff --git a/it/docker-compose.yml b/it/docker-compose.yml
index fa0b117..c7d3785 100644
--- a/it/docker-compose.yml
+++ b/it/docker-compose.yml
@@ -1,8 +1,7 @@
---
-version: '2.2'
services:
sonarqube:
- image: sonarqube:${SONARQUBE_VERSION:-6.6}
+ image: sonarqube:${SONARQUBE_VERSION:-community}
ports:
- "9000:9000"
environment:
@@ -10,14 +9,14 @@ services:
security_opt:
- seccomp:unconfined
auditor:
- image: auditor:${SCANNER_VERSION}-jdk${JAVA_VERSION:-8}
+ image: auditor:${SCANNER_VERSION:-latest}
build:
context: ..
dockerfile: it/Dockerfile-auditor
args:
- JDK_VERSION: ${JAVA_VERSION:-8}
+ SCANNER_VERSION: ${SCANNER_VERSION:-latest}
links:
- sonarqube
- command: /bin/bash -e /usr/src/myapp/it/audit.sh
+ command: /bin/sh -e /usr/src/myapp/it/audit.sh
environment:
- SCANNER_VERSION:
+ SCANNER_VERSION: ${SCANNER_VERSION:-latest}
diff --git a/it/it.sh b/it/it.sh
old mode 100644
new mode 100755
index 38a14b8..eb2ae9a
--- a/it/it.sh
+++ b/it/it.sh
@@ -1,13 +1,39 @@
#!/bin/bash
-export SONARQUBE_VERSION="$1"
-export SCANNER_VERSION="$2"
-export JAVA_VERSION="$3"
-if [ -z "$SCANNER_VERSION" ]
-then
- echo "Missing parameters: " >&2
- exit 1
-fi
+usage(){
+ echo -e "\nUsage: $0 [sSh] \n"
+ echo "-h : Display help"
+ echo "-s [SONAR-SCANNER] : Take Sonar-scanner tag image from https://hub.docker.com/r/sonarsource/sonar-scanner-cli"
+ echo "-S [SONARQUBE] : Take SonarQube tag image from https://hub.docker.com/_/sonarqube"
+}
+
+OPTSTRING=":s:S:h"
+
+while getopts ${OPTSTRING} opt; do
+ case ${opt} in
+ s)
+ export SCANNER_VERSION=$OPTARG
+ ;;
+ S)
+ export SONARQUBE_VERSION=$OPTARG
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ :)
+ echo "Option -${OPTARG} requires an argument."
+ usage
+ exit 1
+ ;;
+ ?)
+ echo "Invalid option: -${OPTARG}."
+ usage
+ exit 1
+ ;;
+ esac
+done
+
export SCRIPT_DIR=`dirname $0`
@@ -18,9 +44,9 @@ docker-compose -f $SCRIPT_DIR/docker-compose.yml down
# Start containers
echo "Starting SonarQube..."
docker-compose -f $SCRIPT_DIR/docker-compose.yml up -d sonarqube
-CONTAINER_NAME=$(docker ps --format "{{.Names}}" | grep 'it_sonarqube_1.*' | head -1)
+CONTAINER_NAME=$(docker ps --format "{{.Names}}" | grep 'it-sonarqube-1.*' | head -1)
# Wait for SonarQube to be up
-grep -q "SonarQube is up" <(docker logs --follow --tail 0 $CONTAINER_NAME)
+grep -q "SonarQube is operational" <(docker logs --follow --tail 0 $CONTAINER_NAME)
echo "SonarQube started!"
# Copy the plugin
@@ -30,7 +56,7 @@ docker cp $SCRIPT_DIR/../target/sonar-shellcheck-plugin-$MAVEN_VERSION.jar $CONT
# Restart SonarQube
docker-compose -f $SCRIPT_DIR/docker-compose.yml restart sonarqube
# Wait for SonarQube to be up
-grep -q "SonarQube is up" <(docker logs --follow --tail 0 $CONTAINER_NAME)
+grep -q "SonarQube is operational" <(docker logs --follow --tail 0 $CONTAINER_NAME)
# Check plug-in installation
docker exec -u root $CONTAINER_NAME bash -c "if grep -q Alpine /etc/issue; then apk update && apk add -q curl; fi"
if ! docker exec $CONTAINER_NAME curl -su admin:admin http://localhost:9000/api/plugins/installed | python -c '
diff --git a/it/sonar-project.properties b/it/sonar-project.properties
index d6204ea..3bdeb2a 100644
--- a/it/sonar-project.properties
+++ b/it/sonar-project.properties
@@ -3,5 +3,3 @@ sonar.projectName=ShellCheck
sonar.projectVersion=1.0
sonar.sources=src
sonar.scm.disabled=True
-sonar.login=admin
-sonar.password=admin
From 958677261b2c0e7b8707f1409da5839e4fb497f8 Mon Sep 17 00:00:00 2001
From: didierC
Date: Mon, 24 Feb 2025 19:29:28 +0100
Subject: [PATCH 8/8] Upgrade shellcheck rules and scripts to update shellcheck
rules
---
.../shellcheck/rules/shellcheck/SC1000.html | 12 +-
.../shellcheck/rules/shellcheck/SC1001.html | 14 +-
.../shellcheck/rules/shellcheck/SC1003.html | 13 +-
.../shellcheck/rules/shellcheck/SC1004.html | 14 +-
.../shellcheck/rules/shellcheck/SC1007.html | 19 ++-
.../shellcheck/rules/shellcheck/SC1007.json | 2 +-
.../shellcheck/rules/shellcheck/SC1008.html | 10 +-
.../shellcheck/rules/shellcheck/SC1009.html | 2 +-
.../shellcheck/rules/shellcheck/SC1010.html | 16 +-
.../shellcheck/rules/shellcheck/SC1010.json | 2 +-
.../shellcheck/rules/shellcheck/SC1011.html | 17 +-
.../shellcheck/rules/shellcheck/SC1012.html | 57 +++++--
.../shellcheck/rules/shellcheck/SC1012.json | 2 +-
.../shellcheck/rules/shellcheck/SC1014.html | 52 +++++--
.../shellcheck/rules/shellcheck/SC1014.json | 2 +-
.../shellcheck/rules/shellcheck/SC1015.html | 16 ++
.../shellcheck/rules/shellcheck/SC1015.json | 14 ++
.../shellcheck/rules/shellcheck/SC1016.html | 15 ++
.../shellcheck/rules/shellcheck/SC1016.json | 14 ++
.../shellcheck/rules/shellcheck/SC1017.html | 16 +-
.../shellcheck/rules/shellcheck/SC1018.html | 9 +-
.../shellcheck/rules/shellcheck/SC1018.json | 2 +-
.../shellcheck/rules/shellcheck/SC1019.html | 4 +-
.../shellcheck/rules/shellcheck/SC1020.html | 13 +-
.../shellcheck/rules/shellcheck/SC1020.json | 2 +-
.../shellcheck/rules/shellcheck/SC1026.html | 6 +-
.../shellcheck/rules/shellcheck/SC1027.html | 16 +-
.../shellcheck/rules/shellcheck/SC1028.html | 8 +-
.../shellcheck/rules/shellcheck/SC1029.html | 4 +-
.../shellcheck/rules/shellcheck/SC1033.html | 10 +-
.../shellcheck/rules/shellcheck/SC1035.html | 4 +-
.../shellcheck/rules/shellcheck/SC1036.html | 10 +-
.../shellcheck/rules/shellcheck/SC1037.html | 14 +-
.../shellcheck/rules/shellcheck/SC1038.html | 6 +-
.../shellcheck/rules/shellcheck/SC1038.json | 2 +-
.../shellcheck/rules/shellcheck/SC1039.html | 12 +-
.../shellcheck/rules/shellcheck/SC1040.html | 8 +-
.../shellcheck/rules/shellcheck/SC1041.html | 15 +-
.../shellcheck/rules/shellcheck/SC1041.json | 2 +-
.../shellcheck/rules/shellcheck/SC1043.html | 20 ++-
.../shellcheck/rules/shellcheck/SC1043.json | 2 +-
.../shellcheck/rules/shellcheck/SC1044.html | 10 +-
.../shellcheck/rules/shellcheck/SC1044.json | 2 +-
.../shellcheck/rules/shellcheck/SC1045.html | 6 +-
.../shellcheck/rules/shellcheck/SC1045.json | 2 +-
.../shellcheck/rules/shellcheck/SC1046.html | 6 +-
.../shellcheck/rules/shellcheck/SC1046.json | 2 +-
.../shellcheck/rules/shellcheck/SC1047.html | 2 +-
.../shellcheck/rules/shellcheck/SC1047.json | 2 +-
.../shellcheck/rules/shellcheck/SC1048.html | 6 +-
.../shellcheck/rules/shellcheck/SC1048.json | 2 +-
.../shellcheck/rules/shellcheck/SC1049.html | 6 +-
.../shellcheck/rules/shellcheck/SC1049.json | 2 +-
.../shellcheck/rules/shellcheck/SC1050.html | 6 +-
.../shellcheck/rules/shellcheck/SC1050.json | 2 +-
.../shellcheck/rules/shellcheck/SC1051.html | 6 +-
.../shellcheck/rules/shellcheck/SC1051.json | 2 +-
.../shellcheck/rules/shellcheck/SC1052.html | 6 +-
.../shellcheck/rules/shellcheck/SC1052.json | 2 +-
.../shellcheck/rules/shellcheck/SC1053.html | 6 +-
.../shellcheck/rules/shellcheck/SC1053.json | 2 +-
.../shellcheck/rules/shellcheck/SC1054.html | 8 +-
.../shellcheck/rules/shellcheck/SC1054.json | 2 +-
.../shellcheck/rules/shellcheck/SC1055.html | 22 ++-
.../shellcheck/rules/shellcheck/SC1055.json | 2 +-
.../shellcheck/rules/shellcheck/SC1056.html | 8 +-
.../shellcheck/rules/shellcheck/SC1056.json | 2 +-
.../shellcheck/rules/shellcheck/SC1057.html | 21 ++-
.../shellcheck/rules/shellcheck/SC1057.json | 2 +-
.../shellcheck/rules/shellcheck/SC1058.html | 4 +-
.../shellcheck/rules/shellcheck/SC1059.html | 26 +++-
.../shellcheck/rules/shellcheck/SC1059.json | 2 +-
.../shellcheck/rules/shellcheck/SC1060.html | 20 ++-
.../shellcheck/rules/shellcheck/SC1060.json | 2 +-
.../shellcheck/rules/shellcheck/SC1061.html | 6 +-
.../shellcheck/rules/shellcheck/SC1061.json | 2 +-
.../shellcheck/rules/shellcheck/SC1062.html | 2 +-
.../shellcheck/rules/shellcheck/SC1062.json | 2 +-
.../shellcheck/rules/shellcheck/SC1063.html | 32 +++-
.../shellcheck/rules/shellcheck/SC1063.json | 2 +-
.../shellcheck/rules/shellcheck/SC1064.html | 8 +-
.../shellcheck/rules/shellcheck/SC1065.html | 6 +-
.../shellcheck/rules/shellcheck/SC1065.json | 2 +-
.../shellcheck/rules/shellcheck/SC1066.html | 12 +-
.../shellcheck/rules/shellcheck/SC1067.html | 16 +-
.../shellcheck/rules/shellcheck/SC1067.json | 2 +-
.../shellcheck/rules/shellcheck/SC1068.html | 8 +-
.../shellcheck/rules/shellcheck/SC1069.html | 6 +-
.../shellcheck/rules/shellcheck/SC1070.html | 2 +-
.../shellcheck/rules/shellcheck/SC1071.html | 2 +-
.../shellcheck/rules/shellcheck/SC1072.html | 10 ++
.../shellcheck/rules/shellcheck/SC1074.html | 6 +-
.../shellcheck/rules/shellcheck/SC1075.html | 9 +-
.../shellcheck/rules/shellcheck/SC1075.json | 2 +-
.../shellcheck/rules/shellcheck/SC1076.html | 17 +-
.../shellcheck/rules/shellcheck/SC1076.json | 2 +-
.../shellcheck/rules/shellcheck/SC1077.html | 10 +-
.../shellcheck/rules/shellcheck/SC1078.html | 14 +-
.../shellcheck/rules/shellcheck/SC1078.json | 2 +-
.../shellcheck/rules/shellcheck/SC1080.html | 18 ++-
.../shellcheck/rules/shellcheck/SC1081.html | 6 +-
.../shellcheck/rules/shellcheck/SC1081.json | 2 +-
.../shellcheck/rules/shellcheck/SC1082.html | 4 +-
.../shellcheck/rules/shellcheck/SC1082.json | 2 +-
.../shellcheck/rules/shellcheck/SC1083.html | 8 +-
.../shellcheck/rules/shellcheck/SC1084.html | 6 +-
.../shellcheck/rules/shellcheck/SC1086.html | 6 +-
.../shellcheck/rules/shellcheck/SC1087.html | 6 +-
.../shellcheck/rules/shellcheck/SC1087.json | 2 +-
.../shellcheck/rules/shellcheck/SC1088.html | 17 +-
.../shellcheck/rules/shellcheck/SC1089.html | 6 +-
.../shellcheck/rules/shellcheck/SC1090.html | 8 +-
.../shellcheck/rules/shellcheck/SC1090.json | 2 +-
.../shellcheck/rules/shellcheck/SC1091.html | 16 +-
.../shellcheck/rules/shellcheck/SC1092.html | 14 +-
.../shellcheck/rules/shellcheck/SC1092.json | 2 +-
.../shellcheck/rules/shellcheck/SC1094.html | 4 +-
.../shellcheck/rules/shellcheck/SC1095.html | 6 +-
.../shellcheck/rules/shellcheck/SC1097.html | 10 +-
.../shellcheck/rules/shellcheck/SC1098.html | 6 +-
.../shellcheck/rules/shellcheck/SC1098.json | 2 +-
.../shellcheck/rules/shellcheck/SC1099.html | 6 +-
.../shellcheck/rules/shellcheck/SC1100.html | 6 +-
.../shellcheck/rules/shellcheck/SC1100.json | 2 +-
.../shellcheck/rules/shellcheck/SC1101.html | 6 +-
.../shellcheck/rules/shellcheck/SC1102.html | 6 +-
.../shellcheck/rules/shellcheck/SC1102.json | 2 +-
.../shellcheck/rules/shellcheck/SC1103.html | 31 +++-
.../shellcheck/rules/shellcheck/SC1104.html | 8 +-
.../shellcheck/rules/shellcheck/SC1105.html | 2 +-
.../shellcheck/rules/shellcheck/SC1106.html | 6 +-
.../shellcheck/rules/shellcheck/SC1107.html | 4 +-
.../shellcheck/rules/shellcheck/SC1108.html | 8 +-
.../shellcheck/rules/shellcheck/SC1109.html | 4 +-
.../shellcheck/rules/shellcheck/SC1110.html | 8 +-
.../shellcheck/rules/shellcheck/SC1110.json | 2 +-
.../shellcheck/rules/shellcheck/SC1111.html | 10 +-
.../shellcheck/rules/shellcheck/SC1111.json | 2 +-
.../shellcheck/rules/shellcheck/SC1112.html | 8 +-
.../shellcheck/rules/shellcheck/SC1112.json | 2 +-
.../shellcheck/rules/shellcheck/SC1113.html | 6 +-
.../shellcheck/rules/shellcheck/SC1114.html | 4 +-
.../shellcheck/rules/shellcheck/SC1115.html | 6 +-
.../shellcheck/rules/shellcheck/SC1116.html | 9 +-
.../shellcheck/rules/shellcheck/SC1117.html | 20 +++
.../shellcheck/rules/shellcheck/SC1117.json | 14 ++
.../shellcheck/rules/shellcheck/SC1118.html | 8 +-
.../shellcheck/rules/shellcheck/SC1119.html | 10 +-
.../shellcheck/rules/shellcheck/SC1119.json | 2 +-
.../shellcheck/rules/shellcheck/SC1120.html | 4 +-
.../shellcheck/rules/shellcheck/SC1121.html | 9 +-
.../shellcheck/rules/shellcheck/SC1122.html | 6 +-
.../shellcheck/rules/shellcheck/SC1123.html | 6 +-
.../shellcheck/rules/shellcheck/SC1124.html | 9 +-
.../shellcheck/rules/shellcheck/SC1124.json | 2 +-
.../shellcheck/rules/shellcheck/SC1125.html | 6 +-
.../shellcheck/rules/shellcheck/SC1126.html | 9 +-
.../shellcheck/rules/shellcheck/SC1127.html | 4 +-
.../shellcheck/rules/shellcheck/SC1128.html | 4 +-
.../shellcheck/rules/shellcheck/SC1129.html | 6 +-
.../shellcheck/rules/shellcheck/SC1130.html | 6 +-
.../shellcheck/rules/shellcheck/SC1131.html | 4 +-
.../shellcheck/rules/shellcheck/SC1132.html | 4 +-
.../shellcheck/rules/shellcheck/SC1133.html | 6 +-
.../shellcheck/rules/shellcheck/SC1134.html | 5 +-
.../shellcheck/rules/shellcheck/SC1134.json | 2 +-
.../shellcheck/rules/shellcheck/SC1135.html | 6 +-
.../shellcheck/rules/shellcheck/SC1135.json | 2 +-
.../shellcheck/rules/shellcheck/SC1136.html | 7 +-
.../shellcheck/rules/shellcheck/SC1137.html | 22 ++-
.../shellcheck/rules/shellcheck/SC1137.json | 2 +-
.../shellcheck/rules/shellcheck/SC1138.html | 16 +-
.../shellcheck/rules/shellcheck/SC1138.json | 2 +-
.../shellcheck/rules/shellcheck/SC1139.html | 10 +-
.../shellcheck/rules/shellcheck/SC1139.json | 2 +-
.../shellcheck/rules/shellcheck/SC1140.html | 6 +-
.../shellcheck/rules/shellcheck/SC1141.html | 6 +-
.../shellcheck/rules/shellcheck/SC1142.html | 10 +-
.../shellcheck/rules/shellcheck/SC1142.json | 2 +-
.../shellcheck/rules/shellcheck/SC1143.html | 6 +-
.../shellcheck/rules/shellcheck/SC1144.html | 17 +-
.../shellcheck/rules/shellcheck/SC1145.html | 17 +-
.../shellcheck/rules/shellcheck/SC1146.html | 1 +
.../shellcheck/rules/shellcheck/SC1146.json | 14 ++
.../shellcheck/rules/shellcheck/SC2000.html | 10 +-
.../shellcheck/rules/shellcheck/SC2001.html | 67 +++++++-
.../shellcheck/rules/shellcheck/SC2001.json | 2 +-
.../shellcheck/rules/shellcheck/SC2002.html | 10 +-
.../shellcheck/rules/shellcheck/SC2002.json | 2 +-
.../shellcheck/rules/shellcheck/SC2003.html | 13 +-
.../shellcheck/rules/shellcheck/SC2003.json | 2 +-
.../shellcheck/rules/shellcheck/SC2004.html | 10 +-
.../shellcheck/rules/shellcheck/SC2005.html | 22 +--
.../shellcheck/rules/shellcheck/SC2006.html | 10 +-
.../shellcheck/rules/shellcheck/SC2007.html | 8 +-
.../shellcheck/rules/shellcheck/SC2007.json | 2 +-
.../shellcheck/rules/shellcheck/SC2008.html | 7 +-
.../shellcheck/rules/shellcheck/SC2009.html | 11 +-
.../shellcheck/rules/shellcheck/SC2009.json | 2 +-
.../shellcheck/rules/shellcheck/SC2010.html | 13 +-
.../shellcheck/rules/shellcheck/SC2011.html | 6 +-
.../shellcheck/rules/shellcheck/SC2012.html | 22 +--
.../shellcheck/rules/shellcheck/SC2013.html | 27 ++--
.../shellcheck/rules/shellcheck/SC2013.json | 2 +-
.../shellcheck/rules/shellcheck/SC2014.html | 6 +-
.../shellcheck/rules/shellcheck/SC2015.html | 8 +-
.../shellcheck/rules/shellcheck/SC2016.html | 19 ++-
.../shellcheck/rules/shellcheck/SC2017.html | 6 +-
.../shellcheck/rules/shellcheck/SC2018.html | 18 +--
.../shellcheck/rules/shellcheck/SC2018.json | 2 +-
.../shellcheck/rules/shellcheck/SC2019.html | 2 +-
.../shellcheck/rules/shellcheck/SC2019.json | 2 +-
.../shellcheck/rules/shellcheck/SC2020.html | 8 +-
.../shellcheck/rules/shellcheck/SC2021.html | 8 +-
.../shellcheck/rules/shellcheck/SC2022.html | 10 +-
.../shellcheck/rules/shellcheck/SC2022.json | 2 +-
.../shellcheck/rules/shellcheck/SC2023.html | 13 +-
.../shellcheck/rules/shellcheck/SC2023.json | 2 +-
.../shellcheck/rules/shellcheck/SC2024.html | 12 +-
.../shellcheck/rules/shellcheck/SC2025.html | 6 +-
.../shellcheck/rules/shellcheck/SC2025.json | 2 +-
.../shellcheck/rules/shellcheck/SC2026.html | 18 +--
.../shellcheck/rules/shellcheck/SC2026.json | 2 +-
.../shellcheck/rules/shellcheck/SC2027.html | 6 +-
.../shellcheck/rules/shellcheck/SC2028.html | 8 +-
.../shellcheck/rules/shellcheck/SC2029.html | 8 +-
.../shellcheck/rules/shellcheck/SC2031.html | 44 ++++--
.../shellcheck/rules/shellcheck/SC2032.html | 4 +-
.../shellcheck/rules/shellcheck/SC2032.json | 2 +-
.../shellcheck/rules/shellcheck/SC2033.html | 9 +-
.../shellcheck/rules/shellcheck/SC2033.json | 2 +-
.../shellcheck/rules/shellcheck/SC2034.html | 25 ++-
.../shellcheck/rules/shellcheck/SC2035.html | 15 +-
.../shellcheck/rules/shellcheck/SC2035.json | 2 +-
.../shellcheck/rules/shellcheck/SC2036.html | 6 +-
.../shellcheck/rules/shellcheck/SC2037.html | 6 +-
.../shellcheck/rules/shellcheck/SC2038.html | 6 +-
.../shellcheck/rules/shellcheck/SC2039.html | 84 +++++-----
.../shellcheck/rules/shellcheck/SC2040.html | 3 +-
.../shellcheck/rules/shellcheck/SC2040.json | 2 +-
.../shellcheck/rules/shellcheck/SC2041.html | 6 +-
.../shellcheck/rules/shellcheck/SC2042.html | 22 ++-
.../shellcheck/rules/shellcheck/SC2043.html | 14 +-
.../shellcheck/rules/shellcheck/SC2043.json | 2 +-
.../shellcheck/rules/shellcheck/SC2044.html | 30 ++--
.../shellcheck/rules/shellcheck/SC2045.html | 14 +-
.../shellcheck/rules/shellcheck/SC2046.html | 18 ++-
.../shellcheck/rules/shellcheck/SC2048.html | 10 +-
.../shellcheck/rules/shellcheck/SC2048.json | 2 +-
.../shellcheck/rules/shellcheck/SC2049.html | 8 +-
.../shellcheck/rules/shellcheck/SC2050.html | 11 +-
.../shellcheck/rules/shellcheck/SC2051.html | 12 +-
.../shellcheck/rules/shellcheck/SC2053.html | 6 +-
.../shellcheck/rules/shellcheck/SC2054.html | 4 +-
.../shellcheck/rules/shellcheck/SC2055.html | 14 +-
.../shellcheck/rules/shellcheck/SC2056.html | 6 +-
.../shellcheck/rules/shellcheck/SC2057.html | 7 +-
.../shellcheck/rules/shellcheck/SC2058.html | 7 +-
.../shellcheck/rules/shellcheck/SC2059.html | 25 +--
.../shellcheck/rules/shellcheck/SC2059.json | 2 +-
.../shellcheck/rules/shellcheck/SC2060.html | 8 +-
.../shellcheck/rules/shellcheck/SC2061.html | 6 +-
.../shellcheck/rules/shellcheck/SC2062.html | 8 +-
.../shellcheck/rules/shellcheck/SC2063.html | 10 +-
.../shellcheck/rules/shellcheck/SC2064.html | 8 +-
.../shellcheck/rules/shellcheck/SC2065.html | 4 +-
.../shellcheck/rules/shellcheck/SC2066.html | 16 +-
.../shellcheck/rules/shellcheck/SC2066.json | 2 +-
.../shellcheck/rules/shellcheck/SC2067.html | 12 +-
.../shellcheck/rules/shellcheck/SC2067.json | 2 +-
.../shellcheck/rules/shellcheck/SC2068.html | 6 +-
.../shellcheck/rules/shellcheck/SC2069.html | 13 +-
.../shellcheck/rules/shellcheck/SC2069.json | 2 +-
.../shellcheck/rules/shellcheck/SC2070.html | 8 +-
.../shellcheck/rules/shellcheck/SC2071.html | 7 +-
.../shellcheck/rules/shellcheck/SC2071.json | 2 +-
.../shellcheck/rules/shellcheck/SC2072.html | 6 +-
.../shellcheck/rules/shellcheck/SC2073.html | 8 +-
.../shellcheck/rules/shellcheck/SC2074.html | 4 +-
.../shellcheck/rules/shellcheck/SC2075.html | 17 +-
.../shellcheck/rules/shellcheck/SC2075.json | 2 +-
.../shellcheck/rules/shellcheck/SC2076.html | 12 +-
.../shellcheck/rules/shellcheck/SC2077.html | 8 +-
.../shellcheck/rules/shellcheck/SC2078.html | 7 +-
.../shellcheck/rules/shellcheck/SC2079.html | 4 +-
.../shellcheck/rules/shellcheck/SC2080.html | 9 +-
.../shellcheck/rules/shellcheck/SC2081.html | 10 +-
.../shellcheck/rules/shellcheck/SC2082.html | 12 +-
.../shellcheck/rules/shellcheck/SC2082.json | 2 +-
.../shellcheck/rules/shellcheck/SC2083.html | 20 ++-
.../shellcheck/rules/shellcheck/SC2083.json | 2 +-
.../shellcheck/rules/shellcheck/SC2084.html | 14 +-
.../shellcheck/rules/shellcheck/SC2084.json | 2 +-
.../shellcheck/rules/shellcheck/SC2086.html | 52 +++----
.../shellcheck/rules/shellcheck/SC2087.html | 16 +-
.../shellcheck/rules/shellcheck/SC2087.json | 2 +-
.../shellcheck/rules/shellcheck/SC2088.html | 8 +-
.../shellcheck/rules/shellcheck/SC2089.html | 35 +++--
.../shellcheck/rules/shellcheck/SC2091.html | 21 ++-
.../shellcheck/rules/shellcheck/SC2093.html | 8 +-
.../shellcheck/rules/shellcheck/SC2093.json | 2 +-
.../shellcheck/rules/shellcheck/SC2094.html | 6 +-
.../shellcheck/rules/shellcheck/SC2094.json | 2 +-
.../shellcheck/rules/shellcheck/SC2095.html | 23 ++-
.../shellcheck/rules/shellcheck/SC2096.html | 4 +-
.../shellcheck/rules/shellcheck/SC2097.html | 14 +-
.../shellcheck/rules/shellcheck/SC2099.html | 13 +-
.../shellcheck/rules/shellcheck/SC2100.html | 7 +-
.../shellcheck/rules/shellcheck/SC2101.html | 8 +-
.../shellcheck/rules/shellcheck/SC2102.html | 10 +-
.../shellcheck/rules/shellcheck/SC2103.html | 8 +-
.../shellcheck/rules/shellcheck/SC2104.html | 10 +-
.../shellcheck/rules/shellcheck/SC2105.html | 8 +-
.../shellcheck/rules/shellcheck/SC2106.html | 13 +-
.../shellcheck/rules/shellcheck/SC2106.json | 2 +-
.../shellcheck/rules/shellcheck/SC2107.html | 11 +-
.../shellcheck/rules/shellcheck/SC2108.html | 6 +-
.../shellcheck/rules/shellcheck/SC2109.html | 6 +-
.../shellcheck/rules/shellcheck/SC2110.html | 6 +-
.../shellcheck/rules/shellcheck/SC2111.html | 35 ++++-
.../shellcheck/rules/shellcheck/SC2111.json | 2 +-
.../shellcheck/rules/shellcheck/SC2112.html | 15 +-
.../shellcheck/rules/shellcheck/SC2112.json | 2 +-
.../shellcheck/rules/shellcheck/SC2113.html | 4 +-
.../shellcheck/rules/shellcheck/SC2114.html | 8 +-
.../shellcheck/rules/shellcheck/SC2115.html | 8 +-
.../shellcheck/rules/shellcheck/SC2115.json | 2 +-
.../shellcheck/rules/shellcheck/SC2116.html | 16 +-
.../shellcheck/rules/shellcheck/SC2116.json | 2 +-
.../shellcheck/rules/shellcheck/SC2117.html | 6 +-
.../shellcheck/rules/shellcheck/SC2118.html | 18 ++-
.../shellcheck/rules/shellcheck/SC2118.json | 2 +-
.../shellcheck/rules/shellcheck/SC2119.html | 2 +-
.../shellcheck/rules/shellcheck/SC2119.json | 2 +-
.../shellcheck/rules/shellcheck/SC2120.html | 14 +-
.../shellcheck/rules/shellcheck/SC2121.html | 8 +-
.../shellcheck/rules/shellcheck/SC2121.json | 2 +-
.../shellcheck/rules/shellcheck/SC2122.html | 9 +-
.../shellcheck/rules/shellcheck/SC2122.json | 2 +-
.../shellcheck/rules/shellcheck/SC2123.html | 8 +-
.../shellcheck/rules/shellcheck/SC2124.html | 22 +--
.../shellcheck/rules/shellcheck/SC2125.html | 12 +-
.../shellcheck/rules/shellcheck/SC2126.html | 10 +-
.../shellcheck/rules/shellcheck/SC2127.html | 35 ++++-
.../shellcheck/rules/shellcheck/SC2127.json | 2 +-
.../shellcheck/rules/shellcheck/SC2128.html | 14 +-
.../shellcheck/rules/shellcheck/SC2128.json | 2 +-
.../shellcheck/rules/shellcheck/SC2129.html | 8 +-
.../shellcheck/rules/shellcheck/SC2130.html | 7 +-
.../shellcheck/rules/shellcheck/SC2139.html | 11 +-
.../shellcheck/rules/shellcheck/SC2140.html | 16 +-
.../shellcheck/rules/shellcheck/SC2140.json | 2 +-
.../shellcheck/rules/shellcheck/SC2141.html | 14 +-
.../shellcheck/rules/shellcheck/SC2142.html | 9 +-
.../shellcheck/rules/shellcheck/SC2143.html | 6 +-
.../shellcheck/rules/shellcheck/SC2144.html | 20 ++-
.../shellcheck/rules/shellcheck/SC2145.html | 49 +++---
.../shellcheck/rules/shellcheck/SC2146.html | 13 +-
.../shellcheck/rules/shellcheck/SC2147.html | 4 +-
.../shellcheck/rules/shellcheck/SC2148.html | 6 +-
.../shellcheck/rules/shellcheck/SC2149.html | 13 +-
.../shellcheck/rules/shellcheck/SC2150.html | 10 +-
.../shellcheck/rules/shellcheck/SC2151.html | 4 +-
.../shellcheck/rules/shellcheck/SC2152.html | 10 +-
.../shellcheck/rules/shellcheck/SC2153.html | 4 +-
.../shellcheck/rules/shellcheck/SC2154.html | 22 +--
.../shellcheck/rules/shellcheck/SC2155.html | 25 ++-
.../shellcheck/rules/shellcheck/SC2156.html | 6 +-
.../shellcheck/rules/shellcheck/SC2157.html | 12 +-
.../shellcheck/rules/shellcheck/SC2158.html | 6 +-
.../shellcheck/rules/shellcheck/SC2159.html | 6 +-
.../shellcheck/rules/shellcheck/SC2159.json | 2 +-
.../shellcheck/rules/shellcheck/SC2160.html | 37 ++---
.../shellcheck/rules/shellcheck/SC2160.json | 2 +-
.../shellcheck/rules/shellcheck/SC2161.html | 8 +-
.../shellcheck/rules/shellcheck/SC2161.json | 2 +-
.../shellcheck/rules/shellcheck/SC2162.html | 20 ++-
.../shellcheck/rules/shellcheck/SC2162.json | 2 +-
.../shellcheck/rules/shellcheck/SC2163.html | 10 +-
.../shellcheck/rules/shellcheck/SC2163.json | 2 +-
.../shellcheck/rules/shellcheck/SC2164.html | 18 +--
.../shellcheck/rules/shellcheck/SC2165.html | 6 +-
.../shellcheck/rules/shellcheck/SC2166.html | 13 +-
.../shellcheck/rules/shellcheck/SC2166.json | 2 +-
.../shellcheck/rules/shellcheck/SC2168.html | 6 +-
.../shellcheck/rules/shellcheck/SC2168.json | 2 +-
.../shellcheck/rules/shellcheck/SC2169.html | 1 +
.../shellcheck/rules/shellcheck/SC2170.html | 8 +-
.../shellcheck/rules/shellcheck/SC2171.html | 10 +-
.../shellcheck/rules/shellcheck/SC2172.html | 6 +-
.../shellcheck/rules/shellcheck/SC2172.json | 2 +-
.../shellcheck/rules/shellcheck/SC2173.html | 2 +-
.../shellcheck/rules/shellcheck/SC2174.html | 8 +-
.../shellcheck/rules/shellcheck/SC2175.html | 4 +-
.../shellcheck/rules/shellcheck/SC2176.html | 8 +-
.../shellcheck/rules/shellcheck/SC2176.json | 2 +-
.../shellcheck/rules/shellcheck/SC2177.html | 6 +-
.../shellcheck/rules/shellcheck/SC2177.json | 2 +-
.../shellcheck/rules/shellcheck/SC2178.html | 11 +-
.../shellcheck/rules/shellcheck/SC2179.html | 6 +-
.../shellcheck/rules/shellcheck/SC2179.json | 2 +-
.../shellcheck/rules/shellcheck/SC2180.html | 8 +-
.../shellcheck/rules/shellcheck/SC2181.html | 23 ++-
.../shellcheck/rules/shellcheck/SC2181.json | 2 +-
.../shellcheck/rules/shellcheck/SC2182.html | 13 +-
.../shellcheck/rules/shellcheck/SC2183.html | 6 +-
.../shellcheck/rules/shellcheck/SC2183.json | 2 +-
.../shellcheck/rules/shellcheck/SC2184.html | 9 +-
.../shellcheck/rules/shellcheck/SC2185.html | 9 +-
.../shellcheck/rules/shellcheck/SC2185.json | 2 +-
.../shellcheck/rules/shellcheck/SC2186.html | 7 +-
.../shellcheck/rules/shellcheck/SC2187.html | 6 +-
.../shellcheck/rules/shellcheck/SC2187.json | 2 +-
.../shellcheck/rules/shellcheck/SC2188.html | 6 +-
.../shellcheck/rules/shellcheck/SC2188.json | 2 +-
.../shellcheck/rules/shellcheck/SC2189.html | 8 +-
.../shellcheck/rules/shellcheck/SC2190.html | 6 +-
.../shellcheck/rules/shellcheck/SC2191.html | 8 +-
.../shellcheck/rules/shellcheck/SC2192.html | 10 +-
.../shellcheck/rules/shellcheck/SC2192.json | 2 +-
.../shellcheck/rules/shellcheck/SC2193.html | 4 +-
.../shellcheck/rules/shellcheck/SC2194.html | 6 +-
.../shellcheck/rules/shellcheck/SC2195.html | 8 +-
.../shellcheck/rules/shellcheck/SC2196.html | 12 +-
.../shellcheck/rules/shellcheck/SC2197.html | 12 +-
.../shellcheck/rules/shellcheck/SC2198.html | 12 +-
.../shellcheck/rules/shellcheck/SC2199.html | 10 +-
.../shellcheck/rules/shellcheck/SC2200.html | 9 +-
.../shellcheck/rules/shellcheck/SC2201.html | 4 +-
.../shellcheck/rules/shellcheck/SC2202.html | 11 +-
.../shellcheck/rules/shellcheck/SC2203.html | 7 +-
.../shellcheck/rules/shellcheck/SC2204.html | 10 +-
.../shellcheck/rules/shellcheck/SC2205.html | 8 +-
.../shellcheck/rules/shellcheck/SC2206.html | 14 +-
.../shellcheck/rules/shellcheck/SC2207.html | 17 +-
.../shellcheck/rules/shellcheck/SC2208.html | 6 +-
.../shellcheck/rules/shellcheck/SC2209.html | 8 +-
.../shellcheck/rules/shellcheck/SC2210.html | 12 +-
.../shellcheck/rules/shellcheck/SC2211.html | 8 +-
.../shellcheck/rules/shellcheck/SC2212.html | 6 +-
.../shellcheck/rules/shellcheck/SC2212.json | 2 +-
.../shellcheck/rules/shellcheck/SC2213.html | 20 +--
.../shellcheck/rules/shellcheck/SC2213.json | 2 +-
.../shellcheck/rules/shellcheck/SC2214.html | 4 +-
.../shellcheck/rules/shellcheck/SC2215.html | 10 +-
.../shellcheck/rules/shellcheck/SC2216.html | 8 +-
.../shellcheck/rules/shellcheck/SC2216.json | 2 +-
.../shellcheck/rules/shellcheck/SC2217.html | 6 +-
.../shellcheck/rules/shellcheck/SC2217.json | 2 +-
.../shellcheck/rules/shellcheck/SC2218.html | 14 +-
.../shellcheck/rules/shellcheck/SC2219.html | 11 +-
.../shellcheck/rules/shellcheck/SC2220.html | 4 +-
.../shellcheck/rules/shellcheck/SC2221.html | 15 +-
.../shellcheck/rules/shellcheck/SC2223.html | 7 +-
.../shellcheck/rules/shellcheck/SC2224.html | 6 +-
.../shellcheck/rules/shellcheck/SC2225.html | 6 +-
.../shellcheck/rules/shellcheck/SC2226.html | 10 +-
.../shellcheck/rules/shellcheck/SC2226.json | 2 +-
.../shellcheck/rules/shellcheck/SC2227.html | 10 +-
.../shellcheck/rules/shellcheck/SC2229.html | 13 +-
.../shellcheck/rules/shellcheck/SC2229.json | 2 +-
.../shellcheck/rules/shellcheck/SC2230.html | 8 +-
.../shellcheck/rules/shellcheck/SC2230.json | 2 +-
.../shellcheck/rules/shellcheck/SC2231.html | 14 +-
.../shellcheck/rules/shellcheck/SC2231.json | 2 +-
.../shellcheck/rules/shellcheck/SC2232.html | 9 +-
.../shellcheck/rules/shellcheck/SC2233.html | 10 +-
.../shellcheck/rules/shellcheck/SC2234.html | 8 +-
.../shellcheck/rules/shellcheck/SC2235.html | 8 +-
.../shellcheck/rules/shellcheck/SC2236.html | 10 +-
.../shellcheck/rules/shellcheck/SC2237.html | 9 +-
.../shellcheck/rules/shellcheck/SC2238.html | 10 +-
.../shellcheck/rules/shellcheck/SC2239.html | 6 +-
.../shellcheck/rules/shellcheck/SC2240.html | 6 +-
.../shellcheck/rules/shellcheck/SC2241.html | 4 +-
.../shellcheck/rules/shellcheck/SC2242.html | 8 +-
.../shellcheck/rules/shellcheck/SC2243.html | 10 +-
.../shellcheck/rules/shellcheck/SC2243.json | 2 +-
.../shellcheck/rules/shellcheck/SC2244.html | 15 +-
.../shellcheck/rules/shellcheck/SC2244.json | 2 +-
.../shellcheck/rules/shellcheck/SC2245.html | 17 +-
.../shellcheck/rules/shellcheck/SC2246.html | 4 +-
.../shellcheck/rules/shellcheck/SC2247.html | 17 +-
.../shellcheck/rules/shellcheck/SC2247.json | 2 +-
.../shellcheck/rules/shellcheck/SC2248.html | 8 +-
.../shellcheck/rules/shellcheck/SC2248.json | 2 +-
.../shellcheck/rules/shellcheck/SC2249.html | 12 +-
.../shellcheck/rules/shellcheck/SC2250.html | 8 +-
.../shellcheck/rules/shellcheck/SC2250.json | 2 +-
.../shellcheck/rules/shellcheck/SC2251.html | 12 +-
.../shellcheck/rules/shellcheck/SC2251.json | 2 +-
.../shellcheck/rules/shellcheck/SC2252.html | 10 +-
.../shellcheck/rules/shellcheck/SC2253.html | 6 +-
.../shellcheck/rules/shellcheck/SC2254.html | 4 +-
.../shellcheck/rules/shellcheck/SC2255.html | 4 +-
.../shellcheck/rules/shellcheck/SC2256.html | 10 +-
.../shellcheck/rules/shellcheck/SC2256.json | 2 +-
.../shellcheck/rules/shellcheck/SC2257.html | 8 +-
.../shellcheck/rules/shellcheck/SC2258.html | 28 +++-
.../shellcheck/rules/shellcheck/SC2259.html | 4 +-
.../shellcheck/rules/shellcheck/SC2260.html | 6 +-
.../shellcheck/rules/shellcheck/SC2260.json | 2 +-
.../shellcheck/rules/shellcheck/SC2261.html | 6 +-
.../shellcheck/rules/shellcheck/SC2262.html | 10 +-
.../shellcheck/rules/shellcheck/SC2264.html | 7 +-
.../shellcheck/rules/shellcheck/SC2264.json | 2 +-
.../shellcheck/rules/shellcheck/SC2265.html | 22 ++-
.../shellcheck/rules/shellcheck/SC2265.json | 4 +-
.../shellcheck/rules/shellcheck/SC2266.html | 22 ++-
.../shellcheck/rules/shellcheck/SC2266.json | 2 +-
.../shellcheck/rules/shellcheck/SC2267.html | 6 +-
.../shellcheck/rules/shellcheck/SC2268.html | 14 +-
.../shellcheck/rules/shellcheck/SC2268.json | 2 +-
.../shellcheck/rules/shellcheck/SC2269.html | 4 +-
.../shellcheck/rules/shellcheck/SC2270.html | 14 +-
.../shellcheck/rules/shellcheck/SC2270.json | 2 +-
.../shellcheck/rules/shellcheck/SC2271.html | 16 +-
.../shellcheck/rules/shellcheck/SC2271.json | 2 +-
.../shellcheck/rules/shellcheck/SC2272.html | 6 +-
.../shellcheck/rules/shellcheck/SC2272.json | 2 +-
.../shellcheck/rules/shellcheck/SC2273.html | 6 +-
.../shellcheck/rules/shellcheck/SC2274.html | 6 +-
.../shellcheck/rules/shellcheck/SC2275.html | 8 +-
.../shellcheck/rules/shellcheck/SC2276.html | 12 +-
.../shellcheck/rules/shellcheck/SC2276.json | 2 +-
.../shellcheck/rules/shellcheck/SC2277.html | 8 +-
.../shellcheck/rules/shellcheck/SC2277.json | 2 +-
.../shellcheck/rules/shellcheck/SC2278.html | 8 +-
.../shellcheck/rules/shellcheck/SC2279.html | 6 +-
.../shellcheck/rules/shellcheck/SC2280.html | 6 +-
.../shellcheck/rules/shellcheck/SC2281.html | 10 +-
.../shellcheck/rules/shellcheck/SC2281.json | 2 +-
.../shellcheck/rules/shellcheck/SC2282.html | 4 +-
.../shellcheck/rules/shellcheck/SC2283.html | 11 +-
.../shellcheck/rules/shellcheck/SC2284.html | 9 +-
.../shellcheck/rules/shellcheck/SC2285.html | 9 +-
.../shellcheck/rules/shellcheck/SC2286.html | 8 +-
.../shellcheck/rules/shellcheck/SC2287.html | 4 +-
.../shellcheck/rules/shellcheck/SC2288.html | 7 +-
.../shellcheck/rules/shellcheck/SC2289.html | 6 +-
.../shellcheck/rules/shellcheck/SC2290.html | 7 +-
.../shellcheck/rules/shellcheck/SC2291.html | 6 +-
.../shellcheck/rules/shellcheck/SC2292.html | 8 +-
.../shellcheck/rules/shellcheck/SC2292.json | 2 +-
.../shellcheck/rules/shellcheck/SC2293.html | 4 +-
.../shellcheck/rules/shellcheck/SC2294.html | 40 ++---
.../shellcheck/rules/shellcheck/SC2295.html | 13 +-
.../shellcheck/rules/shellcheck/SC2295.json | 2 +-
.../shellcheck/rules/shellcheck/SC2296.html | 6 +-
.../shellcheck/rules/shellcheck/SC2297.html | 10 +-
.../shellcheck/rules/shellcheck/SC2297.json | 2 +-
.../shellcheck/rules/shellcheck/SC2298.html | 11 +-
.../shellcheck/rules/shellcheck/SC2299.html | 4 +-
.../shellcheck/rules/shellcheck/SC2300.html | 4 +-
.../shellcheck/rules/shellcheck/SC2301.html | 8 +-
.../shellcheck/rules/shellcheck/SC2302.html | 28 ++--
.../shellcheck/rules/shellcheck/SC2302.json | 2 +-
.../shellcheck/rules/shellcheck/SC2304.html | 4 +-
.../shellcheck/rules/shellcheck/SC2305.html | 4 +-
.../shellcheck/rules/shellcheck/SC2306.html | 21 ++-
.../shellcheck/rules/shellcheck/SC2307.html | 4 +-
.../shellcheck/rules/shellcheck/SC2308.html | 30 ++--
.../shellcheck/rules/shellcheck/SC2309.html | 11 +-
.../shellcheck/rules/shellcheck/SC2310.html | 4 +-
.../shellcheck/rules/shellcheck/SC2311.html | 4 +-
.../shellcheck/rules/shellcheck/SC2312.html | 21 ++-
.../shellcheck/rules/shellcheck/SC2313.html | 4 +-
.../shellcheck/rules/shellcheck/SC2314.html | 9 +-
.../shellcheck/rules/shellcheck/SC2314.json | 4 +-
.../shellcheck/rules/shellcheck/SC2315.html | 9 +-
.../shellcheck/rules/shellcheck/SC2315.json | 2 +-
.../shellcheck/rules/shellcheck/SC2316.html | 26 ++++
.../shellcheck/rules/shellcheck/SC2316.json | 14 ++
.../shellcheck/rules/shellcheck/SC2317.html | 57 +++++++
.../shellcheck/rules/shellcheck/SC2317.json | 14 ++
.../shellcheck/rules/shellcheck/SC2318.html | 20 +++
.../shellcheck/rules/shellcheck/SC2318.json | 14 ++
.../shellcheck/rules/shellcheck/SC2319.html | 34 ++++
.../shellcheck/rules/shellcheck/SC2319.json | 14 ++
.../shellcheck/rules/shellcheck/SC2320.html | 28 ++++
.../shellcheck/rules/shellcheck/SC2320.json | 14 ++
.../shellcheck/rules/shellcheck/SC2321.html | 15 ++
.../shellcheck/rules/shellcheck/SC2321.json | 14 ++
.../shellcheck/rules/shellcheck/SC2322.html | 15 ++
.../shellcheck/rules/shellcheck/SC2322.json | 14 ++
.../shellcheck/rules/shellcheck/SC2323.html | 19 +++
.../shellcheck/rules/shellcheck/SC2323.json | 14 ++
.../shellcheck/rules/shellcheck/SC2324.html | 28 ++++
.../shellcheck/rules/shellcheck/SC2324.json | 14 ++
.../shellcheck/rules/shellcheck/SC2325.html | 21 +++
.../shellcheck/rules/shellcheck/SC2325.json | 14 ++
.../shellcheck/rules/shellcheck/SC2326.html | 21 +++
.../shellcheck/rules/shellcheck/SC2326.json | 14 ++
.../shellcheck/rules/shellcheck/SC2327.html | 2 +
.../shellcheck/rules/shellcheck/SC2327.json | 14 ++
.../shellcheck/rules/shellcheck/SC2328.html | 24 +++
.../shellcheck/rules/shellcheck/SC2328.json | 14 ++
.../shellcheck/rules/shellcheck/SC2329.html | 25 +++
.../shellcheck/rules/shellcheck/SC2329.json | 14 ++
.../shellcheck/rules/shellcheck/SC2330.html | 25 +++
.../shellcheck/rules/shellcheck/SC2330.json | 14 ++
.../shellcheck/rules/shellcheck/SC3001.html | 10 +-
.../shellcheck/rules/shellcheck/SC3002.html | 6 +-
.../shellcheck/rules/shellcheck/SC3003.html | 20 +--
.../shellcheck/rules/shellcheck/SC3004.html | 14 +-
.../shellcheck/rules/shellcheck/SC3004.json | 2 +-
.../shellcheck/rules/shellcheck/SC3005.html | 24 ++-
.../shellcheck/rules/shellcheck/SC3005.json | 2 +-
.../shellcheck/rules/shellcheck/SC3006.html | 6 +-
.../shellcheck/rules/shellcheck/SC3007.html | 16 +-
.../shellcheck/rules/shellcheck/SC3007.json | 2 +-
.../shellcheck/rules/shellcheck/SC3008.html | 28 +++-
.../shellcheck/rules/shellcheck/SC3008.json | 2 +-
.../shellcheck/rules/shellcheck/SC3009.html | 23 ++-
.../shellcheck/rules/shellcheck/SC3009.json | 2 +-
.../shellcheck/rules/shellcheck/SC3010.html | 5 +-
.../shellcheck/rules/shellcheck/SC3011.html | 20 ++-
.../shellcheck/rules/shellcheck/SC3011.json | 2 +-
.../shellcheck/rules/shellcheck/SC3012.html | 11 +-
.../shellcheck/rules/shellcheck/SC3013.html | 14 +-
.../shellcheck/rules/shellcheck/SC3014.html | 12 +-
.../shellcheck/rules/shellcheck/SC3015.html | 29 +++-
.../shellcheck/rules/shellcheck/SC3016.html | 26 +++-
.../shellcheck/rules/shellcheck/SC3016.json | 2 +-
.../shellcheck/rules/shellcheck/SC3017.html | 6 +-
.../shellcheck/rules/shellcheck/SC3018.html | 8 +-
.../shellcheck/rules/shellcheck/SC3019.html | 10 +-
.../shellcheck/rules/shellcheck/SC3020.html | 6 +-
.../shellcheck/rules/shellcheck/SC3021.html | 29 +++-
.../shellcheck/rules/shellcheck/SC3021.json | 2 +-
.../shellcheck/rules/shellcheck/SC3022.html | 4 +-
.../shellcheck/rules/shellcheck/SC3023.html | 6 +-
.../shellcheck/rules/shellcheck/SC3023.json | 2 +-
.../shellcheck/rules/shellcheck/SC3024.html | 8 +-
.../shellcheck/rules/shellcheck/SC3025.html | 8 +-
.../shellcheck/rules/shellcheck/SC3026.html | 17 +-
.../shellcheck/rules/shellcheck/SC3028.html | 12 +-
.../shellcheck/rules/shellcheck/SC3029.html | 20 ++-
.../shellcheck/rules/shellcheck/SC3029.json | 2 +-
.../shellcheck/rules/shellcheck/SC3030.html | 40 ++++-
.../shellcheck/rules/shellcheck/SC3030.json | 2 +-
.../shellcheck/rules/shellcheck/SC3031.html | 6 +-
.../shellcheck/rules/shellcheck/SC3032.html | 21 ++-
.../shellcheck/rules/shellcheck/SC3032.json | 2 +-
.../shellcheck/rules/shellcheck/SC3033.html | 23 ++-
.../shellcheck/rules/shellcheck/SC3033.json | 2 +-
.../shellcheck/rules/shellcheck/SC3034.html | 8 +-
.../shellcheck/rules/shellcheck/SC3036.html | 19 ++-
.../shellcheck/rules/shellcheck/SC3036.json | 2 +-
.../shellcheck/rules/shellcheck/SC3037.html | 8 +-
.../shellcheck/rules/shellcheck/SC3038.html | 6 +-
.../shellcheck/rules/shellcheck/SC3039.html | 8 +-
.../shellcheck/rules/shellcheck/SC3039.json | 2 +-
.../shellcheck/rules/shellcheck/SC3040.html | 35 +++--
.../shellcheck/rules/shellcheck/SC3040.json | 2 +-
.../shellcheck/rules/shellcheck/SC3041.html | 21 ++-
.../shellcheck/rules/shellcheck/SC3041.json | 2 +-
.../shellcheck/rules/shellcheck/SC3042.html | 21 ++-
.../shellcheck/rules/shellcheck/SC3042.json | 2 +-
.../shellcheck/rules/shellcheck/SC3043.html | 6 +-
.../shellcheck/rules/shellcheck/SC3044.html | 10 +-
.../shellcheck/rules/shellcheck/SC3045.html | 6 +-
.../shellcheck/rules/shellcheck/SC3046.html | 8 +-
.../shellcheck/rules/shellcheck/SC3047.html | 10 +-
.../shellcheck/rules/shellcheck/SC3048.html | 10 +-
.../shellcheck/rules/shellcheck/SC3049.html | 7 +-
.../shellcheck/rules/shellcheck/SC3050.html | 6 +-
.../shellcheck/rules/shellcheck/SC3051.html | 20 ++-
.../shellcheck/rules/shellcheck/SC3051.json | 2 +-
.../shellcheck/rules/shellcheck/SC3052.html | 19 ++-
.../shellcheck/rules/shellcheck/SC3052.json | 2 +-
.../shellcheck/rules/shellcheck/SC3053.html | 8 +-
.../shellcheck/rules/shellcheck/SC3054.html | 8 +-
.../shellcheck/rules/shellcheck/SC3056.html | 6 +-
.../shellcheck/rules/shellcheck/SC3057.html | 15 +-
.../shellcheck/rules/shellcheck/SC3059.html | 2 +-
.../shellcheck/rules/shellcheck/SC3060.html | 8 +-
.../shellcheck/rules/shellcheck/SC3061.html | 1 +
.../shellcheck/rules/shellcheck/SC3061.json | 14 ++
src/main/scripts/build_checks.py | 143 +++++++++--------
src/main/scripts/build_checks.sh | 4 +
src/main/scripts/build_checks.yml | 145 ++++++------------
src/main/scripts/get_checks.sh | 2 +-
683 files changed, 4241 insertions(+), 2403 deletions(-)
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1117.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1117.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1146.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1146.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2316.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2316.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2317.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2317.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2318.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2318.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2319.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2319.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2320.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2320.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2321.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2321.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2322.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2322.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2323.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2323.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2324.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2324.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2325.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2325.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2326.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2326.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2327.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2327.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2328.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2328.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2329.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2329.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2330.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC2330.json
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC3061.html
create mode 100644 src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC3061.json
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1000.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1000.html
index 8760d0b..713637d 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1000.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1000.html
@@ -1,15 +1,15 @@
-$ is not used specially and should therefore be escaped.
+$ is not used specially and should therefore be escaped.
+Note: Removed in v0.3.3 - 2014-05-29
Problematic code
-echo "$"
+echo "$"
Correct code
-echo "\$"
+echo "\$"
Rationale
$ is special in double quotes, but there are some cases where it's interpreted literally:
-Following a backslash: echo "\$"
-In a context where the shell can't make sense of it, such as at the end of the string, ("foo$") or before some constructs ("$'foo'").
+Following a backslash: echo "\$"
+In a context where the shell can't make sense of it, such as at the end of the string, ("foo$") or before some constructs ("$'foo'").
To avoid relying on strange and shell-specific behavior, any $ intended to be literal should be escaped with a backslash.
-Removed in v0.3.3 - 2014-05-29
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1001.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1001.html
index a97a3a3..c0f4bd6 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1001.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1001.html
@@ -1,19 +1,25 @@
This \o will be a regular 'o' in this context.
Problematic code
-# Want literal backslash
+# Want literal backslash
echo Yay \o/
# Want other characters
bell=\a
Correct code
-echo 'Yay \o/'
+echo 'Yay \o/'
-bell="$(printf '\a')"
+bell="$(printf '\a')"
Rationale
You have escaped something that has no special meaning when escaped. The backslash will be simply be ignored.
If the backslash was supposed to be literal, single quote or escape it.
If you wanted it to expand to something, rewrite the expression to use printf (or in bash, $'\t'). If the sequence in question is \n, \t or \r, you instead get a [[SC1012]] that describes this.
Exceptions
-None. ShellCheck (as of 2017-07-03, commit 31bb02d6) will not warn when the first letter of a command is unnecessarily escaped, as this is frequently used to suppress aliases interactively.
+None. ShellCheck (as of 2017-07-03 , commit 31bb02d6 ) will not warn when the first letter of a command is unnecessarily escaped, as this is frequently used to suppress aliases interactively.
+Related resources
+
+https://www.gnu.org/software/bash/manual/html_node/Aliases.html
+https://www.gnu.org/software/bash/manual/html_node/Quoting.html
+https://tiswww.case.edu/php/chet/bash/bash.html
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1003.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1003.html
index 54ad62b..172dc29 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1003.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1003.html
@@ -1,15 +1,16 @@
-Want to escape a single quote? echo 'This is how it'\''s done'.
+Want to escape a single quote? echo 'This is how it'\''s done'.
(Note: in v0.4.6, the error message was accidentally missing the backslash)
Problematic code
-echo 'This is not how it\'s done'.
+echo 'This is not how it\'s done'.
Correct code
-echo 'This is how it'\''s done'.
+echo 'This is how it'\''s done'.
Rationale
-In POSIX shell, the shell cares about nothing but another single quote to terminate the quoted segment. Not even backslashes are interpreted.
+In POSIX shell, the shell cares about nothing but another single-quote to terminate the quoted segment. Not even backslashes are interpreted.
POSIX.1 Shell Command Language § 2.2.2 Single Quotes :
-Enclosing characters in single-quotes ( '' ) shall preserve the literal value of each character within the single-quotes. A single-quote cannot occur within single-quotes.
+
+Enclosing characters in single-quotes ( '' ) shall preserve the literal value of each character within the single-quotes. A single-quote cannot occur within single-quotes.
Exceptions
-If you want your single quoted string to end in a backslash, you can rewrite as 'string'\\ or [[ignore]] this warning.
+If you want your single-quoted string to end in a backslash, you can rewrite as 'string'\\ or [[ignore]] this warning.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1004.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1004.html
index 9b65b00..7270b14 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1004.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1004.html
@@ -1,18 +1,18 @@
This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.
-(This warning was retired after 0.7.2 due to low signal-to-noise ratio)
+(This warning was retired after v0.7.2 due to low signal-to-noise ratio)
Problematic code
-var='This is long \
-piece of text'
+var='This is long \
+piece of text'
Correct code
-var='This is a long '\
-'piece of text'
+var='This is a long '\
+'piece of text'
Rationale
-You have a single quoted string containing a backslash followed by a linefeed (newline). Unlike double quotes or unquoted strings, this has no special meaning. The string will contain a literal backslash and a linefeed.
+You have a single-quoted string containing a backslash followed by a linefeed (newline). Unlike double-quotes or unquoted strings, this has no special meaning. The string will contain a literal backslash and a linefeed.
If you wanted to break the line but not add a linefeed to the string, stop the single quote, break the line, and reopen it. This is demonstrated in the correct code.
If you wanted to break the line and also include the linefeed as a literal, you don't need a backslash:
-var='This is a multi-line string
+var='This is a multi-line string
with an embedded linefeed'
Exceptions
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.html
index dd103e9..22e5f5c 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.html
@@ -1,21 +1,24 @@
-Remove space after = if trying to assign a value (or for empty string, use var='' ... ).
+Remove space after = if trying to assign a value (or for empty string, use var="" ... ).
Problematic code
-# I want programs to show text in dutch!
+# I want programs to show text in Dutch!
LANGUAGE= nl
-# I want to run the nl command with English error messages!
+# I want to run the nl command with English error messages!
LANGUAGE= nl
Correct code
-# I want programs to show text in dutch!
+# I want programs to show text in Dutch!
LANGUAGE=nl
-# I want to run the nl command with English error messages!
-LANGUAGE='' nl
+# I want to run the nl command with English error messages!
+LANGUAGE='' nl
Rationale
-It's easy to think that LANGUAGE= nl would assign "nl" to the variable LANGUAGE. It doesn't.
-Instead, it runs nl (the "number lines" command) and sets LANGUAGE to an empty string in its environment.
+It's easy to think that LANGUAGE= nl would assign "nl" to the variable LANGUAGE. It doesn't.
+Instead, it runs nl (the "number lines" command) and sets LANGUAGE to an empty string in its environment.
Since trying to assign values this way is a common mistake, ShellCheck warns about it and asks you to be explicit when assigning empty strings (except for IFS, due to the common IFS= read .. idiom).
Exceptions
If you're familiar with this behavior and feel that the explicit version is unnecessary, you can [[ignore]] it.
+Related Resources
+https://www.gnu.org/software/bash/manual/html_node/Shell-Parameters.html
+https://mywiki.wooledge.org/BashPitfalls#foo_.3D_bar
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.json
index 71cc093..9840713 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1007.json
@@ -1,5 +1,5 @@
{
- "title": "Remove space after = if trying to assign a value (or for empty string, use var='' ... ).",
+ "title": "Remove space after = if trying to assign a value (or for empty string, use var="" ... ).",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1008.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1008.html
index ca01a2c..e117fc5 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1008.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1008.html
@@ -1,10 +1,10 @@
This shebang was unrecognized. ShellCheck only supports sh/bash/dash/ksh. Add a 'shell' directive to specify.
Problematic code
-#!/bin/mywrapper
+#!/bin/mywrapper
echo "Hello World"
Correct code
-#!/bin/mywrapper
+#!/bin/mywrapper
# shellcheck shell=bash
echo "Hello World"
@@ -14,7 +14,11 @@ Rationale
If this is a script in some other language, like #!/bin/sed for a sed script, then sorry -- ShellCheck does not support sed, awk, expect scripts. It only supports Bourne style shell scripts.
Exceptions
None.
-Related resources
+Related Resources
+https://www.gnu.org/software/bash/manual/html_node/Shell-Scripts.html
+https://mywiki.wooledge.org/BashProgramming?highlight=%28shebang%29#Shebang
+https://www.gnu.org/software/gawk/manual/html_node/Executable-Scripts.html
+https://mywiki.wooledge.org/BashPitfalls#On_UTF-8_and_Byte-Order_Marks_.28BOM.29
Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1009.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1009.html
index 5cbe31d..72e8116 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1009.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1009.html
@@ -1,2 +1,2 @@
The mentioned parser error was in ...
-This info warning points to the start of what ShellCheck was parsing when it failed. See [[Parser error]] for example and information.
+This info warning points to the start of what ShellCheck was parsing when it failed. See [[Parser error]] for example and information.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.html
index 0e7a036..39b59cf 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.html
@@ -1,19 +1,21 @@
-Use semicolon or linefeed before 'done' (or quote to make it literal).
+Use semicolon or linefeed before done (or quote to make it literal).
(or do then, fi, esac)
Problematic code
-for f in *; do echo "$f" done
+for f in *; do echo "$f" done
or
-echo $f is done
+echo $f is done
Correct code
-for f in *; do echo "$f"; done
+for f in *; do echo "$f"; done
or
-echo "$f is done"
+echo "$f is done"
Rationale
ShellCheck found a keyword like done, then, fi, esac, etc used as the argument of a command. This means that the shell will interpret it as a literal string rather than a shell keyword. To be interpreted as a keyword, it must be the first word in the line (i.e. after ;, & or a linefeed).
-In the example, echo "$f" done is the same as echo "$f" "done", and the done does not terminate the loop. This is fixed by terminating the echo command with a ; so that the done is the first word in the next line.
+In the example, echo "$f" done is the same as echo "$f" "done", and the done does not terminate the loop. This is fixed by terminating the echo command with a ; so that the done is the first word in the next line.
Exceptions
-If you're intentionally using done as a literal, you can quote it to make this clear to shellcheck (and also human readers), e.g. instead of echo Task is done, use echo "Task is done". This makes no difference to the shell, but it will silence this warning.
+If you're intentionally using done as a literal, you can quote it to make this clear to ShellCheck (and also human readers), e.g. instead of echo Task is done, use echo "Task is done". This makes no difference to the shell, but it will silence this warning.
+From POSIX-2018, section "C.2.10 Shell Grammar," regarding the syntax, if (false) then (echo x) else (echo y) fi:
+https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu_chap02.html#tag_23_02_10
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.json
index e904c09..9f3cc76 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1010.json
@@ -1,5 +1,5 @@
{
- "title": "Use semicolon or linefeed before 'done' (or quote to make it literal).",
+ "title": "Use semicolon or linefeed before done (or quote to make it literal).",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1011.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1011.html
index b39629b..ef9be63 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1011.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1011.html
@@ -1,15 +1,24 @@
This apostrophe terminated the single quoted string!
Problematic code
-echo 'Nothing so needs reforming as other people's habits.'
+echo 'Nothing so needs reforming as other peoples' habits.'
Correct code
-echo 'Nothing so needs reforming as other people'\''s habits.'
+echo 'Nothing so needs reforming as other peoples'\'' habits.'
or
-echo "Nothing so needs reforming as other people's habits."
+echo "Nothing so needs reforming as other peoples' habits."
Rationale
-When writing a string in single quotes, you have to make sure that any apostrophes in the text don't accidentally terminate the single quoted string prematurely.
+When writing a string in single-quotes, you have to make sure that any apostrophes in the text don't accidentally terminate the single-quoted string prematurely.
Escape them properly (see the correct code) or switch quotes to avoid the problem.
+Additional options
+echo '...peoples\ habits.'
+...peoples\ habits.
+
+$ echo $'...peoples\x27 habits.'
+...peoples' habits.
+
Exceptions
None.
+Related Resources
+https://www.gnu.org/software/bash/manual/html_node/Quoting.html
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.html
index 6bb9b5c..a74fcb7 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.html
@@ -1,28 +1,59 @@
-\t is just literal t here. For tab, use "$(printf '\t')" instead.
+\t is just literal t here. For tab, use "$(printf '\t')" instead.
Problematic code
-# Want tab
-var=foo\tbar
+# Want tab
+$ var=foo\tbar
+$ printf '<%s>\n' "$var"
+<footbar>
+
+$ var=foo\\tbar
+$ printf '<%s>\n' "$var"
+<foo\tbar>
+
or
-# Want linefeed
-var=foo\nbar
+# Want newline
+$ var=foo\nbar
+$ printf '<%s>\n' "$var"
+<foonbar>
+
+$ var=foo\\nbar
+$ printf '<%s>\n' "$var"
+<foo\nbar>
Correct code
-var="foo$(printf '\t')bar" # As suggested in warning
-var="$(printf 'foo\tbar')" # Equivalent alternative
+$ var="foo$(printf '\t')bar" # As suggested in warning
+$ printf '<%s>\n' "$var"
+<foo bar>
+
+$ var="$(printf 'foo\tbar')" # Equivalent alternative
+$ printf '<%s>\n' "$var"
+<foo bar>
or
-# Literal, quoted linefeed
-line="foo
-bar"
+$ # Literal, quoted newline
+$ line="foo
+> bar"
+$ printf '<%s>\n' "$line"
+<foo
+bar>
+
+or
+$ # Newline using ANSI-C quoting
+$ line=$'foo\nbar'
+$ printf '<%s>\n' "$line"
+<foo
+bar>
Rationale
-ShellCheck has found a \t, \n or \r in a context where they just become regular letter t, n or r. Most likely, it was intended as a tab, linefeed or carriage return.
-To generate such characters (plus other less common ones including \a, \f and octal escapes) , use printf as in the example. The exception is for linefeeds that would be stripped by command substitution; in these cases, use a literal quoted linefeed instead.
+ShellCheck has found a \t, \n or \r in a context where they just become regular letters t, n or r. Most likely, it was intended as a tab, newline or carriage return.
+To generate such characters (plus other less common ones including \a, \f and octal escapes) , use printf as in the example. The exception is for newliness that would be stripped by command substitution; in these cases, use a literal quoted newline instead.
Other characters like \z generate a [[SC1001]] info message, as the intent is less certain.
Exceptions
None.
-Related resources
+Related Resources
+https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html#index-printf
+https://pubs.opengroup.org/onlinepubs/9799919799/utilities/printf.html
+https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.json
index 2f207db..d3694b5 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1012.json
@@ -1,5 +1,5 @@
{
- "title": "\\t is just literal t here. For tab, use '$(printf '\\t')' instead.",
+ "title": "\\t is just literal t here. For tab, use "$(printf '\\t')" instead.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.html
index 4dac973..0d73aa6 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.html
@@ -1,32 +1,62 @@
-Use 'if cmd; then ..' to check exit code, or 'if [ "$(cmd)" = .. ]' to check output.
+Use if cmd; then .. to check exit code, or if [ "$(cmd)" = .. ] to check output.
Problematic code
-if [ grep -q pattern file ]
+# WRONG
+if [ grep -q pattern file ]
then
echo "Found a match"
fi
+# WRONG
+if ! [[ logname == $LOGNAME ]]
+then
+ echo "Possible `su` shell"
+fi
+
Correct code
-if grep -q pattern file
+if grep -q pattern file
then
echo "Found a match"
fi
+if ! [[ $(logname) == $LOGNAME ]]
+then
+ echo "Possible `su` shell"
+fi
+
Rationale
-[ .. ] is not part of shell syntax like if statements. It is not equivalent to parentheses in C-like languages, if (foo) { bar; }, and should not be wrapped around commands to test.
-[ is just regular command, like whoami or grep, but with a funny name (see ls -l /bin/[). It's a shorthand for test.
-If you want to check the exit status of a certain command, use that command directly as demonstrated in the correct code.
-If you want to check the output of a command, use "$(..)" to get its output, and then use test or [/[[ to do a string comparison:
-# Check output of `whoami` against the string `root`
+[ ... ] as shell syntax is a simple command that tests for whether certain conditions are true or false, such as whether the value assigned to a variable has a non-zero length ([ -n "${foo}" ]) or whether a file system object is a directory ([ -d "${dir}" ]). If-then-(elif-then)-else-fi statements are logical constructs which themselves contain lists of commands which can include simple commands.
+[ is just regular command, like whoami or grep, but with a funny name (see ls -l /bin/[). It's a shorthand for test. [[ is similar to both [ and test, but [[ offers some additional unary operators, such as '=~' the regular expression comparison operator. It allows one to use extglobs such as @(foo|bar) (a "bashism"), among some other less commonly used features.
+[[, [ and test are often used within if...fi constructs in the conditional commands position: which is between the 'if' and the 'then.'
+There are certain shell syntaxes which can be wrapped directly around simple commands, in particular:
+
+(1) { ...;}, group commands,
+(2) $( ... ), command substitutions,
+(3) <( ... ) and >( ... ), process substitutions,
+(4) ( ... ), subshells, and
+(5) $(( ... )) and (( ... )), arithmetic evaluations.
+
+Some examples include:
+
+(1) { echo {a..z}; echo {0..9};} > ~/f,
+(2) [[ $(logname) == $LOGNAME ]],
+(3) readarray -t files < <( find ...),
+(4) (cd /foo || exit 1; tar ...), and
+(5) dd bs=$((2**12)) count=1 if=/dev/zero of=/tmp/zeroed-block, respectively.
+
+Note how in example (2) logname is enclosed directly within a command substitution, which is itself enclosed within a [[ reserved word / conditional expression / compound command.
+If you want to check the exit status of a certain command, use that command directly as demonstrated in the correct code, above.
+If you want to check the output of a command, use "$(..)" to get its output, and then use test/[ or [[ to do a string comparison:
+# Check output of `whoami` against the string `root`
if [ "$(whoami)" = "root" ]
then
echo "Running as root"
fi
-For more information, see this problem in the Bash Pitfall list, or generally Tests and Conditionals in the WoolEdge BashGuide
Exceptions
None.
-Related resources
+Related Resources
+For more information, see this problem in the Bash Pitfall list, or generally Tests and Conditionals in the wooledge.org BashGuide
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.json
index 27e4edb..86fbdec 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1014.json
@@ -1,5 +1,5 @@
{
- "title": "Use 'if cmd; then ..' to check exit code, or 'if [ '$(cmd)' = .. ]' to check output.",
+ "title": "Use if cmd; then .. to check exit code, or if [ "$(cmd)" = .. ] to check output.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.html
new file mode 100644
index 0000000..d902db1
--- /dev/null
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.html
@@ -0,0 +1,16 @@
+This is a Unicode double quote. Delete and retype it.
+Problematic code
+echo “hello world”
+
+Correct code
+echo "hello world"
+
+Rationale
+Blog software and word processors frequently replaces ASCII quotes "" with fancy Unicode quotes, “”. To Bash, Unicode quotes are considered regular literals and not quotes at all.
+Simply delete them and retype them in your editor.
+Status
+This error was retired after 0.4.5. In this version and earlier, ShellCheck parsed slanted quotes as a valid double quote. This meant that the warning could not simply be ignored. It has since been replaced by [[SC1110]] (outside quotes) and [[SC1111]] (inside double-quotes).
+Exceptions
+If you really want literal Unicode double quotes, you can put them in single-quotes (or Unicode single-quotes in double-quotes) to make ShellCheck ignore them, e.g.,
+printf 'Warning: “wakeonlan” is not installed.\n'
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.json
new file mode 100644
index 0000000..65b0fde
--- /dev/null
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1015.json
@@ -0,0 +1,14 @@
+{
+ "title": "This is a Unicode double quote. Delete and retype it.",
+ "type": "CODE_SMELL",
+ "status": "ready",
+ "remediation": {
+ "func": "Constant\/Issue",
+ "constantCost": "2min"
+ },
+ "tags": [
+ "shell",
+ "convention"
+ ],
+ "defaultSeverity": "Major"
+}
\ No newline at end of file
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.html
new file mode 100644
index 0000000..498402f
--- /dev/null
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.html
@@ -0,0 +1,15 @@
+This is a Unicode single quote. Delete and retype it.
+Problematic code
+echo ‘hello world’
+
+Correct code
+echo 'hello world'
+
+Rationale
+Some software, like macOS, Microsoft Word, and WordPress, may automatically replace your regular quotes with slanted Unicode quotes. Try deleting and retyping them, and/or disable “smart quotes” in your editor or OS.
+Status
+This error was retired after 0.4.5. In this version and earlier, ShellCheck parsed slanted quotes as a valid double-quote. This meant that the warning could not simply be ignored. It has since been replaced by [[SC1110]] (outside quotes) and [[SC1112]] (inside single-quotes).
+Exceptions
+If you want to use typographic single-quotes, you can put them in double-quotes (or typographic double-quotes in single-quotes) to make ShellCheck ignore them, e.g.,
+printf "Warning: ‘wakeonlan’ is not installed.\n"
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.json
new file mode 100644
index 0000000..02fe932
--- /dev/null
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1016.json
@@ -0,0 +1,14 @@
+{
+ "title": "This is a Unicode single quote. Delete and retype it.",
+ "type": "CODE_SMELL",
+ "status": "ready",
+ "remediation": {
+ "func": "Constant\/Issue",
+ "constantCost": "2min"
+ },
+ "tags": [
+ "shell",
+ "convention"
+ ],
+ "defaultSeverity": "Major"
+}
\ No newline at end of file
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1017.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1017.html
index 192b97c..3f5d8e4 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1017.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1017.html
@@ -1,25 +1,27 @@
Literal carriage return. Run script through tr -d '\r' .
Problematic code
-$ cat -v myscript
+$ cat -v myscript
#!/bin/sh^M
echo "Hello World"^M
Correct code
-$ cat -v myscript
+$ cat -v myscript
#!/bin/sh
echo "Hello World"
Rationale
-The script uses Windows/DOS style \r\n line terminators instead of UNIX style \n terminators. The additional \r aka ^M aka carriage return characters will be treated literally, and results in all sorts strange bugs and messages.
-You can verify this with cat -v yourfile and see whether or not each line ends with a ^M. To delete them, open the file in your editor and save the file as "Unix", "UNIX/OSX Format", :set ff=unix or similar if it supports it.
+The script uses Windows/MS-DOS style \r\n line terminators instead of Unix-style \n terminators. The additional \r aka ^M aka carriage return characters will be treated literally, and results in all sorts strange bugs and messages.
+You can verify this with cat -v yourfile and see whether or not each line ends with a ^M. To delete them, open the file in your editor and save the file as "Unix", "Unix/macOS Format", :set ff=unix or similar if it supports it.
If you don't know how to get your editor to save a file with Unix line terminators, you can use tr:
-tr -d '\r' < badscript > goodscript
+tr -d '\r' < badscript > goodscript
+# or
+dos2unix badscript
This will read a script badscript with possible carriage returns, and write goodscript without them.
Exceptions
None
Related resources
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.html
index af3c8b6..09931ee 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.html
@@ -1,4 +1,7 @@
-This is a unicode non-breaking space. Delete it and retype as space.
-You copy-pasted some code, probably from a blog or web site, which for formatting reasons contained unicode no-break spaces or unicode zero-width spaces instead of regular spaces or in words.
+This is a Unicode non-breaking space. Delete it and retype as space.
+You copy-pasted some code, probably from a blog or web site, which for formatting reasons contained Unicode no-break spaces or Unicode zero-width spaces instead of regular spaces or in words.
To humans, a zero-width space is invisible and a non-breaking space is indistinguishable from a regular space, but the shell does not agree.
-If you have just a few, delete the indiciated space/word and retype it. If you have tons, do a search&replace in your editor (copy-paste an offending space into the search field, and type a regular space into the replace field), or use sed -e $'s/\xC2\xA0/ /g' -e $'s/\xE2\x80\x8b//g' -i yourfile to remove them.
+If you have just a few, delete the indicated space/word and retype it. If you have tons, do a search-and-replace in your editor (copy-paste an offending space into the search field, and type a regular space into the replace field), or use the following command to remove them:
+sed -e $'s/\xC2\xA0/ /g' -e $'s/\xE2\x80\x8b//g' -i yourfile
+
+On macOS, a non-breaking space can be inserted into most programs by holding ⌥ Option +Space .
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.json
index a7473bb..6c8c4b6 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1018.json
@@ -1,5 +1,5 @@
{
- "title": "This is a unicode non-breaking space. Delete it and retype as space.",
+ "title": "This is a Unicode non-breaking space. Delete it and retype as space.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1019.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1019.html
index 7174ccc..8ecb522 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1019.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1019.html
@@ -1,9 +1,9 @@
Expected this to be an argument to the unary condition.
Problematic code
-[ -x ]
+[ -x ]
Correct code
-[ -x "myfile" ]
+[ -x "myfile" ]
Rationale
ShellCheck has found a unary test operator that does not appear to be followed by a valid shell word.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.html
index b58e50c..11ef07f 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.html
@@ -1,16 +1,15 @@
-You need a space before the "]" or "]]"
+You need a space before the ] or ]]
Problematic code
-if [ "$STUFF" = ""]; then
+if [ "$STUFF" = ""]; then
Correct code
-if [ "$STUFF" = "" ]; then
+if [ "$STUFF" = "" ]; then
Rationale
Bourne shells are very whitespace sensitive. Adding or removing spaces can drastically alter the meaning of a script. In these cases, ShellCheck has noticed that you're missing a space at the position indicated.
Exceptions
-none.
+None.
Ignore
-# shellcheck disable=SC1020
-if [ "$STUFF" = ""]; then
-...
+# shellcheck disable=SC1020
+if [ "$STUFF" = ""]; then
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.json
index 80ecfbe..b459afc 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1020.json
@@ -1,5 +1,5 @@
{
- "title": "You need a space before the ']' or ']]'",
+ "title": "You need a space before the ] or ]]",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1026.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1026.html
index d3b8910..87d0a96 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1026.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1026.html
@@ -1,10 +1,10 @@
-If grouping expressions inside [[..]], use ( .. ).
+If grouping expressions inside [[..]], use ( .. ).
Problematic code
-[[ [ a || b ] && c ]]
+[[ [ a || b ] && c ]]
[ [ a -o b ] -a c ]]
Correct code
-[[ ( a || b ) && c ]]
+[[ ( a || b ) && c ]]
[ \( a -o b \) -a c ]] # or { [ a ] || [ b ]; } && [ c ]
Rationale
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1027.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1027.html
index 5575210..8342937 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1027.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1027.html
@@ -1 +1,15 @@
-Expected another argument for this operator.
\ No newline at end of file
+Expected another argument for this operator.
+Problematic code
+[ $a -ne ]
+
+Correct code
+[ $a -ne $b ]
+
+Rationale
+ShellCheck found a test operator without an operand. This could be a copy-paste fail, bad linebreak, or trying to use <> instead of != or -ne.
+Exceptions
+None.
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1028.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1028.html
index 33f7a27..bcb06d1 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1028.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1028.html
@@ -1,13 +1,13 @@
-In [..] you have to escape \( \) or preferably combine [..] expressions.
+In [..] you have to escape \( \) or preferably combine [..] expressions.
Problematic code
-[ -e ~/.bashrc -a ( -x /bin/dash -o -x /bin/ash ) ]
+[ -e ~/.bashrc -a ( -x /bin/dash -o -x /bin/ash ) ]
Correct code
In POSIX:
-[ -e ~/.bashrc ] && { [ -x /bin/dash ] || [ -x /bin/ash ]; }
+[ -e ~/.bashrc ] && { [ -x /bin/dash ] || [ -x /bin/ash ]; }
Obsolete XSI syntax:
-[ -e ~/.bashrc -a \( -x /bin/dash -o -x /bin/ash \) ]
+[ -e ~/.bashrc -a \( -x /bin/dash -o -x /bin/ash \) ]
Rationale
[ is implemented as a regular command, so ( is not special.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1029.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1029.html
index 3c5adde..85c2a2c 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1029.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1029.html
@@ -1,9 +1,9 @@
In [[..]] you shouldn't escape ( or ).
Problematic code
-[[ -e ~/.bashrc -a \( -x /bin/dash -o -x /bin/ash \) ]]
+[[ -e ~/.bashrc && \( -x /bin/dash || -x /bin/ash \) ]]
Correct code
-[[ -e ~/.bashrc -a ( -x /bin/dash -o -x /bin/ash ) ]]
+[[ -e ~/.bashrc && ( -x /bin/dash || -x /bin/ash ) ]]
Rationale
You don't have to -- and can't -- escape ( or ) inside a [[ .. ]] expression like you do in [ .. ]. Just remove the escaping.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1033.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1033.html
index ea56431..4273d91 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1033.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1033.html
@@ -1,19 +1,19 @@
Test expression was opened with double [[ but closed with single ]. Make sure they match.
-(or SC1034 for vice versa)
+(or [[SC1034]] for vice versa)
Problematic code
-[[ -z "$var" ]
+[[ -z "$var" ]
Correct code
-[[ -z "$var" ]]
+[[ -z "$var" ]]
Rationale
ShellCheck found a test expression [ ... ] (POSIX) or [[ ... ]] (ksh/bash), but where the opening and closing brackets did not match (i.e. [[ .. ] or [ .. ]]). The brackets need to match up to work.
Note in particular that [..] do not work like parentheses in other languages. You can not do:
-# Invalid
+# Invalid
[[ x ] || [ y ]]
You would instead use two separate test expressions joined by ||:
-# Valid basic test expressions (sh/bash/ksh)
+# Valid basic test expressions (sh/bash/ksh)
[ x ] || [ y ]
# Valid extended test expressions (bash/ksh)
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1035.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1035.html
index 59e0ec8..1879a1b 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1035.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1035.html
@@ -1,9 +1,9 @@
You need a space here
Problematic code
-if ![-z foo ]; then true; fi # if command `[-z' w/ args `foo', `]' fails..
+if ![-z foo ]; then true; fi # if command `[-z' w/ args `foo', `]' fails..
Correct code
-if ! [ -z foo ]; then true; fi # if command `[' w/ args `-z', `foo', `]' fails..
+if ! [ -z foo ]; then true; fi # if command `[' w/ args `-z', `foo', `]' fails..
Rationale
Bourne shells are very whitespace sensitive. Adding or removing spaces can drastically alter the meaning of a script. In these cases, ShellCheck has noticed that you're missing a space at the position indicated.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1036.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1036.html
index 8a8951f..d05c57a 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1036.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1036.html
@@ -1,10 +1,10 @@
( is invalid here. Did you forget to escape it?
Problematic code
-echo (foo) bar
+echo (foo) bar
Correct code
Depends on your intention:
-echo "(foo) bar" # Literal parentheses
+echo "(foo) bar" # Literal parentheses
echo "$(foo) bar" # Command expansion
echo "foo bar" # Tried to use parentheses for grouping or function invocation
@@ -13,16 +13,16 @@ Rationale
Determine what you intended the parenthesis to do and rewrite accordingly. Common issues include:
Wanting them to be literal, as in echo (FAIL) Some tests failed. In this case, it requires quoting.
-Wanting command expansion, as in echo Today is (date). Add the missing $: echo "Today is $(date)"
+Wanting command expansion, as in echo Today is (date). Add the missing $: echo "Today is $(date)"
Adding parentheses because other languages need them in that context, such as foo (bar, 42) to call a function. This should be foo bar 42. Also, shells do not support tuples or passing arrays as single parameters.
Exceptions
Bash allows some parentheses as part of assignment-like tokens to certain commands, including export and eval. This is a workaround in Bash to allow commands that normally would not be valid:
-eval foo=(bar) # Valid command
+eval foo=(bar) # Valid command
echo foo=(bar) # Invalid syntax
f=foo; eval $f=(bar) # Also invalid
-In these cases, please quote the command, such as `eval "foo=(bar)". This does not change the behavior, but stops relying on bash specific parsing quirks.
+In these cases, please quote the command, such as eval "foo=(bar)". This does not change the behavior, but stops relying on Bash-specific parsing quirks.
Related resources
Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1037.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1037.html
index 0a2b44a..67a42ba 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1037.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1037.html
@@ -1,24 +1,24 @@
-Braces are required for positionals over 9, e.g. ${10}.
+Braces are required for positionals over 9, e.g. ${10}.
Problematic code
- echo "Ninth parameter: $9"
+echo "Ninth parameter: $9"
echo "Tenth parameter: $10"
Correct code
-echo "Ninth parameter: $9"
+echo "Ninth parameter: $9"
echo "Tenth parameter: ${10}"
Rationale
For legacy reasons, $10 is interpreted as the variable $1 followed by the literal string 0.
Curly braces are needed to tell the shell that both digits are part of the parameter expansion.
Exceptions
-If you wanted the trailing digits to be literal, ${1}0 will make this clear to both humans and shellcheck.
+If you wanted the trailing digits to be literal, ${1}0 will make this clear to both humans and ShellCheck.
In dash, $10 is (wrongly ) interpreted as ${10}, so some 'reversed' care should also be taken:
-bash -c 'set a b c d e f g h i j; echo $10 ${1}0' # POSIX: a0 a0
-dash -c 'set a b c d e f g h i j; echo $10 ${1}0' # WRONG: j a0
+bash -c 'set a b c d e f g h i j; echo $10 ${1}0' # POSIX: a0 a0
+dash -c 'set a b c d e f g h i j; echo $10 ${1}0' # WRONG: j a0
Related resources
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.html
index 8a06afd..fd4875e 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.html
@@ -1,12 +1,12 @@
-Shells are space sensitive. Use '< <(cmd)', not '<<(cmd)'.
+Shells are space sensitive. Use < <(cmd), not <<(cmd).
Problematic code
-while IFS= read -r line
+while IFS= read -r line
do
printf "%q\n" "$line"
done <<(curl -s http://example.com)
Correct code
-while IFS= read -r line
+while IFS= read -r line
do
printf "%q\n" "$line"
done < <(curl -s http://example.com)
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.json
index 9d3ebd7..ca97354 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1038.json
@@ -1,5 +1,5 @@
{
- "title": "Shells are space sensitive. Use '< <(cmd)', not '<<(cmd)'.",
+ "title": "Shells are space sensitive. Use < <(cmd), not <<(cmd).",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1039.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1039.html
index 54f5325..23d41a1 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1039.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1039.html
@@ -1,18 +1,18 @@
Remove indentation before end token (or use <<- and indent with tabs).
Problematic code
-for f in *.png
+for f in *.png
do
- cat << EOF
+ cat << HTML
<img src="$f" /><br/>
- EOF
+ HTML
done > index.html
Correct code
-for f in *.png
+for f in *.png
do
- cat << EOF
+ cat << HTML
<img src="$f" /><br/>
-EOF
+HTML
done > index.html
Rationale
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1040.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1040.html
index d224966..feae993 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1040.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1040.html
@@ -1,18 +1,18 @@
-When using <<-, you can only indent with tabs.
+When using <<-, you can only indent with tabs.
Problematic code
Any code using <<- that is indented with spaces. cat -T script shows
- cat <<- foo
+ cat <<- foo
Hello world
foo
Correct code
Code using <<- must be indented with tabs. cat -T script shows
-^Icat <<- foo
+^Icat <<- foo
^I^IHello world
^Ifoo
Or simply don't indent the end token:
- cat <<- foo
+ cat <<- foo
Hello World
foo
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.html
index 0f9fc7b..a744fc8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.html
@@ -1,13 +1,12 @@
-Found 'eof' further down, but not on a separate line.
-Close matches include '-eof' (!= 'eof').
-
+Found eof further down, but not on a separate line.
+Close matches include '-eof' (!= 'eof').
Problematic code
-cat <<-eof
+cat <<-eof
Hello World
-eof
Correct code
-cat <<- eof
+cat <<- eof
Hello World
eof
@@ -15,7 +14,7 @@ Rationale
Your here document isn't properly terminated.
There is a line containing the terminator you've chosen, but it's not by itself on a separate line.
In the example code, the script uses <<-eof, which is the operator <<- followed by eof. The script therefore looks for eof and skips right past the intended terminator because it starts with a dash.
-You will get some companion SC1042 errors mentioning lines that contain the string as a substring, though they all point to the start of the here document and not the relevant line:
+You will get some companion [[SC1042]] errors mentioning lines that contain the string as a substring, though they all point to the start of the here document and not the relevant line:
In foo line 4:
Hello
^-- SC1041: Found 'eof' further down, but not on a separate line.
@@ -26,5 +25,5 @@ Rationale
Try to change the line ending into LF.
Exceptions
None.
-
-Note that SC1041 and SC1042 swapped numbers after v0.4.6 to improve the display order. This rare instance of number reuse was justified by them always occuring together on the same line.
+
+Note that SC1041 and [[SC1042]] swapped numbers after v0.4.6 to improve the display order. This rare instance of number reuse was justified by them always occurring together on the same line.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.json
index 10c5b55..6417468 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1041.json
@@ -1,5 +1,5 @@
{
- "title": "Found 'eof' further down, but not on a separate line.",
+ "title": "Found eof further down, but not on a separate line.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.html
index 8e4d984..e7c2418 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.html
@@ -1 +1,19 @@
-Found end token `EOF' further down, but with wrong casing.
\ No newline at end of file
+Found EOF further down, but with wrong casing.
+Problematic code
+cat << EOF
+Hello World
+Eof
+
+Correct code
+cat << EOF
+Hello World
+EOF
+
+Rationale
+ShellCheck found a here document (<<) where the end token is missing. However, the end token appears with different case further down. If this was meant to be the end of the here document, make sure the case matches.
+Exceptions
+None. This error is only emitted when the here document is incomplete.
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.json
index b10e148..a5f5c5b 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1043.json
@@ -1,5 +1,5 @@
{
- "title": "Found end token `EOF' further down, but with wrong casing.",
+ "title": "Found EOF further down, but with wrong casing.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.html
index 7dea1fb..d10936f 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.html
@@ -1,18 +1,18 @@
-Couldn't find end token `EOF' in the here document.
+Couldn't find end token EOF in the here document.
Problematic code
-cat << EOF
+cat << EOF
Hello World
Correct code
-cat << EOF
+cat << EOF
Hello World
EOF
Rationale
The << here document (aka heredoc) was not properly terminated. The terminating token needs to be on a separate line without indenting (or indented with tabs only when using <<-).
Note that you can not put here documents in one liners. For such use cases, use a <<< here string:
-cat << EOF hello world EOF # Wrong: data and terminator can not be on the same line
-cat <<< "hello world" # Correct
+cat << EOF hello world EOF # Wrong: data and terminator can not be on the same line
+cat <<< "hello world" # Correct
Exceptions
None
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.json
index 6f613c6..58c90a2 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1044.json
@@ -1,5 +1,5 @@
{
- "title": "Couldn't find end token `EOF' in the here document.",
+ "title": "Couldn't find end token EOF in the here document.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.html
index d7ef277..fa2c087 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.html
@@ -1,9 +1,9 @@
-It's not 'foo &; bar', just 'foo & bar'.
+It's not foo &; bar, just foo & bar.
Problematic code
-foo &; bar
+foo &; bar
Correct code
-foo & bar
+foo & bar
Rationale
Both & and ; terminate the command. You should only use one of them.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.json
index 2a13c4d..6f707e1 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1045.json
@@ -1,5 +1,5 @@
{
- "title": "It's not 'foo &; bar', just 'foo & bar'.",
+ "title": "It's not foo &; bar, just foo & bar.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.html
index da9a7ad..d1f2c1d 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.html
@@ -1,12 +1,12 @@
-Couldn't find 'fi' for this 'if'.
+Couldn't find fi for this if.
Problematic code
-if true
+if true
then
echo "True"
done
Correct code
-if true
+if true
then
echo "True"
fi
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.json
index 450af8a..78392c8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1046.json
@@ -1,5 +1,5 @@
{
- "title": "Couldn't find 'fi' for this 'if'.",
+ "title": "Couldn't find fi for this if.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.html
index 5cc7a6b..5048bec 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.html
@@ -1,2 +1,2 @@
-"Expected 'fi' matching previously mentioned 'if'.
+Expected fi matching previously mentioned if.
See companion warning [[SC1046]].
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.json
index 938f394..65447cd 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1047.json
@@ -1,5 +1,5 @@
{
- "title": "'Expected 'fi' matching previously mentioned 'if'.",
+ "title": "Expected fi matching previously mentioned if.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.html
index eb6aec5..f49aad3 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.html
@@ -1,12 +1,12 @@
-Can't have empty then clauses (use 'true' as a no-op).
+Can't have empty then clauses (use true as a no-op).
Problematic code
-if [ -e foo ]
+if [ -e foo ]
then
# TODO: handle this
fi
Correct code
-if [ -e foo ]
+if [ -e foo ]
then
# TODO: handle this
true
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.json
index fdd38b1..fcbd973 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1048.json
@@ -1,5 +1,5 @@
{
- "title": "Can't have empty then clauses (use 'true' as a no-op).",
+ "title": "Can't have empty then clauses (use true as a no-op).",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.html
index 472ed5d..131b22c 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.html
@@ -1,13 +1,13 @@
-Did you forget the 'then' for this 'if'?
+Did you forget the then for this if?
Problematic code
-if true
+if true
echo "foo"
elif true
echo "bar"
fi
Correct code
-if true
+if true
then
echo "foo"
elif true
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.json
index a6c652f..13bafd5 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1049.json
@@ -1,5 +1,5 @@
{
- "title": "Did you forget the 'then' for this 'if'?",
+ "title": "Did you forget the then for this if?",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.html
index 907620b..2ca2f90 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.html
@@ -1,11 +1,11 @@
-Expected 'then'.
+Expected then.
Problematic code
-if true
+if true
echo "True"
fi
Correct code
-if true
+if true
then
echo "True"
fi
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.json
index 2ec95ff..74646b3 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1050.json
@@ -1,5 +1,5 @@
{
- "title": "Expected 'then'.",
+ "title": "Expected then.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.html
index a51e204..36fbd53 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.html
@@ -1,9 +1,9 @@
-Semicolons directly after 'then' are not allowed. Just remove it.
+Semicolons directly after then are not allowed. Just remove it.
Problematic code
-if true; then; echo "Hi"; fi
+if true; then; echo "Hi"; fi
Correct code
-if true; then echo "Hi"; fi
+if true; then echo "Hi"; fi
Rationale
then keywords should not be followed by semicolons. It's not valid shell syntax.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.json
index 85baf18..7c7bd72 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1051.json
@@ -1,5 +1,5 @@
{
- "title": "Semicolons directly after 'then' are not allowed. Just remove it.",
+ "title": "Semicolons directly after then are not allowed. Just remove it.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.html
index a51e204..36fbd53 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.html
@@ -1,9 +1,9 @@
-Semicolons directly after 'then' are not allowed. Just remove it.
+Semicolons directly after then are not allowed. Just remove it.
Problematic code
-if true; then; echo "Hi"; fi
+if true; then; echo "Hi"; fi
Correct code
-if true; then echo "Hi"; fi
+if true; then echo "Hi"; fi
Rationale
then keywords should not be followed by semicolons. It's not valid shell syntax.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.json
index 85baf18..7c7bd72 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1052.json
@@ -1,5 +1,5 @@
{
- "title": "Semicolons directly after 'then' are not allowed. Just remove it.",
+ "title": "Semicolons directly after then are not allowed. Just remove it.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.html
index da54cf7..249c14a 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.html
@@ -1,9 +1,9 @@
-Semicolons directly after 'else' are not allowed. Just remove it.
+Semicolons directly after else are not allowed. Just remove it.
Problematic code
-if mycommand; then echo "True"; else; echo "False"; fi
+if mycommand; then echo "True"; else; echo "False"; fi
Correct code
-if mycommand; then echo "True"; else echo "False"; fi
+if mycommand; then echo "True"; else echo "False"; fi
Rationale
else keywords should not be followed by semicolons. It's not valid shell syntax.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.json
index 043659b..7f2ab38 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1053.json
@@ -1,5 +1,5 @@
{
- "title": "Semicolons directly after 'else' are not allowed. Just remove it.",
+ "title": "Semicolons directly after else are not allowed. Just remove it.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.html
index 0f11857..de3bed0 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.html
@@ -1,12 +1,12 @@
-You need a space after the '{'.
+You need a space after the {.
Problematic code
-foo() {echo "hello world;}
+foo() {echo "hello world"; }
Correct code
-foo() { echo "hello world;}
+foo() { echo "hello world"; }
Rationale
{ is only recognized as the start of a command group when it's a separate token.
-If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing "{echo" with quotes, and therefore usually cause a syntax error.
+If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing "{echo" with quotes, and therefore usually cause a syntax error.
Exceptions
None.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.json
index 82b687f..1c75e2f 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1054.json
@@ -1,5 +1,5 @@
{
- "title": "You need a space after the '{'.",
+ "title": "You need a space after the {.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.html
index 3d171b0..5d9cdda 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.html
@@ -1 +1,21 @@
-You need at least one command here. Use 'true;' as a no-op.
\ No newline at end of file
+You need at least one command here. Use true; as a no-op.
+Problematic code
+submitbug() {
+ # TODO: Implement me
+}
+
+Correct code
+submitbug() {
+ # TODO: Implement me
+ true
+}
+
+Rationale
+ShellCheck found an empty code block. This could be an empty function as shown, a loop with an empty body, or similar.
+Sh/bash does not allow empty code blocks. Insert at least one command. If you don't want the block to do anything, true (aka :) is a good no-op.
+Exceptions
+None
+Related resources
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.json
index 379f947..34726d1 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1055.json
@@ -1,5 +1,5 @@
{
- "title": "You need at least one command here. Use 'true;' as a no-op.",
+ "title": "You need at least one command here. Use true; as a no-op.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.html
index 332811b..7829276 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.html
@@ -1,12 +1,12 @@
-Expected a '}'. If you have one, try a ; or \n in front of it.
+Expected a }. If you have one, try a ; or \n in front of it.
Problematic code
-#!/bin/bash
+#!/bin/bash
bar() { echo "hello world" }
Correct code
-#!/bin/bash
+#!/bin/bash
bar() { echo "hello world";}
Rationale
} is only recognized as the end of a command group when it's a separate token.
-If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing echo "foo}" with quotes, and therefore usually cause a syntax error.
+If it's not a separate token, like in the problematic example, it will be considered a literal character, as if writing echo "foo}" with quotes, and therefore usually cause a syntax error.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.json
index 536da73..861055d 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1056.json
@@ -1,5 +1,5 @@
{
- "title": "Expected a '}'. If you have one, try a ; or \\n in front of it.",
+ "title": "Expected a }. If you have one, try a ; or \\n in front of it.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.html
index 9a42ebe..9baa100 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.html
@@ -1 +1,20 @@
-Did you forget the 'do' for this loop?
\ No newline at end of file
+Did you forget the do for this loop?
+Problematic code
+while read -r line
+ echo $line
+done
+
+Correct code
+while read -r line
+do
+ echo $line
+done
+
+Rationale
+ShellCheck found a loop that appears to be missing its do statement. Make sure the loop syntax is correct.
+Exceptions
+None.
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.json
index 08c9b47..436235f 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1057.json
@@ -1,5 +1,5 @@
{
- "title": "Did you forget the 'do' for this loop?",
+ "title": "Did you forget the do for this loop?",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1058.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1058.html
index e8dee2d..1a733de 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1058.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1058.html
@@ -1,11 +1,11 @@
Expected do.
Problematic code
-for file in *
+for file in *
echo "$file"
done
Correct code
-for file in *
+for file in *
do
echo "$file"
done
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.html
index 6a30164..ac7a38c 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.html
@@ -1 +1,25 @@
-No semicolons directly after 'do'.
\ No newline at end of file
+Semicolon is not allowed directly after do. You can just delete it.
+Problematic code
+while true; do; true; done
+
+while true;
+do;
+ true;
+done;
+
+Correct code
+while true; do true; done
+
+while true;
+do
+ true;
+done;
+
+Rationale
+Semicolon ; is not allowed directly after a do keyword. Follow it directly with either a command or a linefeed as shown in the example.
+Exceptions
+None.
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.json
index e2536c5..0fafa9c 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1059.json
@@ -1,5 +1,5 @@
{
- "title": "No semicolons directly after 'do'.",
+ "title": "Semicolon is not allowed directly after do. You can just delete it.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.html
index bc94d19..6ae5a75 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.html
@@ -1 +1,19 @@
-Can't have empty do clauses (use 'true' as a no-op).
\ No newline at end of file
+Can't have empty do clauses (use true as a no-op)
+Problematic code
+for i in 1 2 3; do
+done
+
+Correct code
+for i in 1 2 3; do
+ true
+done
+
+Rationale
+An empty do ... done block is not valid.
+Use true or : if you need no command at all.
+Exceptions
+None.
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.json
index aa30ff1..666288c 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1060.json
@@ -1,5 +1,5 @@
{
- "title": "Can't have empty do clauses (use 'true' as a no-op).",
+ "title": "Can't have empty do clauses (use true as a no-op)",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.html
index ffc3af9..878c2b2 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.html
@@ -1,13 +1,13 @@
-Couldn't find 'done' for this 'do'.
+Couldn't find done for this do.
Problematic code
-yes() {
+yes() {
while echo "y"
do
true
}
Correct code
-yes() {
+yes() {
while echo "y"
do
true
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.json
index 212e5ef..b683855 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1061.json
@@ -1,5 +1,5 @@
{
- "title": "Couldn't find 'done' for this 'do'.",
+ "title": "Couldn't find done for this do.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.html
index f834ce1..287e57a 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.html
@@ -1,2 +1,2 @@
-Expected 'done' matching previously mentioned 'do'.
+Expected done matching previously mentioned do.
See companion warning [[SC1061]]
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.json
index d7bbf61..c3cefad 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1062.json
@@ -1,5 +1,5 @@
{
- "title": "Expected 'done' matching previously mentioned 'do'.",
+ "title": "Expected done matching previously mentioned do.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.html
index 2971ff7..d647929 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.html
@@ -1 +1,31 @@
-You need a line feed or semicolon before the 'do'.
\ No newline at end of file
+You need a line feed or semicolon before the do.
+Problematic code
+for file in * do
+ echo "$file"
+done
+
+Correct code
+for file in *; do
+ echo "$file"
+done
+
+# or
+
+for file in *
+do
+ echo "$file"
+done
+
+Rationale
+ShellCheck found a do on the same line as a loop, but do only starts a loop block at the start of a line/statement. Make the do the start of a new line/statement by inserting a linefeed or semicolon in front of it.
+Exceptions
+If you wanted to treat do as a literal string, you can quote it to make this clear to ShellCheck and humans:
+for f in "for" "do" "done"
+do
+ echo "Shell keywords include: $f"
+done
+
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.json
index 534ce1e..6e9c80f 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1063.json
@@ -1,5 +1,5 @@
{
- "title": "You need a line feed or semicolon before the 'do'.",
+ "title": "You need a line feed or semicolon before the do.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1064.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1064.html
index b09ca5f..0c0241e 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1064.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1064.html
@@ -1,12 +1,12 @@
-Expected a { to open the function definition.
+Expected a { to open the function definition.
Problematic code
-foo() {
+foo() {
echo "hello world"
}
foo()
Correct code
-foo() {
+foo() {
echo "hello world"
}
foo
@@ -18,7 +18,7 @@ Rationale
If you are trying to do something else, look up the syntax for what you are trying to do.
Exceptions
POSIX allows the body of a function to be any compound command, e.g. foo() for i; do :; done. Since this usage is rare, ShellCheck intentionally requires the body to be { ..; } (or ( ..; )):
-foo() {
+foo() {
for i; do :; done
}
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.html
index c11ad7a..fb6db94 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.html
@@ -1,12 +1,12 @@
-Trying to declare parameters? Don't. Use () and refer to params as $1, $2..
+Trying to declare parameters? Don't. Use () and refer to params as $1, $2, …
Problematic code
-foo(input) {
+foo(input) {
echo "$input"
}
foo("hello world");
Correct code
-foo() {
+foo() {
echo "$1"
}
foo "hello world"
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.json
index 9481663..b628e22 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1065.json
@@ -1,5 +1,5 @@
{
- "title": "Trying to declare parameters? Don't. Use () and refer to params as $1, $2..",
+ "title": "Trying to declare parameters? Don't. Use () and refer to params as $1, $2, \u2026",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1066.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1066.html
index b7c6ef2..463cab2 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1066.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1066.html
@@ -1,17 +1,17 @@
-Don't use $ on the left side of assignments.
+Don't use $ on the left side of assignments.
Problematic code
-$greeting="Hello World"
+$greeting="Hello World"
Correct code
-greeting="Hello World"
+greeting="Hello World"
Alternatively, if the goal was to assign to a variable whose name is in another variable (indirection), use declare:
-name=foo
+name=foo
declare "$name=hello world"
echo "$foo"
Or if you actually wanted to compare the value, use a test expression:
-if [ "$greeting" = "hello world" ]
+if [ "$greeting" = "hello world" ]
then
echo "Programmer, I presume?"
fi
@@ -19,4 +19,4 @@ Correct code
Rationale
Unlike Perl or PHP, $ is not used when assigning to a variable.
Exceptions
-If you wanted to
+None.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.html
index af51536..eb18279 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.html
@@ -1,35 +1,35 @@
-For indirection, use arrays, declare "var$n=value", or (for sh) read/eval
+For indirection, use arrays, declare "var$n=value", or (for sh) read/eval
Problematic code
-n=1
+n=1
var$n="hello"
Correct code
For integer indexing in ksh/bash, consider using an indexed array:
-n=1
+n=1
var[n]="hello"
echo "${var[n]}"
For string indexing in ksh/bash, use an associative array:
-typeset -A var
+typeset -A var
n="greeting"
var[$n]="hello"
echo "${var[$n]}"
If you actually need a variable with the constructed name in bash, use declare:
-n="Foo"
+n="Foo"
declare "var$n=42"
echo "$varFoo"
For sh, with single line contents, consider read:
-n="Foo"
+n="Foo"
read -r "var$n" << EOF
hello
EOF
echo "$varFoo"
or with careful escaping, eval:
-n=Foo
-eval "var$n='hello'"
+n=Foo
+eval "var$n='hello'"
echo "$varFoo"
Rationale
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.json
index c68b195..d60dff8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1067.json
@@ -1,5 +1,5 @@
{
- "title": "For indirection, use arrays, declare 'var$n=value', or (for sh) read\/eval",
+ "title": "For indirection, use arrays, declare "var$n=value", or (for sh) read\/eval",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1068.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1068.html
index 257f03b..a7acb68 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1068.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1068.html
@@ -1,11 +1,11 @@
-Don't put spaces around the = in assignments.
+Don't put spaces around the = in assignments.
Problematic code
-foo = 42
+foo = 42
Correct code
-foo=42
+foo=42
Rationale
Shells are space sensitive. foo=42 means to assign 42 to the variable foo. foo = 42 means to run a command named foo, and pass = as $1 and 42 as $2.
Exceptions
-If you actually wanted to run a command named foo and provide = as the first argument, simply quote it to make ShellCheck be quiet: foo "=" 42.
+If you actually wanted to run a command named foo and provide = as the first argument, simply quote it to make ShellCheck be quiet: foo "=" 42.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1069.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1069.html
index 49dd9ca..bac71b8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1069.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1069.html
@@ -1,10 +1,10 @@
-You need a space before the [.
+You need a space before the [.
Problematic code
-if[ -e file ]
+if[ -e file ]
then echo "exists"; fi
Correct code
-if [ -e file ]
+if [ -e file ]
then echo "exists"; fi
Rationale
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1070.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1070.html
index bd97bd9..7f359ac 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1070.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1070.html
@@ -1,5 +1,5 @@
Parsing stopped here. Mismatched keywords or invalid parentheses?
Rationale
-Shellcheck found a syntax error at the indicated location. Barring a bug in Shellcheck itself, your shell will also crash with a syntax error at the same location, so you cannot ignore this check.
+ShellCheck found a syntax error at the indicated location. Barring a bug in ShellCheck itself, your shell will also crash with a syntax error at the same location, so you cannot ignore this check.
Exceptions
None.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1071.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1071.html
index 0dba38f..3f52682 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1071.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1071.html
@@ -1,6 +1,6 @@
ShellCheck only supports sh/bash/dash/ksh scripts. Sorry!
Problematic code
-#!/usr/bin/python
+#!/usr/bin/python
print "Hello"
Rationale
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1072.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1072.html
index c9ed6de..d543302 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1072.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1072.html
@@ -1,3 +1,13 @@
Unexpected ..
Note: There is a known bug in the current version when directives appear within then clauses of if blocks that causes Shellcheck to report SC1072 on otherwise valid code. Avoid using directives within then clauses - instead place them at the top of the if block or another enclosing block. This is fixed on the online version and the next release.
See Parser Error .
+This error can also occur with an incomplete shellcheck directive like # shellcheck disable instead of # shellcheck disable=all
+Problematic code
+# shellcheck disable
+echo stuff that shellcheck up to at least v0.10.0 will not even see because of the incorrect directive above
+
+Correct code
+# shellcheck disable=all
+echo stuff that shellcheck will correctly ignore entirely
+
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1074.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1074.html
index 7d41407..24d46e8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1074.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1074.html
@@ -1,6 +1,6 @@
Did you forget the ;; after the previous case item?
Problematic code
-while getoptions f option
+while getoptions f option
do
case "${options}"
in
@@ -10,11 +10,11 @@ Problematic code
done
Correct code
-while getoptions f option
+while getoptions f option
do
case "${options}"
in
- f) FTR="${ARG}"
+ f) FTR="${ARG}";;
\?) exit;;
esac
done
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.html
index ae87ddf..ce7de95 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.html
@@ -1,15 +1,16 @@
-Use 'elif' instead of 'else if'.
+Use elif instead of else if.
Problematic code
-if [ "$#" -eq 0 ]
+if [ "$#" -eq 0 ]
then
echo "Usage: ..."
else if [ "$#" -lt 2 ]
then
echo "Missing operand"
fi
+
Correct code
-if [ "$#" -eq 0 ]
+if [ "$#" -eq 0 ]
then
echo "Usage: ..."
elif [ "$#" -lt 2 ]
@@ -22,7 +23,7 @@ Rationale
Exceptions
else if is a valid (though confusing) way of nesting an if statement in a parent's else. If this is your intention, consider using canonical formatting by putting a linefeed between else and if.
This does not change the behavior of the script, but merely makes it more obvious to ShellCheck (and other humans) that you didn't expect the else if to behave the way it does in C. Alternatively, you can [[ignore]] it with no ill effects.
-
+
if x
then
echo "x"
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.json
index 478c93f..a95afbe 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1075.json
@@ -1,5 +1,5 @@
{
- "title": "Use 'elif' instead of 'else if'.",
+ "title": "Use elif instead of else if.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.html
index cb1e54f..a3a857e 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.html
@@ -1 +1,16 @@
-Trying to do math? Use e.g. [ $((i/2+7)) -ge 18 ] or [[ $((i/2+7)) -ge 18 ]].
\ No newline at end of file
+Trying to do math? Use e.g. [ $((i/2+7)) -ge 18 ].
+Problematic code
+[ i / 2 + 7 -ge 18 ]
+
+Correct code
+[ $((i / 2 + 7)) -ge 18 ]
+
+Rationale
+ShellCheck found a loose +*/% in a test statement. This usually happens when trying to do arithmetic in a condition, but without using the arithmetic expansion construct $((expression)).
+In C, if (a+b == c) is perfectly fine, but in sh this must be written to first expand the arithmetic operation like if [ $((a+b)) = c ].
+Exceptions
+None.
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.json
index b368c4c..45e4878 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1076.json
@@ -1,5 +1,5 @@
{
- "title": "Trying to do math? Use e.g. [ $((i\/2+7)) -ge 18 ] or [[ $((i\/2+7)) -ge 18 ]].",
+ "title": "Trying to do math? Use e.g. [ $((i\/2+7)) -ge 18 ].",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1077.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1077.html
index 837cf74..fa60f67 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1077.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1077.html
@@ -1,9 +1,9 @@
-For command expansion, the tick should slant left (` vs ´).
+For command expansion, the tick should slant left (` vs ´).
Problematic code
-echo "Your username is ´whoami´"
+echo "Your username is ´whoami´"
Correct code
-echo "Your username is $(whoami)" # Preferred
+echo "Your username is $(whoami)" # Preferred
echo "Your username is `whoami`" # Deprecated, will give [SC2006]
Rationale
@@ -11,9 +11,9 @@ Rationale
Backticks start command expansions, while forward ticks are literal. To help spot bugs, ShellCheck parses backticks and forward ticks interchangeably.
Exceptions
If you want to write out literal forward ticks, such as fancyful ascii quotation marks:
-echo "``Proprietary software is an injustice.´´ - Richard Stallman"
+echo "``Proprietary software is an injustice.´´ - Richard Stallman"
use single quotes instead:
-echo '``Proprietary software is an injustice.´´ - Richard Stallman'
+echo '``Proprietary software is an injustice.´´ - Richard Stallman'
To nest forward ticks in command expansion, use $(..) instead of `..`.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.html
index 7be10a9..8203865 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.html
@@ -1,10 +1,10 @@
-Did you forget to close this double quoted string?
+Did you forget to close this double-quoted string?
Problematic code
-greeting="hello
+greeting="hello
target="world"
Correct code
-greeting="hello"
+greeting="hello"
target="world"
Rationale
@@ -12,11 +12,11 @@ Rationale
ShellCheck warns when it detects multi-line double quoted, single quoted or backticked strings when the character that follows it looks out of place (and gives a companion warning [[SC1079]] at that spot).
Exceptions
If you do want a multiline variable, just make sure the character after it is a quote, space or line feed.
-var='multiline
-'value
+var='multiline
+'value
can be rewritten for readability and to remove the warning:
-var='multiline
-value'
+var='multiline
+value'
As always `..` should be rewritten to $(..).
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.json
index ce7a551..c6bf65e 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1078.json
@@ -1,5 +1,5 @@
{
- "title": "Did you forget to close this double quoted string?",
+ "title": "Did you forget to close this double-quoted string?",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1080.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1080.html
index bf54ac7..40bd13d 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1080.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1080.html
@@ -1 +1,17 @@
-You need \ before line feeds to break lines in [ ].
\ No newline at end of file
+You need \ before line feeds to break lines in [ ].
+Problematic code
+[ "$filename" =
+ "$otherfile" ]
+
+Correct code
+[ "$filename" = \
+ "$otherfile" ]
+
+Rationale
+Bash/ksh [[ ]]] can include line breaks anywhere, but [ ] requires that you escape them. If you are writing a multi-line [ .. ] statement, make sure to include these escapes. If the [ ] is supposed to be on a single line, make sure the ] is there.
+Exceptions
+None
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.html
index 0c44e48..95dc782 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.html
@@ -1,12 +1,12 @@
-Scripts are case sensitive. Use 'if', not 'If'.
+Scripts are case-sensitive. Use if, not If.
Problematic code
-If true
+If true
Then
echo "hello"
Fi
Correct code
-if true
+if true
then
echo "hello"
fi
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.json
index 0eb572e..64d4f8d 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1081.json
@@ -1,5 +1,5 @@
{
- "title": "Scripts are case sensitive. Use 'if', not 'If'.",
+ "title": "Scripts are case-sensitive. Use if, not If.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.html
index 1742643..b289aac 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.html
@@ -1,9 +1,9 @@
-This file has a UTF-8 BOM. Remove it with: LC_CTYPE=C sed '1s/^...//' < yourscript .
+This file has a UTF-8 BOM. Remove it with: LC_CTYPE=C sed '1s/^...//' < yourscript.
Problematic code
This is an encoding error that can't be seen in the script itself, but cat -v will show three bytes of garbage at the start of the file:
$ cat -v file
M-oM-;M-?#!/bin/bash
-echo "hello world"
+echo "hello world"
Correct code
The code is correct when this garbage does not appear.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.json
index 6bc4ec0..6c8507b 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1082.json
@@ -1,5 +1,5 @@
{
- "title": "This file has a UTF-8 BOM. Remove it with: LC_CTYPE=C sed '1s\/^...\/\/' < yourscript .",
+ "title": "This file has a UTF-8 BOM. Remove it with: LC_CTYPE=C sed '1s\/^...\/\/' < yourscript.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1083.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1083.html
index 887e6c7..3ce9bbe 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1083.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1083.html
@@ -1,15 +1,15 @@
This {/} is literal. Check if ; is missing or quote the expression.
Problematic code
-rmf() { rm -f "$@" }
+rmf() { rm -f "$@" }
or
-eval echo \${foo}
+eval echo \${foo}
Correct code
-rmf() { rm -f "$@"; }
+rmf() { rm -f "$@"; }
and
-eval "echo \${foo}"
+eval "echo \${foo}"
Rationale
Curly brackets are normally used as syntax in parameter expansion, command grouping and brace expansion.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1084.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1084.html
index 03d9f09..e693f63 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1084.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1084.html
@@ -1,10 +1,10 @@
-Use #!, not !#, for the shebang.
+Use #!, not !#, for the shebang.
Problematic code
-!#/bin/sh
+!#/bin/sh
echo "Hello World"
Correct code
-#!/bin/sh
+#!/bin/sh
echo "Hello World"
Rationale
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1086.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1086.html
index 0bafe49..119aecf 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1086.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1086.html
@@ -1,12 +1,12 @@
-Don't use $ on the iterator name in for loops.
+Don't use $ on the iterator name in for loops.
Problematic code
-for $var in *
+for $var in *
do
echo "$var"
done
Correct code
-for var in *
+for var in *
do
echo "$var"
done
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.html
index bf0e284..f41b352 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.html
@@ -1,9 +1,9 @@
-"Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet)."
+Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).
Problematic code
-echo "$array[@]"
+echo "$array[@]"
Correct code
-echo "${array[@]}"
+echo "${array[@]}"
Rationale
Some languages use the syntax $array[index] to access an index of an arrays, but a shell will interpret this as $array followed by the unrelated literal string (or glob) [index].
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.json
index 62b529a..37039c9 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1087.json
@@ -1,5 +1,5 @@
{
- "title": "'Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).'",
+ "title": "Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1088.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1088.html
index 693baa8..5a9cf08 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1088.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1088.html
@@ -1,24 +1,27 @@
Parsing stopped here. Invalid use of parentheses?
Problematic code
-grep ^(.*)\1$ file
+grep ^(.*)\1$ file
or
-var=myfunction(value)
+var=myfunction(value)
Correct code
-grep '^(.*)\1$' file
+grep '^(.*)\1$' file
or
-var=$(myfunction value)
+var=$(myfunction value)
Rationale
Parentheses are shell syntax and must be used correctly.
For commands that expect literal parentheses, such as grep or find, the parentheses need to be quoted or escaped so the shell does not interpret them, but instead passes them to the command.
For shell syntax, the shell does not use them the way most other languages do, so avoid guessing at syntax based on previous experience. In particular:
-Parentheses are NOT used to call functions.
-Parentheses are NOT used to group expressions, except in arithmetic contexts.
-Parentheses are NOT used in conditional statements or loops.
+Parentheses are NOT used to call functions.
+
+Parentheses are NOT used to group expressions, except in arithmetic contexts.
+
+Parentheses are NOT used in conditional statements or loops.
+
Parentheses are used differently in different contexts. ( .. ), $( .. ), $(( .. )) and var=(..) are completely separate and independent structures with different meanings, and can not be broken down into operations on expressions in parentheses.
In C-like languages, ++ can't be broken down into two + operations, so you can't e.g. use + + or +(+). In the same way, all of the above are completely unrelated so that you can't do $(1+1) or $( (1+1) ) in place of $(( 1+1 )).
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1089.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1089.html
index 15f8c86..685ddd8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1089.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1089.html
@@ -1,13 +1,13 @@
Parsing stopped here. Is this keyword correctly matched up?
Problematic code
- if true
+if true
then
echo hello
fi
fi
Correct code
-if true
+if true
then
echo hello
fi
@@ -15,7 +15,7 @@ Correct code
Rationale
This error is typically seen when there are too many fi, done or esacs, or when there's a do or then without a corresponding while, for or if. This is often due to deleting a loop or conditional statement but not its terminator.
In some cases, it can even be caused by bad quoting:
-var="foo
+var="foo
if [[ $var = "bar ]
then
echo true
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.html
index 7cba88a..1431f92 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.html
@@ -1,14 +1,14 @@
-Can't follow non-constant source. Use a directive to specify location.
+Can't follow non-constant source. Use a directive to specify location
Problematic code
-. "${util_path}"
+. "${util_path}"
Correct code
-# shellcheck source=src/util.sh
+# shellcheck source=src/util.sh
. "${util_path}"
Rationale
ShellCheck is not able to include sourced files from paths that are determined at runtime. The file will not be read, potentially resulting in warnings about unassigned variables and similar.
Use a [[Directive]] to point shellcheck to a fixed location it can read instead.
-ShellCheck v0.7.2+ will strip a single expansion followed by a slash, e.g. ${var}/util.sh or $(dirname "${BASH_SOURCE[0]}")/util.sh, and treat them as ./util.sh. This allowing the use of source-path directives or -P flags to specify the a location.
+ShellCheck v0.7.2+ will strip a single expansion followed by a slash, e.g. ${var}/util.sh or $(dirname "${BASH_SOURCE[0]}")/util.sh, and treat them as ./util.sh. This allows the use of source-path directives or -P flags to specify the location.
Exceptions
If you don't care that ShellCheck is unable to account for the file, specify # shellcheck source=/dev/null.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.json
index 152d65a..43ae46c 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1090.json
@@ -1,5 +1,5 @@
{
- "title": "Can't follow non-constant source. Use a directive to specify location.",
+ "title": "Can't follow non-constant source. Use a directive to specify location",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1091.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1091.html
index 9fbe4f7..627ead7 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1091.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1091.html
@@ -1,21 +1,27 @@
Not following: (error message here)
Reasons include: file not found, no permissions, not included on the command line, not allowing shellcheck to follow files with -x, etc.
Problematic code
-source somefile
+source somefile
Correct code
In case you have access to the file, e.g. if it is included in your source code repository:
-# shellcheck source=somefile
+# shellcheck source=somefile
source somefile
In case you do not have access to the file:
-# shellcheck source=/dev/null
+# shellcheck source=/dev/null
source somefile
Rationale
ShellCheck, for whichever reason, is not able to access the source file.
-This could be because you did not include it on the command line, did not use shellcheck -x to allow following other files, don't have permissions or a variety of other problems.
+This could be because:
+
+you did not include it on the command line,
+did not use shellcheck -x (or specified external-sources=true in the [[.shellcheckrc|Directive#external-sources]]) to allow following other files
+don't have permissions, or
+a variety of other problems.
+
Feel free to ignore the error with a [[directive]].
Exceptions
-ShellCheck is unable to follow dynamic paths, such as source "$somedir/file". For these cases, see [[SC1090: Can't follow non-constant source. Use a directive to specify location|SC1090]] instead. You may be seeing SC1091 because ShellCheck tried to be helpful and strip a leading dynamic path element as described on that page.
+ShellCheck is unable to follow dynamic paths, such as source "$somedir/file". For these cases, see SC1090: Can't follow non-constant source. Use a directive to specify location instead. You may be seeing SC1091 because ShellCheck tried to be helpful and strip a leading dynamic path element as described on that page.
If you're fine with it, ignore the message with a [[directive]].
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.html
index 9b90093..0e6d89b 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.html
@@ -1 +1,13 @@
-Stopping at 100 'source' frames :O
\ No newline at end of file
+Stopping at 100 source frames :O
+Problematic code
+An initial file sourcing a second file, which in turn sources a third file, which in turn sources a fourth file, ...., which in turn sources a 100th file.
+Correct code
+Anything but that.
+Rationale
+ShellCheck found a chain of 100+ files sourcing each other. It assumed there must be some internal bug, so it stopped.
+Exceptions
+If this is intentional, you can cosmetically [[ignore]] this message.
+Related resources
+
+Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.json
index ba5e7a5..2920c18 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1092.json
@@ -1,5 +1,5 @@
{
- "title": "Stopping at 100 'source' frames :O",
+ "title": "Stopping at 100 source frames :O",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1094.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1094.html
index 08ee96c..542a8e8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1094.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1094.html
@@ -1,9 +1,9 @@
Parsing of sourced file failed. Ignoring it.
Problematic code
-source mylib
+source mylib
Correct code
-# shellcheck disable=SC1094
+# shellcheck disable=SC1094
source mylib
(or fix mylib)
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1095.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1095.html
index 3d3d95b..5774667 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1095.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1095.html
@@ -1,17 +1,17 @@
You need a space or linefeed between the function name and body.
Problematic code
-function foo{
+function foo{
echo "hello world"
}
Correct code
Prefer POSIX syntax:
-foo() {
+foo() {
echo "hello world"
}
Alternatively, add the missing space between function name and opening {:
-# v-- Here
+# v-- Here
function foo {
echo "hello world"
}
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1097.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1097.html
index 52392f7..765b495 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1097.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1097.html
@@ -1,13 +1,13 @@
-Unexpected ==. For assignment, use =. For comparison, use [/[[.
+Unexpected ==. For assignment, use =. For comparison, use [/[[.
Problematic code
-var==value
+var==value
Correct code
Assignment:
-var=value
+var=value
Comparison:
-[ "$var" = value ]
+[ "$var" = value ]
Rationale
ShellCheck has noticed that you're using == in an unexpected way. The two most common reasons for this is:
@@ -19,5 +19,5 @@ Rationale
Exceptions
If you wanted to assign a literal equals sign, use quotes to make this clear:
-var="=sum(A1:A10)"
+var="=sum(A1:A10)"
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.html
index 8f6a67c..60e6707 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.html
@@ -1,9 +1,9 @@
-Quote/escape special characters when using eval, e.g. eval "a=(b)".
+Quote/escape special characters when using eval, e.g. eval "a=(b)".
Problematic code
-eval $var=(a b)
+eval $var=(a b)
Correct code
-eval "$var=(a b)"
+eval "$var=(a b)"
Rationale
Shells differ widely in how they handle unescaped parentheses in eval expressions.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.json
index 02d1c32..1d2d2cc 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1098.json
@@ -1,5 +1,5 @@
{
- "title": "Quote\/escape special characters when using eval, e.g. eval 'a=(b)'.",
+ "title": "Quote\/escape special characters when using eval, e.g. eval "a=(b)".",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1099.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1099.html
index 1c7417d..035fa7a 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1099.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1099.html
@@ -1,12 +1,12 @@
-You need a space before the #.
+You need a space before the #.
Problematic code
-while sleep 1
+while sleep 1
do# show time
date
done
Correct code
-while sleep 1
+while sleep 1
do # show time
date
done
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.html
index 9d3bdfb..a008f67 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.html
@@ -1,9 +1,9 @@
-This is a unicode dash. Delete and retype as ASCII minus.
+This is a Unicode dash. Delete and retype as ASCII minus.
Problematic code
-[[ 3 –gt 2 ]] # Uses unicode en-dash character
+[[ 3 –gt 2 ]] # Uses unicode en-dash character
Correct code
-[[ 3 -gt 2 ]] # Uses regular ASCII hyphen-minus character
+[[ 3 -gt 2 ]] # Uses regular ASCII hyphen-minus character
Rationale
A character that looks similar to - has made its way into your code. This is usually due to copy-pasting from blogs and other websites that formatted code as text, replacing the ASCII hyphen-minus with a Unicode dash character.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.json
index 323c6a6..a68e13d 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1100.json
@@ -1,5 +1,5 @@
{
- "title": "This is a unicode dash. Delete and retype as ASCII minus.",
+ "title": "This is a Unicode dash. Delete and retype as ASCII minus.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1101.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1101.html
index 2fe5afb..f97057e 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1101.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1101.html
@@ -1,11 +1,11 @@
-Delete trailing spaces after \ to break line (or use quotes for literal space).
+Delete trailing spaces after \ to break line (or use quotes for literal space).
Problematic code
-# There are spaces after the backslash:
+# There are spaces after the backslash:
echo hello \
world
Correct code
-# No spaces after the backslash:
+# No spaces after the backslash:
echo hello \
world
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.html
index c71e9ba..2f4cc4d 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.html
@@ -1,9 +1,9 @@
-Shells disambiguate $(( differently or not at all. For $(command substition), add space after $( . For $((arithmetics)), fix parsing errors.
+Shells disambiguate $(( differently or not at all. For $(command substitution), add space after $( . For $((arithmetics)), fix parsing errors.
Problematic code
-echo "$((cmd "$@") 2>&1)"
+echo "$((cmd "$@") 2>&1)"
Correct code
-echo "$( (cmd "$@") 2>&1)"
+echo "$( (cmd "$@") 2>&1)"
Rationale
You appear to be using $(( with two (or more) parentheses in a row, where the first $( should open a subshell.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.json b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.json
index e10fec2..33991ec 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.json
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1102.json
@@ -1,5 +1,5 @@
{
- "title": "Shells disambiguate $(( differently or not at all. For $(command substition), add space after $( . For $((arithmetics)), fix parsing errors.",
+ "title": "Shells disambiguate $(( differently or not at all. For $(command substitution), add space after $( . For $((arithmetics)), fix parsing errors.",
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1103.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1103.html
index 18e74f6..8e731f8 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1103.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1103.html
@@ -1 +1,30 @@
-This shell type is unknown. Use e.g. sh or bash.
\ No newline at end of file
+This shell type is unknown. Use e.g. sh or bash.
+Problematic code
+# shellcheck shell=zsh
+export PAGER=less
+
+Correct code
+Any supported shell on the shebang or the -s option
+# shellcheck shell=sh
+export PAGER=less
+
+Rationale
+Shellcheck only supports a specific range of shell dialects, there are many more applications providing shell like experiences and some of them look and feel like POSIX shell or bash but does not support the same commands.
+One notable unsupported shell type is zsh, see issue #809 about supporting zsh - some efforts have been done in the past.
+Exceptions
+The supported shell types are listed in the help context, at the moment these are
+
+Related resources
+
+Similar rules
+[[SC1008]] - unrecognized shebang
+[[SC1071]] - unsupported shebang
+
+
+[[Documentation for shell directive|Directive#shell]]
+
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1104.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1104.html
index e12805e..f7dd362 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1104.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1104.html
@@ -1,14 +1,14 @@
-Use #!, not just !, for the shebang.
+Use #!, not just !, for the shebang.
Problematic code
-!/bin/sh
+!/bin/sh
echo "Hello"
Correct code
-#!/bin/sh
+#!/bin/sh
echo "Hello"
Rationale
You appear to be specifying an interpreter in a shebang, but it's missing the hash part. The shebang must always start with #!.
-Even the name "shebang" itself comes from "hash" (#) + "bang" (!).
+Even the name "shebang" itself comes from "hash" (#) + "bang" (!).
Exceptions
None.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1105.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1105.html
index 02de71d..8e1c347 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1105.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1105.html
@@ -1,2 +1,2 @@
-Shells disambiguate (( differently or not at all. If the first ( should start a subshell, add a space after it.
+Shells disambiguate (( differently or not at all. If the first ( should start a subshell, add a space after it.
See [[SC1102]], the similar warning for ambiguous $((.
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1106.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1106.html
index 030e5e6..1c92a23 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1106.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1106.html
@@ -1,20 +1,20 @@
In arithmetic contexts, use < instead of -lt
Similarly, > instead of -gt, <= instead of -le, >= instead of -ge, == instead of -eq, != instead of -ne.
Problematic code
-if (( 2 -lt 3 ))
+if (( 2 -lt 3 ))
then
echo "True"
fi
Correct code
-if (( 2 < 3 ))
+if (( 2 < 3 ))
then
echo "True"
fi
Rationale
The comparators -lt, -ge, -eq and friends are flags for the test command aka [. You are instead using it in an arithmetic context, such as (( .. )) or $(( .. )), where you should be using <, >=, == etc instead.
-In arithmetic contexts, -lt is simply interpreted as "subtract the value of $lt", which is clearly not the intention.
+In arithmetic contexts, -lt is simply interpreted as "subtract the value of $lt", which is clearly not the intention.
Exceptions
If you do want to subtract $lt you can add a space to make this clear to ShellCheck: echo $((3 - lt))
Related resources
diff --git a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1107.html b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1107.html
index 556b05b..a006ce4 100644
--- a/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1107.html
+++ b/src/main/resources/org/sonar/l10n/shellcheck/rules/shellcheck/SC1107.html
@@ -1,6 +1,6 @@
This directive is unknown. It will be ignored.
Problematic code
-# shellcheck foobar=baz
+