Skip to content

Commit

Permalink
Merge branch 'master' into rfvc
Browse files Browse the repository at this point in the history
  • Loading branch information
IlnurHA committed May 3, 2024
2 parents cd57cef + 2a95bda commit 7056f1f
Show file tree
Hide file tree
Showing 30 changed files with 582 additions and 103 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: actionlint
'on':
push:
branches:
- master
pull_request:
branches:
- master
jobs:
actionlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
# yamllint disable-line rule:line-length
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
markdown-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
- uses: actions/checkout@8459bc0c7e3759cdf591f513d9f141a95fef0a8f
- uses: articulate/actions-markdownlint@v1
2 changes: 1 addition & 1 deletion .github/workflows/pdd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# SOFTWARE.
---
name: pdd
on:
'on':
push:
branches:
- master
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ibiqlik/action-yamllint@v3
with:
config_file: .yamllint.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ test-zone/
*.zip
*.pdf
pylint_plugins/__pycache__
target/
4 changes: 4 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rules:
line-length:
max: 80
allow-non-breakable-words: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

FROM ubuntu:22.04
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

Expand Down
1 change: 1 addition & 0 deletions filters/delete-invalid-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
lst: Final[str] = sys.argv[2]
try:
with open(java, encoding='utf-8') as f:
# pylint: disable=no-member
raw = javalang.parse.parse(f.read())
if len(raw.types) != 1:
os.remove(java)
Expand Down
4 changes: 4 additions & 0 deletions help/assert-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ set -o pipefail
cmd=$1
arg=$2

if [ -z "${TARGET}" ]; then
TARGET=$(dirname "$0")/../target
fi

out=${TARGET}/temp/assert-tool.out
mkdir -p "$(dirname "${out}")"
if ! "${cmd}" "${arg}" > "${out}" 2>&1; then
Expand Down
30 changes: 30 additions & 0 deletions help/is-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# The MIT License (MIT)
#
# Copyright (c) 2021-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -e
set -o pipefail

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
exit 0
else
exit 1
fi
34 changes: 34 additions & 0 deletions help/sudo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# The MIT License (MIT)
#
# Copyright (c) 2021-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -e
set -o pipefail

if "${LOCAL}/help/is-linux.sh"; then
if [ ! "$(id -u)" = 0 ]; then
echo "You should run it as root: 'sudo make install'"
exit 1
fi
"$@"
else
sudo "$@"
fi
14 changes: 11 additions & 3 deletions installs/install-gem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ set -o pipefail
"${LOCAL}/help/assert-tool.sh" ruby -v
"${LOCAL}/help/assert-tool.sh" gem -v

gem install --no-document rubocop -v 1.56.3
gem install --no-document octokit -v 4.21.0
gem install --no-document slop -v 4.9.1
if ! gem list -i rubocop; then
gem install --no-document rubocop -v 1.56.3
fi

if ! gem list -i octokit; then
gem install --no-document octokit -v 4.21.0
fi

if ! gem list -i slop; then
gem install --no-document slop -v 4.9.1
fi
36 changes: 23 additions & 13 deletions installs/install-gradle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,29 @@
set -e
set -o pipefail

if [ -z "${LOCAL}" ]; then
LOCAL=$(dirname "$0")/..
fi

"${LOCAL}/help/assert-tool.sh" javac --version

if ! gradle --version >/dev/null 2>&1; then
if [ ! -e /usr/local ]; then
echo "The directory /usr/local must exist"
exit 1
fi
gradle_version=7.4
cd /usr/local && \
wget --quiet https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip && \
unzip -qq gradle-${gradle_version}-bin.zip && \
rm gradle-${gradle_version}-bin.zip && \
mv gradle-${gradle_version} gradle
export GRADLE_LOCAL=/usr/local/gradle
export PATH=$PATH:/usr/local/gradle/bin
if gradle --version >/dev/null 2>&1; then
gradle --version
echo "Gradle is already installed"
exit
fi

if [ ! -e /usr/local ]; then
echo "The directory /usr/local must exist"
exit 1
fi

gradle_version=7.4
cd /usr/local
wget --quiet https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip
unzip -qq gradle-${gradle_version}-bin.zip
rm gradle-${gradle_version}-bin.zip
mv gradle-${gradle_version} gradle
ln -s /usr/local/gradle/bin/gradle /usr/local/bin/gradle
echo "Gradle installed into /usr/local/gradle"
gradle --version
18 changes: 12 additions & 6 deletions installs/install-jpeek.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,16 @@ set -o pipefail

"${LOCAL}/help/assert-tool.sh" javac --version

if [ ! -e "${JPEEK}" ]; then
jpeek_version=0.32.0
cd /tmp && \
wget --quiet https://repo1.maven.org/maven2/org/jpeek/jpeek/${jpeek_version}/jpeek-${jpeek_version}-jar-with-dependencies.jar && \
mkdir -p "$(dirname "${JPEEK}")" && \
mv "jpeek-${jpeek_version}-jar-with-dependencies.jar" "${JPEEK}"
if [ -e "${JPEEK}" ]; then
java -jar "${JPEEK}" --help
echo "jPeek JAR is already here: ${JPEEK}"
exit
fi

jpeek_version=0.32.0
cd /tmp
wget --quiet https://repo1.maven.org/maven2/org/jpeek/jpeek/${jpeek_version}/jpeek-${jpeek_version}-jar-with-dependencies.jar
mkdir -p "$(dirname "${JPEEK}")"
mv "jpeek-${jpeek_version}-jar-with-dependencies.jar" "${JPEEK}"
java -jar "${JPEEK}" --help
echo "jPeek downloaded into ${JPEEK}"
22 changes: 2 additions & 20 deletions installs/install-pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,8 @@
set -e
set -o pipefail

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
linux=yes
fi
set -x

if [ -n "${linux}" ]; then
SUDO=
else
SUDO=sudo
fi

if [ -n "${linux}" ]; then
if [ ! "$(id -u)" = 0 ]; then
echo "You should run it as root: 'sudo make install'"
exit 1
fi
fi

"${LOCAL}/help/assert-tool.sh" python3 --version
"${LOCAL}/help/assert-tool.sh" pip --version

$SUDO python3 -m pip install --upgrade pip
$SUDO python3 -m pip install -r "${LOCAL}/requirements.txt"
"${LOCAL}/help/sudo.sh" python3 -m pip install --upgrade pip
"${LOCAL}/help/sudo.sh" python3 -m pip install -r "${LOCAL}/requirements.txt"
34 changes: 22 additions & 12 deletions installs/install-pmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,28 @@
set -e
set -o pipefail

if [ -z "${LOCAL}" ]; then
LOCAL=$(dirname "$0")/..
fi

"${LOCAL}/help/assert-tool.sh" javac --version

if ! pmd pmd --version >/dev/null 2>&1; then
if [ ! -e /usr/local ]; then
echo "The directory /usr/local must exist"
exit 1
fi
pmd_version=6.55.0
cd /usr/local && \
wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.55.0/pmd-bin-${pmd_version}.zip && \
unzip -qq pmd-bin-${pmd_version}.zip && \
rm pmd-bin-${pmd_version}.zip && \
mv pmd-bin-${pmd_version} pmd && \
ln -s /usr/local/pmd/bin/run.sh /usr/local/bin/pmd
if pmd pmd --version >/dev/null 2>&1; then
pmd pmd --version
echo "PMD is already installed"
exit
fi

if [ ! -e /usr/local ]; then
echo "The directory /usr/local must exist"
exit 1
fi

pmd_version=6.55.0
cd /usr/local
wget --quiet https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.55.0/pmd-bin-${pmd_version}.zip
unzip -qq pmd-bin-${pmd_version}.zip
rm pmd-bin-${pmd_version}.zip
mv pmd-bin-${pmd_version} pmd
ln -s /usr/local/pmd/bin/run.sh /usr/local/bin/pmd
echo "PMD installed into /usr/local/bin/pmd"
21 changes: 6 additions & 15 deletions installs/install-texlive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,8 @@
set -e
set -o pipefail

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
linux=yes
fi
set -x

if [ -n "${linux}" ]; then
SUDO=
else
SUDO=sudo
fi

if ! "${LOCAL}/help/texlive-bin.sh"; then
wget --quiet http://mirror.ctan.org/systems/texlive/tlnet/install-tl.zip
unzip install-tl.zip -d install-tl
Expand All @@ -44,7 +35,7 @@ if ! "${LOCAL}/help/texlive-bin.sh"; then
fi

if ! tlmgr --version >/dev/null 2>&1; then
if [ -n "${linux}" ]; then
if "${LOCAL}/help/is-linux.sh"; then
PATH=$PATH:$("${LOCAL}/help/texlive-bin.sh")
export PATH
else
Expand All @@ -53,13 +44,13 @@ if ! tlmgr --version >/dev/null 2>&1; then
fi

if [ ! -e "${HOME}/texmf" ]; then
$SUDO tlmgr init-usertree
"${LOCAL}/help/sudo.sh" tlmgr init-usertree
fi
$SUDO tlmgr option repository ctan
$SUDO tlmgr --verify-repo=none update --self
"${LOCAL}/help/sudo.sh" tlmgr option repository ctan
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none update --self
packages=()
while IFS= read -r p; do
packages+=( "${p}" )
done < <( cut -d' ' -f2 "${LOCAL}/DEPENDS.txt" | uniq )
$SUDO tlmgr --verify-repo=none install "${packages[@]}"
$SUDO tlmgr --verify-repo=none update --no-auto-remove "${packages[@]}" || echo 'Failed to update'
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none install "${packages[@]}"
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none update --no-auto-remove "${packages[@]}" || echo 'Failed to update'
2 changes: 1 addition & 1 deletion metrics/hoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ else
hoc=0
fi

echo "hoc ${hoc} Hits Of Code for file" > "${output}"
echo "HoC ${hoc} Hits Of Code for file" > "${output}"
29 changes: 29 additions & 0 deletions metrics/ir.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# The MIT License (MIT)
#
# Copyright (c) 2021-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
set -e
set -o pipefail

output=$(realpath "$2")

echo "IR 0.000 " >"${output}"

Loading

0 comments on commit 7056f1f

Please sign in to comment.