Skip to content

Commit

Permalink
Update dotnet linters to .NET 7 (#2402)
Browse files Browse the repository at this point in the history
* Update some dotnet linters to .NET 7

* [MegaLinter] Apply linters fixes

* Set DOTNET_ROLL_FORWARD

* Run update.sh

* Add CVE-2023-6378 to .trivyignore

* Typo

---------

Co-authored-by: bdovaz <[email protected]>
  • Loading branch information
bdovaz and bdovaz authored Dec 4, 2023
1 parent 9d44462 commit 1c3420e
Show file tree
Hide file tree
Showing 25 changed files with 21,180 additions and 21,411 deletions.
1 change: 1 addition & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ CVE-2023-0286
CVE-2023-0842
CVE-2023-2253
CVE-2023-2650
CVE-2023-6378
CVE-2023-26115
CVE-2023-28840
CVE-2023-2976
Expand Down
47 changes: 11 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,7 @@ RUN apk add --no-cache \
docker \
openrc \
icu-libs \
libcurl \
libintl \
libssl1.1 \
libstdc++ \
lttng-ust-dev \
zlib \
zlib-dev \
dotnet7-sdk \
openjdk17 \
perl \
perl-dev \
Expand All @@ -122,9 +116,11 @@ RUN apk add --no-cache \
helm \
gcompat \
libc6-compat \
libstdc++ \
readline-dev \
g++ \
libc-dev \
libcurl \
libgcc \
libxml2-dev \
libxml2-utils \
Expand Down Expand Up @@ -388,14 +384,11 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases
rm \
"$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" \
"$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"

# CSHARP installation
&& wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest

ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# CSHARP installation
ENV PATH="${PATH}:/root/.dotnet/tools"

# DART installation
# Next line commented because already managed by another linter
Expand Down Expand Up @@ -497,11 +490,7 @@ RUN sf plugins install @salesforce/plugin-packaging \

# VBDOTNET installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# ENV PATH="${PATH}:/root/.dotnet/tools"

# actionlint installation
# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
Expand Down Expand Up @@ -543,16 +532,10 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \
&& ./install-cljstyle \

# csharpier installation
&& /usr/share/dotnet/dotnet tool install -g csharpier \
&& dotnet tool install --global csharpier \

# roslynator installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
&& /usr/share/dotnet/dotnet tool install -g roslynator.dotnet.cli \
&& dotnet tool install -g roslynator.dotnet.cli \

# dartanalyzer installation
&& wget --tries=5 https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-x64-release.zip -O - -q | unzip -q - \
Expand Down Expand Up @@ -688,11 +671,7 @@ ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$

# devskim installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# ENV PATH="${PATH}:/root/.dotnet/tools"
RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \

# dustilock installation
Expand Down Expand Up @@ -755,11 +734,7 @@ RUN curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh |

# tsqllint installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# ENV PATH="${PATH}:/root/.dotnet/tools"
&& dotnet tool install --global TSQLLint

# tflint installation
Expand Down
12 changes: 4 additions & 8 deletions docs/descriptors/csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@ description: dotnet-format, csharpier, roslynator are available to analyze CSHAR

- Dockerfile commands :
```dockerfile
RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest

ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
ENV PATH="${PATH}:/root/.dotnet/tools"
```

- APK packages (Linux):
- [dotnet7-sdk](https://pkgs.alpinelinux.org/packages?branch=edge&name=dotnet7-sdk)
- [icu-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=icu-libs)
- [libcurl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libcurl)
- [krb5-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=krb5-libs)
- [libgcc](https://pkgs.alpinelinux.org/packages?branch=edge&name=libgcc)
- [libintl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libintl)
- [libssl1.1](https://pkgs.alpinelinux.org/packages?branch=edge&name=libssl1.1)
- [libstdc++](https://pkgs.alpinelinux.org/packages?branch=edge&name=libstdc++)
- [lttng-ust-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=lttng-ust-dev)
- [zlib](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib)
- [zlib-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib-dev)
8 changes: 2 additions & 6 deletions docs/descriptors/csharp_csharpier.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,8 @@ Options:
- Dockerfile commands :
```dockerfile
# Parent descriptor install
RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
ENV PATH="${PATH}:/root/.dotnet/tools"
# Linter install
RUN /usr/share/dotnet/dotnet tool install -g csharpier
RUN dotnet tool install --global csharpier
```
12 changes: 4 additions & 8 deletions docs/descriptors/repository_devskim.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,16 @@ devskim 1.0.23+607c9a5eda

- Dockerfile commands :
```dockerfile
RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest

ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
ENV PATH="${PATH}:/root/.dotnet/tools"
RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI
```

- APK packages (Linux):
- [dotnet6-sdk](https://pkgs.alpinelinux.org/packages?branch=edge&name=dotnet6-sdk)
- [icu-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=icu-libs)
- [libcurl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libcurl)
- [krb5-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=krb5-libs)
- [libgcc](https://pkgs.alpinelinux.org/packages?branch=edge&name=libgcc)
- [libintl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libintl)
- [libssl1.1](https://pkgs.alpinelinux.org/packages?branch=edge&name=libssl1.1)
- [libstdc++](https://pkgs.alpinelinux.org/packages?branch=edge&name=libstdc++)
- [lttng-ust-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=lttng-ust-dev)
- [zlib](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib)
- [zlib-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib-dev)
12 changes: 4 additions & 8 deletions docs/descriptors/sql_tsqllint.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,16 @@ tsqllint [options] [file.sql] | [dir] | [file.sql | dir]
- Dockerfile commands :
```dockerfile
RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest

ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
ENV PATH="${PATH}:/root/.dotnet/tools"
RUN dotnet tool install --global TSQLLint
```
- APK packages (Linux):
- [dotnet6-sdk](https://pkgs.alpinelinux.org/packages?branch=edge&name=dotnet6-sdk)
- [icu-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=icu-libs)
- [libcurl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libcurl)
- [krb5-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=krb5-libs)
- [libgcc](https://pkgs.alpinelinux.org/packages?branch=edge&name=libgcc)
- [libintl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libintl)
- [libssl1.1](https://pkgs.alpinelinux.org/packages?branch=edge&name=libssl1.1)
- [libstdc++](https://pkgs.alpinelinux.org/packages?branch=edge&name=libstdc++)
- [lttng-ust-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=lttng-ust-dev)
- [zlib](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib)
- [zlib-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib-dev)
12 changes: 4 additions & 8 deletions docs/descriptors/vbdotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,15 @@ description: dotnet-format is available to analyze VBDOTNET files in MegaLinter

- Dockerfile commands :
```dockerfile
RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest

ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
ENV PATH="${PATH}:/root/.dotnet/tools"
```

- APK packages (Linux):
- [dotnet7-sdk](https://pkgs.alpinelinux.org/packages?branch=edge&name=dotnet7-sdk)
- [icu-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=icu-libs)
- [libcurl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libcurl)
- [krb5-libs](https://pkgs.alpinelinux.org/packages?branch=edge&name=krb5-libs)
- [libgcc](https://pkgs.alpinelinux.org/packages?branch=edge&name=libgcc)
- [libintl](https://pkgs.alpinelinux.org/packages?branch=edge&name=libintl)
- [libssl1.1](https://pkgs.alpinelinux.org/packages?branch=edge&name=libssl1.1)
- [libstdc++](https://pkgs.alpinelinux.org/packages?branch=edge&name=libstdc++)
- [lttng-ust-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=lttng-ust-dev)
- [zlib](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib)
- [zlib-dev](https://pkgs.alpinelinux.org/packages?branch=edge&name=zlib-dev)
40 changes: 9 additions & 31 deletions flavors/dotnet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,7 @@ RUN apk add --no-cache \
openssh \
openssl \
icu-libs \
libcurl \
libintl \
libssl1.1 \
libstdc++ \
lttng-ust-dev \
zlib \
zlib-dev \
dotnet7-sdk \
openjdk17 \
py3-pyflakes \
nodejs \
Expand All @@ -87,6 +81,7 @@ RUN apk add --no-cache \
helm \
gcompat \
libc6-compat \
libstdc++ \
libc-dev \
libxml2-dev \
libxml2-utils \
Expand Down Expand Up @@ -253,14 +248,11 @@ RUN curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/po
&& mkdir -p /opt/microsoft/powershell/7 \
&& tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 \
&& chmod +x /opt/microsoft/powershell/7/pwsh \
&& ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh \
&& ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh

# CSHARP installation
&& wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest

ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# CSHARP installation
ENV PATH="${PATH}:/root/.dotnet/tools"

# KOTLIN installation
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
Expand All @@ -276,11 +268,7 @@ ENV PATH="$JAVA_HOME/bin:${PATH}"

# VBDOTNET installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# ENV PATH="${PATH}:/root/.dotnet/tools"

# actionlint installation
# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
Expand Down Expand Up @@ -312,16 +300,10 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \
&& mv "${BICEP_EXE}" "${BICEP_DIR}" \

# csharpier installation
&& /usr/share/dotnet/dotnet tool install -g csharpier \
&& dotnet tool install --global csharpier \

# roslynator installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
&& /usr/share/dotnet/dotnet tool install -g roslynator.dotnet.cli \
&& dotnet tool install -g roslynator.dotnet.cli \

# hadolint installation
# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint
Expand Down Expand Up @@ -387,11 +369,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \

# tsqllint installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# ENV PATH="${PATH}:/root/.dotnet/tools"
&& dotnet tool install --global TSQLLint

#OTHER__END
Expand Down
40 changes: 9 additions & 31 deletions flavors/dotnetweb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,7 @@ RUN apk add --no-cache \
openssh \
openssl \
icu-libs \
libcurl \
libintl \
libssl1.1 \
libstdc++ \
lttng-ust-dev \
zlib \
zlib-dev \
dotnet7-sdk \
openjdk17 \
py3-pyflakes \
nodejs \
Expand All @@ -87,6 +81,7 @@ RUN apk add --no-cache \
helm \
gcompat \
libc6-compat \
libstdc++ \
libc-dev \
libxml2-dev \
libxml2-utils \
Expand Down Expand Up @@ -273,14 +268,11 @@ RUN curl -L https://github.com/PowerShell/PowerShell/releases/download/v7.4.0/po
&& mkdir -p /opt/microsoft/powershell/7 \
&& tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/7 \
&& chmod +x /opt/microsoft/powershell/7/pwsh \
&& ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh \
&& ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh

# CSHARP installation
&& wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
&& chmod +x dotnet-install.sh \
&& ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest

ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# CSHARP installation
ENV PATH="${PATH}:/root/.dotnet/tools"

# KOTLIN installation
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
Expand All @@ -296,11 +288,7 @@ ENV PATH="$JAVA_HOME/bin:${PATH}"

# VBDOTNET installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# ENV PATH="${PATH}:/root/.dotnet/tools"

# actionlint installation
# Managed with COPY --link --from=actionlint /usr/local/bin/actionlint /usr/bin/actionlint
Expand Down Expand Up @@ -332,16 +320,10 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \
&& mv "${BICEP_EXE}" "${BICEP_DIR}" \

# csharpier installation
&& /usr/share/dotnet/dotnet tool install -g csharpier \
&& dotnet tool install --global csharpier \

# roslynator installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
&& /usr/share/dotnet/dotnet tool install -g roslynator.dotnet.cli \
&& dotnet tool install -g roslynator.dotnet.cli \

# hadolint installation
# Managed with COPY --link --from=hadolint /bin/hadolint /usr/bin/hadolint
Expand Down Expand Up @@ -407,11 +389,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \

# tsqllint installation
# Next line commented because already managed by another linter
# RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \
# && chmod +x dotnet-install.sh \
# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest
# Next line commented because already managed by another linter
# ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet"
# ENV PATH="${PATH}:/root/.dotnet/tools"
&& dotnet tool install --global TSQLLint

#OTHER__END
Expand Down
Loading

0 comments on commit 1c3420e

Please sign in to comment.