From 93f2370d70b2c9a58f4ef019df4db3ffa60a733d Mon Sep 17 00:00:00 2001 From: Denis Costa Date: Tue, 22 Oct 2024 10:50:14 -0300 Subject: [PATCH] Fix lint --- .docker/lint/c-lint.Dockerfile | 2 +- .github/workflows/lint.yaml | 2 +- solutions/beecrowd/1024/generate_in.sh | 3 +++ solutions/beecrowd/1061/1061.cpp | 1 + solutions/beecrowd/1128/1128.cpp | 1 + solutions/beecrowd/1211/1211.cpp | 1 + solutions/beecrowd/1228/1228.cpp | 1 + solutions/beecrowd/1237/1237.cpp | 1 + solutions/beecrowd/1258/1258.cpp | 1 + solutions/beecrowd/1383/1383.cpp | 1 + solutions/beecrowd/1441/1441.cpp | 1 + solutions/beecrowd/1551/1551.cpp | 1 + solutions/beecrowd/1581/1581.cpp | 1 + solutions/beecrowd/1607/1607.cpp | 1 + solutions/beecrowd/1848/1848.cpp | 1 + solutions/beecrowd/1873/1873.cpp | 1 + solutions/beecrowd/1984/1984.cpp | 1 + solutions/beecrowd/2031/2031.cpp | 1 + solutions/beecrowd/2057/2057.cpp | 1 + solutions/beecrowd/2061/2061.cpp | 1 + solutions/beecrowd/2137/2137.cpp | 1 + solutions/beecrowd/2147/2147.cpp | 1 + solutions/beecrowd/2174/2174.cpp | 1 + solutions/beecrowd/2176/2176.cpp | 1 + solutions/beecrowd/2242/2242.cpp | 1 + solutions/beecrowd/2253/2253.cpp | 1 + solutions/beecrowd/2310/2310.cpp | 1 + solutions/beecrowd/2311/2311.cpp | 2 ++ solutions/beecrowd/2313/2313.cpp | 1 + solutions/beecrowd/2486/2486.cpp | 1 + solutions/beecrowd/2510/2510.cpp | 1 + solutions/beecrowd/2523/2523.cpp | 1 + solutions/beecrowd/2766/2766.cpp | 1 + .../longest-common-substring/longest-common-substring.cpp | 1 + .../oversized-pancake-flipper/oversized-pancake-flipper.cpp | 1 + 35 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.docker/lint/c-lint.Dockerfile b/.docker/lint/c-lint.Dockerfile index f26752e3..fead4039 100644 --- a/.docker/lint/c-lint.Dockerfile +++ b/.docker/lint/c-lint.Dockerfile @@ -17,7 +17,7 @@ CMD echo "c"; if [ "${LINT_FIX:=0}" -eq 1 ]; then \ --quiet \ --recursive \ --extensions=c \ - --filter="-legal/copyright,-runtime/arrays,-readability/casting" . && \ + --filter="-legal/copyright,-runtime/arrays,-readability/casting,-build/include_what_you_use" . && \ scripts/run-clang-format.py \ --clang-format-executable=clang-format \ --extensions=c \ diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index d1d7d1df..26edfe4f 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -69,7 +69,7 @@ jobs: with: image: c-lint:latest options: -v ${{ github.workspace }}:/code - run: cpplint --quiet --recursive --extensions=c --filter="-legal/copyright,-runtime/arrays,-readability/casting" . && scripts/run-clang-format.py --clang-format-executable=clang-format --extensions=c -r . + run: cpplint --quiet --recursive --extensions=c --filter="-legal/copyright,-runtime/arrays,-readability/casting,-build/include_what_you_use" . && scripts/run-clang-format.py --clang-format-executable=clang-format --extensions=c -r . - name: Run Clojure lint uses: addnab/docker-run-action@v3 with: diff --git a/solutions/beecrowd/1024/generate_in.sh b/solutions/beecrowd/1024/generate_in.sh index 1041860d..91a04a6a 100755 --- a/solutions/beecrowd/1024/generate_in.sh +++ b/solutions/beecrowd/1024/generate_in.sh @@ -6,6 +6,9 @@ TESTCASES=4062 MAX_CHARS_PER_LINE=1000 function chr { + #shellcheck disable=SC2046 + #shellcheck disable=SC2059 + #shellcheck disable=SC2086 printf \\$(printf '%03o' $1) } diff --git a/solutions/beecrowd/1061/1061.cpp b/solutions/beecrowd/1061/1061.cpp index 61fc395d..3f10df93 100644 --- a/solutions/beecrowd/1061/1061.cpp +++ b/solutions/beecrowd/1061/1061.cpp @@ -1,4 +1,5 @@ #include +#include #include int main() { diff --git a/solutions/beecrowd/1128/1128.cpp b/solutions/beecrowd/1128/1128.cpp index 0a5dde37..4d40c422 100644 --- a/solutions/beecrowd/1128/1128.cpp +++ b/solutions/beecrowd/1128/1128.cpp @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/solutions/beecrowd/1211/1211.cpp b/solutions/beecrowd/1211/1211.cpp index c472d534..e277b5b3 100644 --- a/solutions/beecrowd/1211/1211.cpp +++ b/solutions/beecrowd/1211/1211.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include int main() { diff --git a/solutions/beecrowd/1228/1228.cpp b/solutions/beecrowd/1228/1228.cpp index 51b76d2f..fcc8b728 100644 --- a/solutions/beecrowd/1228/1228.cpp +++ b/solutions/beecrowd/1228/1228.cpp @@ -1,5 +1,6 @@ #include #include +#include #include std::int16_t find(std::vector< std::int16_t > v, std::int16_t n) { diff --git a/solutions/beecrowd/1237/1237.cpp b/solutions/beecrowd/1237/1237.cpp index 5a183189..2df38a73 100644 --- a/solutions/beecrowd/1237/1237.cpp +++ b/solutions/beecrowd/1237/1237.cpp @@ -2,6 +2,7 @@ #include #include #include +#include int main() { std::int16_t lcs; diff --git a/solutions/beecrowd/1258/1258.cpp b/solutions/beecrowd/1258/1258.cpp index 3bf1226c..fb8135c9 100644 --- a/solutions/beecrowd/1258/1258.cpp +++ b/solutions/beecrowd/1258/1258.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include struct order { diff --git a/solutions/beecrowd/1383/1383.cpp b/solutions/beecrowd/1383/1383.cpp index 8f64d081..126ffe06 100644 --- a/solutions/beecrowd/1383/1383.cpp +++ b/solutions/beecrowd/1383/1383.cpp @@ -1,5 +1,6 @@ #include #include +#include #include std::int16_t find(std::vector< std::int16_t > v, std::int16_t n) { diff --git a/solutions/beecrowd/1441/1441.cpp b/solutions/beecrowd/1441/1441.cpp index 1c52af03..eb680b16 100644 --- a/solutions/beecrowd/1441/1441.cpp +++ b/solutions/beecrowd/1441/1441.cpp @@ -1,5 +1,6 @@ #include #include +#include #include std::vector< std::int32_t > sequence; diff --git a/solutions/beecrowd/1551/1551.cpp b/solutions/beecrowd/1551/1551.cpp index 2609b191..f4500161 100644 --- a/solutions/beecrowd/1551/1551.cpp +++ b/solutions/beecrowd/1551/1551.cpp @@ -2,6 +2,7 @@ #include #include #include +#include int main() { std::int16_t n, completeness; diff --git a/solutions/beecrowd/1581/1581.cpp b/solutions/beecrowd/1581/1581.cpp index dafa9c03..7910619e 100644 --- a/solutions/beecrowd/1581/1581.cpp +++ b/solutions/beecrowd/1581/1581.cpp @@ -1,5 +1,6 @@ #include #include +#include int main() { std::int16_t n, k; diff --git a/solutions/beecrowd/1607/1607.cpp b/solutions/beecrowd/1607/1607.cpp index d068fd76..39509920 100644 --- a/solutions/beecrowd/1607/1607.cpp +++ b/solutions/beecrowd/1607/1607.cpp @@ -1,6 +1,7 @@ #include #include #include +#include int main() { std::int16_t t, operations_count, i; diff --git a/solutions/beecrowd/1848/1848.cpp b/solutions/beecrowd/1848/1848.cpp index e0226865..ff7d0a38 100644 --- a/solutions/beecrowd/1848/1848.cpp +++ b/solutions/beecrowd/1848/1848.cpp @@ -1,6 +1,7 @@ #include #include #include +#include int main() { std::int16_t sum = 0; diff --git a/solutions/beecrowd/1873/1873.cpp b/solutions/beecrowd/1873/1873.cpp index a784c332..f849b972 100644 --- a/solutions/beecrowd/1873/1873.cpp +++ b/solutions/beecrowd/1873/1873.cpp @@ -1,5 +1,6 @@ #include #include +#include std::string rock_paper_scissors_lizard_spock_judge( std::string rajeshs_hand, std::string sheldons_hand) { diff --git a/solutions/beecrowd/1984/1984.cpp b/solutions/beecrowd/1984/1984.cpp index 85f7e1a4..36deaa37 100644 --- a/solutions/beecrowd/1984/1984.cpp +++ b/solutions/beecrowd/1984/1984.cpp @@ -1,5 +1,6 @@ #include #include +#include void reverse(std::string n) { std::string reversed_n = ""; diff --git a/solutions/beecrowd/2031/2031.cpp b/solutions/beecrowd/2031/2031.cpp index b6905a38..9b5fe9df 100644 --- a/solutions/beecrowd/2031/2031.cpp +++ b/solutions/beecrowd/2031/2031.cpp @@ -1,5 +1,6 @@ #include #include +#include int main() { std::int16_t n; diff --git a/solutions/beecrowd/2057/2057.cpp b/solutions/beecrowd/2057/2057.cpp index 5f0e97be..8ed3dc7a 100644 --- a/solutions/beecrowd/2057/2057.cpp +++ b/solutions/beecrowd/2057/2057.cpp @@ -1,4 +1,5 @@ #include +#include #include int main() { diff --git a/solutions/beecrowd/2061/2061.cpp b/solutions/beecrowd/2061/2061.cpp index 33273073..bae30113 100644 --- a/solutions/beecrowd/2061/2061.cpp +++ b/solutions/beecrowd/2061/2061.cpp @@ -1,5 +1,6 @@ #include #include +#include int main() { std::int16_t n, m, open_tabs; diff --git a/solutions/beecrowd/2137/2137.cpp b/solutions/beecrowd/2137/2137.cpp index 68b600f6..48b75add 100644 --- a/solutions/beecrowd/2137/2137.cpp +++ b/solutions/beecrowd/2137/2137.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include int main() { diff --git a/solutions/beecrowd/2147/2147.cpp b/solutions/beecrowd/2147/2147.cpp index 8a6b38ad..8a1d3d9c 100644 --- a/solutions/beecrowd/2147/2147.cpp +++ b/solutions/beecrowd/2147/2147.cpp @@ -1,6 +1,7 @@ #include #include #include +#include int main() { std::int16_t t; diff --git a/solutions/beecrowd/2174/2174.cpp b/solutions/beecrowd/2174/2174.cpp index 5c93f777..3f1a5aa5 100644 --- a/solutions/beecrowd/2174/2174.cpp +++ b/solutions/beecrowd/2174/2174.cpp @@ -1,6 +1,7 @@ #include #include #include +#include int main() { std::int16_t n; diff --git a/solutions/beecrowd/2176/2176.cpp b/solutions/beecrowd/2176/2176.cpp index c9c84dc5..82e85c68 100644 --- a/solutions/beecrowd/2176/2176.cpp +++ b/solutions/beecrowd/2176/2176.cpp @@ -1,5 +1,6 @@ #include #include +#include int main() { std::string s; diff --git a/solutions/beecrowd/2242/2242.cpp b/solutions/beecrowd/2242/2242.cpp index 9b812bdc..e18f62a5 100644 --- a/solutions/beecrowd/2242/2242.cpp +++ b/solutions/beecrowd/2242/2242.cpp @@ -1,5 +1,6 @@ #include #include +#include bool is_vowel(char c) { return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); diff --git a/solutions/beecrowd/2253/2253.cpp b/solutions/beecrowd/2253/2253.cpp index 3f5914d1..87a0dc8c 100644 --- a/solutions/beecrowd/2253/2253.cpp +++ b/solutions/beecrowd/2253/2253.cpp @@ -1,5 +1,6 @@ #include #include +#include bool is_password_valid(std::string password) { if (!(password.size() >= 6 && password.size() <= 32)) { diff --git a/solutions/beecrowd/2310/2310.cpp b/solutions/beecrowd/2310/2310.cpp index f63dae1d..94cda507 100644 --- a/solutions/beecrowd/2310/2310.cpp +++ b/solutions/beecrowd/2310/2310.cpp @@ -1,6 +1,7 @@ #include #include #include +#include int main() { std::int16_t n; diff --git a/solutions/beecrowd/2311/2311.cpp b/solutions/beecrowd/2311/2311.cpp index 02799936..55af4cf2 100644 --- a/solutions/beecrowd/2311/2311.cpp +++ b/solutions/beecrowd/2311/2311.cpp @@ -1,6 +1,8 @@ +#include #include #include #include +#include int main() { std::int16_t n, i; diff --git a/solutions/beecrowd/2313/2313.cpp b/solutions/beecrowd/2313/2313.cpp index 6c1872ba..4a4e2e46 100644 --- a/solutions/beecrowd/2313/2313.cpp +++ b/solutions/beecrowd/2313/2313.cpp @@ -2,6 +2,7 @@ #include #include #include +#include bool can_form_triangle(std::int16_t a, std::int16_t b, std::int16_t c) { if (a >= b + c) { diff --git a/solutions/beecrowd/2486/2486.cpp b/solutions/beecrowd/2486/2486.cpp index 8158942d..c34b7588 100644 --- a/solutions/beecrowd/2486/2486.cpp +++ b/solutions/beecrowd/2486/2486.cpp @@ -1,6 +1,7 @@ #include #include #include +#include int main() { std::int16_t MIN_VITAMIN_C = 110; diff --git a/solutions/beecrowd/2510/2510.cpp b/solutions/beecrowd/2510/2510.cpp index d31c4920..892a1053 100644 --- a/solutions/beecrowd/2510/2510.cpp +++ b/solutions/beecrowd/2510/2510.cpp @@ -1,5 +1,6 @@ #include #include +#include int main() { std::int16_t n; diff --git a/solutions/beecrowd/2523/2523.cpp b/solutions/beecrowd/2523/2523.cpp index 593b3838..5f4b5aaf 100644 --- a/solutions/beecrowd/2523/2523.cpp +++ b/solutions/beecrowd/2523/2523.cpp @@ -1,5 +1,6 @@ #include #include +#include int main() { std::string alphabet; diff --git a/solutions/beecrowd/2766/2766.cpp b/solutions/beecrowd/2766/2766.cpp index 4cac2851..d332256b 100644 --- a/solutions/beecrowd/2766/2766.cpp +++ b/solutions/beecrowd/2766/2766.cpp @@ -1,5 +1,6 @@ #include #include +#include int main() { std::string name; diff --git a/solutions/geeksforgeeks/longest-common-substring/longest-common-substring.cpp b/solutions/geeksforgeeks/longest-common-substring/longest-common-substring.cpp index d731bdd3..d3171dff 100644 --- a/solutions/geeksforgeeks/longest-common-substring/longest-common-substring.cpp +++ b/solutions/geeksforgeeks/longest-common-substring/longest-common-substring.cpp @@ -1,6 +1,7 @@ #include #include #include +#include int main() { std::int16_t t, n, m, lcs; diff --git a/solutions/google-code-jam/2017/qualification-round/oversized-pancake-flipper/oversized-pancake-flipper.cpp b/solutions/google-code-jam/2017/qualification-round/oversized-pancake-flipper/oversized-pancake-flipper.cpp index 98e447ea..cbc6c564 100644 --- a/solutions/google-code-jam/2017/qualification-round/oversized-pancake-flipper/oversized-pancake-flipper.cpp +++ b/solutions/google-code-jam/2017/qualification-round/oversized-pancake-flipper/oversized-pancake-flipper.cpp @@ -1,4 +1,5 @@ #include +#include int main() { std::int16_t t, flipper_capacity;