Skip to content

Test StaticAnalysis action#3

Draft
JacobDomagala wants to merge 1 commit into
mainfrom
test-static-analysis
Draft

Test StaticAnalysis action#3
JacobDomagala wants to merge 1 commit into
mainfrom
test-static-analysis

Conversation

@JacobDomagala
Copy link
Copy Markdown
Owner

@JacobDomagala JacobDomagala commented Apr 28, 2021

@JacobDomagala JacobDomagala changed the title Make changes to repo Test StaticAnalysis action Apr 28, 2021
@JacobDomagala JacobDomagala force-pushed the test-static-analysis branch 3 times, most recently from 7ebe9e7 to 1caaa8e Compare April 28, 2021 15:54
@JacobDomagala JacobDomagala marked this pull request as draft April 28, 2021 16:08
@JacobDomagala JacobDomagala force-pushed the test-static-analysis branch 7 times, most recently from ae5b3da to 5796ae7 Compare May 1, 2021 15:10
@JacobDomagala JacobDomagala force-pushed the test-static-analysis branch 4 times, most recently from 15b37e9 to e9dffd3 Compare July 4, 2021 13:02
@JacobDomagala JacobDomagala force-pushed the main branch 4 times, most recently from 2b67b3f to 3f61b8c Compare October 17, 2021 14:15
@JacobDomagala JacobDomagala force-pushed the main branch 2 times, most recently from 7185a50 to 38c0425 Compare November 22, 2021 12:40
@JacobDomagala JacobDomagala force-pushed the test-static-analysis branch 5 times, most recently from 4601a38 to e0bd5ec Compare December 5, 2021 19:21
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 7, 2023

⚡ Python ⚡

🔴 PyLint found 6 issues! Click here to see details.

TestRepo/source.py

Lines 42 to 47 in 1b5cf6b

print "This will not print"
# Equality comparison with single '='
if user_input = 'exit':
sys.exit()

!Line: 42 - E0001: Parsing failed: 'Missing parentheses in call to 'print'. Did you mean print(...)? (source, line 42)' (syntax-error)

TestRepo/local.py

Lines 31 to 35 in 1b5cf6b

"+Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm*, -hicpp-uppercase-literal-suffix, -readability-uppercase-literal-suffix'\n"\
"+WarningsAsErrors: '*'\n"\
"+HeaderFilterRegex: ''\n"\
"+FormatStyle: none\n"
get_lines_changed_from_patch(patch)

!Line: 31 - C0301: Line too long (182/100) (line-too-long)

TestRepo/local.py

Lines 1 to 6 in 1b5cf6b

def get_lines_changed_from_patch(patch):
lines_changed = []
lines = patch.split('\n')
for line in lines:
# Example line @@ -43,6 +48,8 @@

!Line: 1 - C0114: Missing module docstring (missing-module-docstring)

TestRepo/local.py

Lines 1 to 6 in 1b5cf6b

def get_lines_changed_from_patch(patch):
lines_changed = []
lines = patch.split('\n')
for line in lines:
# Example line @@ -43,6 +48,8 @@

!Line: 1 - C0116: Missing function or method docstring (missing-function-docstring)

TestRepo/local.py

Lines 1 to 6 in 1b5cf6b

def get_lines_changed_from_patch(patch):
lines_changed = []
lines = patch.split('\n')
for line in lines:
# Example line @@ -43,6 +48,8 @@

!Line: 1 - W0621: Redefining name 'patch' from outer scope (line 29) (redefined-outer-name)

TestRepo/local.py

Lines 29 to 34 in 1b5cf6b

patch="@@ -0,0 +1,5 @@\n"\
"+---\n"\
"+Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm*, -hicpp-uppercase-literal-suffix, -readability-uppercase-literal-suffix'\n"\
"+WarningsAsErrors: '*'\n"\
"+HeaderFilterRegex: ''\n"\
"+FormatStyle: none\n"

!Line: 29 - C0103: Constant name "patch" doesn't conform to UPPER_CASE naming style (invalid-name)


@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 19, 2025

⚡ SA CMake output ⚡

🔴 cppcheck found 6 issues! Click here to see details.

TestRepo/source.cpp

Lines 9 to 14 in 1b5cf6b

Example() : ptr(new int(42)) {} // Memory leak potential
void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}

!Line: 9 - warning: Class 'Example' does not have a copy constructor which is recommended since it has dynamic memory/resource management. [noCopyConstructor]

TestRepo/source.cpp

Lines 9 to 14 in 1b5cf6b

Example() : ptr(new int(42)) {} // Memory leak potential
void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}

!Line: 9 - warning: Class 'Example' does not have a operator= which is recommended since it has dynamic memory/resource management. [noOperatorEq]

TestRepo/source.cpp

Lines 36 to 41 in 1b5cf6b

std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;

!Line: 36 - error: Null pointer dereference: ptr [nullPointer]

!Line: 35 - note: Assignment 'ptr=nullptr', assigned value is 0
!Line: 36 - note: Null pointer dereference

TestRepo/source.cpp

Lines 35 to 40 in 1b5cf6b

int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access

!Line: 35 - style: Variable 'ptr' can be declared as pointer to const [constVariablePointer]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: Out of bounds access in expression 'vec[10]' because 'vec' is empty. [containerOutOfBounds]

TestRepo/source.cpp

Lines 41 to 44 in 1b5cf6b

std::vector<int> unusedvec;
return 0;
}

!Line: 41 - style: Unused variable: unusedvec [unusedVariable]


🔴 clang-tidy found 24 issues! Click here to see details.

int do_nothing(int /*argc*/, char** /*argv*/){
return 0;
}

!Line: 1 - error: function 'do_nothing' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

TestRepo/source.cpp

Lines 2 to 7 in 1b5cf6b

#include <string>
#include <vector>
class Example {
int* ptr;

!Line: 2 - error: included header string is not used directly [misc-include-cleaner,-warnings-as-errors]

TestRepo/source.cpp

Lines 5 to 10 in 1b5cf6b

class Example {
int* ptr;
public:
Example() : ptr(new int(42)) {} // Memory leak potential

!Line: 5 - error: class 'Example' can be moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

TestRepo/source.cpp

Lines 5 to 10 in 1b5cf6b

class Example {
int* ptr;
public:
Example() : ptr(new int(42)) {} // Memory leak potential

!Line: 5 - error: class 'Example' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions,hicpp-special-member-functions,-warnings-as-errors]

TestRepo/source.cpp

Lines 9 to 14 in 1b5cf6b

Example() : ptr(new int(42)) {} // Memory leak potential
void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}

!Line: 9 - error: 42 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-warnings-as-errors]

TestRepo/source.cpp

Lines 11 to 16 in 1b5cf6b

void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}
~Example() {

!Line: 11 - error: parameter name 'p' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 21 to 26 in 1b5cf6b

int divide(int a, int b) {
if (b == 0) {
std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;

!Line: 21 - error: function 'divide' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

TestRepo/source.cpp

Lines 21 to 26 in 1b5cf6b

int divide(int a, int b) {
if (b == 0) {
std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;

!Line: 21 - error: parameter name 'a' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 21 to 26 in 1b5cf6b

int divide(int a, int b) {
if (b == 0) {
std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;

!Line: 21 - error: parameter name 'b' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 23 to 28 in 1b5cf6b

std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;
}

!Line: 23 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 30 to 35 in 1b5cf6b

Example ex;
int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;

!Line: 30 - error: variable 'ex' of type 'Example' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 30 to 35 in 1b5cf6b

Example ex;
int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;

!Line: 30 - error: variable name 'ex' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 31 to 36 in 1b5cf6b

int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 31 - error: variable 'x' of type 'int' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 31 to 36 in 1b5cf6b

int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 31 - error: variable name 'x' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 31 to 36 in 1b5cf6b

int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 31 - error: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-warnings-as-errors]

TestRepo/source.cpp

Lines 32 to 37 in 1b5cf6b

int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 32 - error: variable 'y' of type 'int' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 32 to 37 in 1b5cf6b

int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 32 - error: variable name 'y' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 33 to 38 in 1b5cf6b

std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;

!Line: 33 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 35 to 40 in 1b5cf6b

int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access

!Line: 35 - error: pointee of variable 'ptr' of type 'int *' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 36 to 41 in 1b5cf6b

std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;

!Line: 36 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: possibly unsafe 'operator[]', consider bounds-safe alternatives [cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,-warnings-as-errors]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-warnings-as-errors]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 41 to 44 in 1b5cf6b

std::vector<int> unusedvec;
return 0;
}

!Line: 41 - error: variable 'unusedvec' of type 'std::vector<int>' can be declared 'const' [misc-const-correctness,-warnings-as-errors]


@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 19, 2025

⚡ SA non-CMake output ⚡

🔴 cppcheck found 6 issues! Click here to see details.

TestRepo/source.cpp

Lines 9 to 14 in 1b5cf6b

Example() : ptr(new int(42)) {} // Memory leak potential
void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}

!Line: 9 - warning: Class 'Example' does not have a copy constructor which is recommended since it has dynamic memory/resource management. [noCopyConstructor]

TestRepo/source.cpp

Lines 9 to 14 in 1b5cf6b

Example() : ptr(new int(42)) {} // Memory leak potential
void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}

!Line: 9 - warning: Class 'Example' does not have a operator= which is recommended since it has dynamic memory/resource management. [noOperatorEq]

TestRepo/source.cpp

Lines 36 to 41 in 1b5cf6b

std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;

!Line: 36 - error: Null pointer dereference: ptr [nullPointer]

!Line: 35 - note: Assignment 'ptr=nullptr', assigned value is 0
!Line: 36 - note: Null pointer dereference

TestRepo/source.cpp

Lines 35 to 40 in 1b5cf6b

int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access

!Line: 35 - style: Variable 'ptr' can be declared as pointer to const [constVariablePointer]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: Out of bounds access in expression 'vec[10]' because 'vec' is empty. [containerOutOfBounds]

TestRepo/source.cpp

Lines 41 to 44 in 1b5cf6b

std::vector<int> unusedvec;
return 0;
}

!Line: 41 - style: Unused variable: unusedvec [unusedVariable]


🔴 clang-tidy found 23 issues! Click here to see details.

TestRepo/source.cpp

Lines 2 to 7 in 1b5cf6b

#include <string>
#include <vector>
class Example {
int* ptr;

!Line: 2 - error: included header string is not used directly [misc-include-cleaner,-warnings-as-errors]

TestRepo/source.cpp

Lines 5 to 10 in 1b5cf6b

class Example {
int* ptr;
public:
Example() : ptr(new int(42)) {} // Memory leak potential

!Line: 5 - error: class 'Example' can be moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

TestRepo/source.cpp

Lines 5 to 10 in 1b5cf6b

class Example {
int* ptr;
public:
Example() : ptr(new int(42)) {} // Memory leak potential

!Line: 5 - error: class 'Example' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator [cppcoreguidelines-special-member-functions,hicpp-special-member-functions,-warnings-as-errors]

TestRepo/source.cpp

Lines 9 to 14 in 1b5cf6b

Example() : ptr(new int(42)) {} // Memory leak potential
void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}

!Line: 9 - error: 42 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-warnings-as-errors]

TestRepo/source.cpp

Lines 11 to 16 in 1b5cf6b

void setPtr(int* p) {
delete ptr; // Potential double delete
ptr = p;
}
~Example() {

!Line: 11 - error: parameter name 'p' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 21 to 26 in 1b5cf6b

int divide(int a, int b) {
if (b == 0) {
std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;

!Line: 21 - error: function 'divide' can be made static or moved into an anonymous namespace to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]

TestRepo/source.cpp

Lines 21 to 26 in 1b5cf6b

int divide(int a, int b) {
if (b == 0) {
std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;

!Line: 21 - error: parameter name 'a' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 21 to 26 in 1b5cf6b

int divide(int a, int b) {
if (b == 0) {
std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;

!Line: 21 - error: parameter name 'b' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 23 to 28 in 1b5cf6b

std::cout << "Division by zero!" << std::endl; // Exception not thrown
return -1;
}
return a / b;
}

!Line: 23 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 30 to 35 in 1b5cf6b

Example ex;
int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;

!Line: 30 - error: variable 'ex' of type 'Example' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 30 to 35 in 1b5cf6b

Example ex;
int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;

!Line: 30 - error: variable name 'ex' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 31 to 36 in 1b5cf6b

int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 31 - error: variable 'x' of type 'int' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 31 to 36 in 1b5cf6b

int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 31 - error: variable name 'x' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 31 to 36 in 1b5cf6b

int x = 10;
int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 31 - error: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-warnings-as-errors]

TestRepo/source.cpp

Lines 32 to 37 in 1b5cf6b

int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 32 - error: variable 'y' of type 'int' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 32 to 37 in 1b5cf6b

int y = 0;
std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer

!Line: 32 - error: variable name 'y' is too short, expected at least 3 characters [readability-identifier-length,-warnings-as-errors]

TestRepo/source.cpp

Lines 33 to 38 in 1b5cf6b

std::cout << divide(x, y) << std::endl; // Divide by zero at runtime
int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;

!Line: 33 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 35 to 40 in 1b5cf6b

int* ptr = nullptr;
std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access

!Line: 35 - error: pointee of variable 'ptr' of type 'int *' can be declared 'const' [misc-const-correctness,-warnings-as-errors]

TestRepo/source.cpp

Lines 36 to 41 in 1b5cf6b

std::cout << *ptr << std::endl; // Dereferencing null pointer
std::vector<int> vec;
std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;

!Line: 36 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: possibly unsafe 'operator[]', consider bounds-safe alternatives [cppcoreguidelines-pro-bounds-avoid-unchecked-container-access,-warnings-as-errors]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers,-warnings-as-errors]

TestRepo/source.cpp

Lines 39 to 44 in 1b5cf6b

std::cout << vec[10] << std::endl; // Out of bounds vector access
std::vector<int> unusedvec;
return 0;
}

!Line: 39 - error: do not use 'std::endl' with streams; use '\n' instead [performance-avoid-endl,-warnings-as-errors]

TestRepo/source.cpp

Lines 41 to 44 in 1b5cf6b

std::vector<int> unusedvec;
return 0;
}

!Line: 41 - error: variable 'unusedvec' of type 'std::vector<int>' can be declared 'const' [misc-const-correctness,-warnings-as-errors]


Signed-off-by: JacobDomagala <domagala.jacob@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant