A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d6/d02/file__linter_8py_source.html below:

TheAlgorithms/C++: scripts/file_linter.py Source File

5

print(

"Python {}.{}.{}"

.format(*sys.version_info))

6with

open(

"git_diff.txt"

)

as

in_file:

7

modified_files = sorted(in_file.read().splitlines())

8

print(

"{} files were modified."

.format(len(modified_files)))

10

cpp_exts = tuple(

".c .c++ .cc .cpp .cu .cuh .cxx .h .h++ .hh .hpp .hxx"

.split())

11

cpp_files = [file

for

file

in

modified_files

if

file.lower().endswith(cpp_exts)]

12

print(f

"{len(cpp_files)} C++ files were modified."

)

16

subprocess.run([

"clang-tidy"

,

"--fix"

,

"-p=build"

,

"--extra-arg=-std=c++11"

, *cpp_files,

"--"

],

17

check=

True

, text=

True

, stderr=subprocess.STDOUT)

19

subprocess.run([

"clang-format"

,

"-i"

,

"-style=file"

, *cpp_files],

20

check=

True

, text=

True

, stderr=subprocess.STDOUT)

22

upper_files = [file

for

file

in

cpp_files

if

file != file.lower()]

24

print(f

"{len(upper_files)} files contain uppercase characters:"

)

25

print(

"\n"

.join(upper_files) +

"\n"

)

27

space_files = [file

for

file

in

cpp_files

if " " in

file

or "-" in

file]

29

print(f

"{len(space_files)} files contain space or dash characters:"

)

30

print(

"\n"

.join(space_files) +

"\n"

)

32

nodir_files = [file

for

file

in

cpp_files

if

file.count(os.sep) != 1]

34

print(f

"{len(nodir_files)} files are not in one and only one directory:"

)

35

print(

"\n"

.join(nodir_files) +

"\n"

)

37

bad_files = len(upper_files + space_files + nodir_files)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4